how to read resistance of variable resistor with ADC?

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!

Reply to
M. Noone
Loading thread data ...

Drive the resistance with a constant current that produces an almost full scale voltage at the highest resistance of interest.

Reply to
John Popelish

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

Reply to
M. Noone

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.

Reply to
John Popelish

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.

Thanks,

-Mike

Reply to
M. Noone

If you are willing to read voltages between 2.5 and 5 volts, I think I can come up with a 100 uA current source that can operate with 2.5 to

5 volts across it made with a pair of transistors (perhaps two in a 6 pin SMT package) and two or three resistors.

Are you worried about temperature stability, or will this only need to operate near normal room temperature?

Reply to
John Popelish

I'd be very interested to see what you can come up with! The only current sources I've seen have been with single mosfets, which are far from ideal!

It will always be at room temperature. Worst case scenario is it'll be outside in the sun.

-Mike

Reply to
M. Noone

View with fixed width font:

+5volts-----+-----+ | | 100k 0 to 100k variable resistance | | | |/ +----| | |< \\| | |----+ >| | | 18k | | 0V----------+-----+

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.

Reply to
John Popelish

John Popelish wrote: Those should be NPNtransistors (corrected, below).

Reply to
John Popelish

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. :-)

Good Luck! Rich

Reply to
Rich Grise

Did you ever learn any basic electronics ? Hint - voltage divider.

Graham

Reply to
Pooh Bear

This *has* to be a troll.

Google voltage divider and *learn* something instead of expecting to be spoon fed the very basics.

Graham

Reply to
Pooh Bear

This 'variable resistor' has 3 terminals I hope ? Think about it.

Graham

Reply to
Pooh Bear

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
Reply to
Spehro Pefhany

Uh ? 100uA x 100k is 10 volts.

Tip. The variable resistor won't really measure 100k with any accuracy. How are you going to measure accurately ?

Graham

Reply to
Pooh Bear

Hmmm... ! Where are you studying ? What's the course called ?

formatting link

So beware of thermal drift issues which won't happen if you use the simplest voltage divider method of course.

Graham

Reply to
Pooh Bear

At last a sensible response ! What troubles me is that the OP didn't even seem to be aware of the voltage divider method.

Better still, if the pot is actually 108k ohms then you get 100% of FSD when it's set at 108 k ohms.

Graham

Reply to
Pooh Bear

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,

-Mike

Reply to
M. Noone

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!

-Mike

Reply to
M. Noone

You shouldn't make quite so many assumptions about me and what I'm working on. If you did even a quick google - you'd be the one to

*learn* something and find that there is no voltage divider in a standard joystick.

-Mike

Reply to
M. Noone

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.