Hi - I'd like to read in the resistance of a variable 100K resistor using an ADC. Can somebody reccomend how I can get a voltage linearly proportional to the resistance of that resistor that can then be read with the ADC? Thanks!
Hi John - I just realized I left out an important detail. One end of the variable resistor is connected to +5V. So to get a voltage drop across the resistor of 5V at the max resistance of 100K, I'd need a constant current source of 5/100K A, or 50uA. The constant current sources I've studied in school have had limited constant operating regions, while here I would ideally like a pretty full operating region between 0 and 5V. What sort of circuit could provide this?
By the way, what I'm trying to do is interface to a standard analog joystick.I have a feeling you can guess what that is for!
Thanks as always,
-Mike
John P> > Hi - I'd like to read in the resistance of a variable 100K resistor
Lets start at the beginning. What is the voltage range of your A/D? What voltages are available? How often do you need to measure the resistance? Do you need maximum resolution across the resistance range, or could you use a nonlinear method and linearize in software (with some loss in resolution)?
Keep in mind that most joystick resistance measurements are made with oscillators that charge a capacitor to some voltage with current through the resistance connected to a fixed voltage, and then dump the charge with a switch, and measure the period of the oscillation this process produces as the resistance changes. A 555 timer can be configured to perform the oscillation function and connect to a digital input that includes an interrupt. The result is nonlinear, but a lookup table (often updated with a calibration test) converts the period to a fairly linear result.
I can set it to whatever is best. It's a 10b ADC and gets maximum accuracy with a 5V reference voltage, but I could also set it to be lower.
5V. Though I can add other voltages if necessary - the size/cost of this board is not an issue.
I'd like to get a full reading (which means reading in from 4 different pots) every tenth of a second or so. Every hundredth would be nice, but not necessary. Certainly nothing faster than that though.
I'm really hoping to avoid a lookup table or some other software linearization. I like everything to be done in hardware, not software. But worst case scenario that is possible.
I was reading up on that method of reading earlier today. For me though, reading in the signal from the 555 would be a pain though, so I'd rather use the ADC.
One thing I was just thinking about - I don't have to use the full range of the ADC. I mean I don't need all 10b of accuracy. So if the current source provided 100ua it would only need to operate properly with a voltage drop between 2.5 and 5V across it, which I think is much easier. With a 5V reference voltage to my ADC I'd have 9b of accuracy, which is more than enough. 7-8b is really all I want.
Any small signal NPN transistors should work. The voltage across the variable resistance should swing between 5 and 1.8 volts or so, with a constant ~32 uA current passing through the resistance. Make sure your A/D leakage current is much lower than this and keep in mind that the A/D voltage will take a while to settle with the resistance at the full 100k ohms.
On Thu, 18 May 2006 07:37:48 -0700, M. Noone top-posted:
Is the other end of the pot grounded? Then you have a range from 0 to 5V, right? I.e., the pot is a voltage divider. So, when it's set at, say, 50K, your ADC will read 2.5V, when it's at 40K you read 2V, when it's at 100K, you read 5V, etc.
So just scale your ADC to read 0-5V, and scale the resulting value such that full-scale corresponds to 100K, and you should be home free. :-)
One time I did it with a series prescision resistor, ADC referenced to Vdd/Vss. And a R-R voltage follower to buffer the RC LPF becase it had long wires. Of course that's a bit nonlinear so a bit of an equation in the 'puter, but there were still plenty of bits left.
Best regards, Spehro Pefhany
--
"it\'s the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
Hi Rich - if it only it were that easy! I don't know why, but for some reason in joysticks, according to my research at least, the other end of the pots are left hanging. I want my circuit to be compatible with any joystick - not just one I've modified, so I really have to design it to use the resistance, not a voltage divider. Thanks,
I probabaly should have mentioned this in my OP - but the other end of the pot is hanging in a typical joystick, from what I've read, so a voltage divider isn't an option. It's a pity, as that sure would make things easier!
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.