Measuring Resistance
JBWolf
Posts: 405
I am working with the 2-axis joystick (part #27800) and having a little trouble getting reliable readings.
The SPIN object from the product page uses RCTIME.SPIN to measure the decay of a capacitor connected to the joystick.
I have tried it with several capacitors (1nf, .1uf & 10uf) and the recommended 220ohm resistors but get odd results with all.
First, I connected an ohmmeter to the 'UD' pins and moved the joystick up and down... I get a good transition from 30ohms full up and around 3kohm full right.
I also did the same with the 'LR' pins and got the same type of results... this was just a standalone test with the joystick isolated on a breadboard.
Using the spin object from the product page, the one that uses rctime, I do not get a good transition for either LR or UD.
The way I believe it is supposed to act is lowest value is full left and highest is full right.... instead I get a very high value in one direction leading down, and the other direction I get a lower value leading up.
So for example at rest, LR will read about 1600 (displayed in PST). Pushing the joystick right makes LR increase from 1600 linearly until it maxes at about 3000... but if I go left (from at rest (1600)) it will immediately jump to 6000 and then decrease until it reaches minimum at about 200. I cannot use these results for positioning as now there are 2 different positions that have the same value.
I need to figure out a way to get useable results.
Since I get good values with an ohmmeter I was hoping I could use one or two pins on the prop to measure resistance.
Is there a simple way to measure resistance? If not, what do you guys suggest?
Thanks,
J
The SPIN object from the product page uses RCTIME.SPIN to measure the decay of a capacitor connected to the joystick.
I have tried it with several capacitors (1nf, .1uf & 10uf) and the recommended 220ohm resistors but get odd results with all.
First, I connected an ohmmeter to the 'UD' pins and moved the joystick up and down... I get a good transition from 30ohms full up and around 3kohm full right.
I also did the same with the 'LR' pins and got the same type of results... this was just a standalone test with the joystick isolated on a breadboard.
Using the spin object from the product page, the one that uses rctime, I do not get a good transition for either LR or UD.
The way I believe it is supposed to act is lowest value is full left and highest is full right.... instead I get a very high value in one direction leading down, and the other direction I get a lower value leading up.
So for example at rest, LR will read about 1600 (displayed in PST). Pushing the joystick right makes LR increase from 1600 linearly until it maxes at about 3000... but if I go left (from at rest (1600)) it will immediately jump to 6000 and then decrease until it reaches minimum at about 200. I cannot use these results for positioning as now there are 2 different positions that have the same value.
I need to figure out a way to get useable results.
Since I get good values with an ohmmeter I was hoping I could use one or two pins on the prop to measure resistance.
Is there a simple way to measure resistance? If not, what do you guys suggest?
Thanks,
J
Comments
http://forums.parallax.com/showthread.php/144037-RC-Time-Circuit?highlight=RCTIME
I don`t know the RCTIME Object - have you calculated the expected time constant T = 0.7 * R * C to check if this makes sense with the objects timing parameters?
30 Ohms to 3k Ohms is a factor of 100 !!
Maybe you need a series resistor - 1k to 3k to get it into a smaller range which you can handle with one single C value.
Another way, feed pots to ADC and figure position from ADC value from 0 to say vref w/ vref also being supplied to the pits of the joy stick. 12 bit would give you 4096 count range, w/ Vref/4096 the smallest resolvable value.
A very costly way would be feed the pot output to a comparator, feed a DAC to the comparator and have the prop step up the DAC outputs while watching for the comparator output to flip indicating digital valeue of the input. Digital ramp method.
I also have not played with rc time, but if it is sigma-delta based, there are problems with that method related to layout and other issues especially on a bread board. Memory weak onthis, but google is my navigator.
Lots of ways, play and have fun.
Frank
The PEkit is where I started, RCTIME does not work like it should with the joystick added in as the potentiometer.
I just tried again using .1uf caps and 100ohm resistors instead of 220. Same type of results, at rest it reads 16k.... going left it jumps to 90k then reduces to a minimum of 500... going the other way (right) goes up from 16k (rest) to about 35k maximum..... so once again I have 2 positions with the same value.
using 1k instead of 100 or 220ohm simply scales the results. So Im getting a left range of 9k to 500, and a right range of 1.6k to 3.5k
Just an alternate idea to try,
Frank
Just tested one of my controllers, range was about 290 to 9.2k with ~5k center position.
http://learn.parallax.com/KickStart/27800
C.W.
ctw: yes that is the exact tutorial I followed on my first attempt.
The 30 ohm to 3K measurement does not sound correct, that Joystick is supposed to have 10k pots.
Are you sure you had nothing else connected and measured resistance from GND to U/D for up/down and from GND to R/L for left/right?
C.W.
Looking at C.W.s post, it maybe worth checking your device connections against the part schematic. I have noticed that you will not get the full range of the pot as the mechanics will limit the pot to a fairly narrow range. Forgot about testing this a while back. To get the full range of output from the adc, you may need to scale/amplify the input to the ADC.
Frank
Do you have a scope to sanity check this ?
You could also try a 74HCT4538 Dual Monostable, which has proper charge and discharge management, and use that as a 'gold standard' while you experiment with doing the same thing, via prop pins.
How much are the readings varying ? Some quantization errors are bound to happen.
Alan
together with the results of your OHM-meter
It took a while to find it as they are in regular Radio Shack packaging with the other Radio Shack switches.
I haven't tried using it with my quickstart yet but I did check the resistance values:
UP (9.05k ohms) - MIDDLE (4.67k ohms) - DOWN (9 ohms)
LEFT (6.5 ohms) - MIDDLE (4.86k ohms) - RIGHT (9.77k ohms)
C.W.