Maker Pro
Maker Pro

how to read resistance of variable resistor with ADC?

M

M. Noone

Jan 1, 1970
0
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!
 
J

John Popelish

Jan 1, 1970
0
M. Noone said:
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!

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

M. Noone

Jan 1, 1970
0
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
 
J

John Popelish

Jan 1, 1970
0
M. Noone said:
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!

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.
 
M

M. Noone

Jan 1, 1970
0
John said:
Lets start at the beginning.
What is the voltage range of your A/D?

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.
What voltages are available?

5V. Though I can add other voltages if necessary - the size/cost of
this board is not an issue.
How often do you need to measure the resistance?

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

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.
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 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
 
J

John Popelish

Jan 1, 1970
0
M. Noone said:
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.

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?
 
M

M. Noone

Jan 1, 1970
0
John said:
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?

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
 
J

John Popelish

Jan 1, 1970
0
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.
 
J

John Popelish

Jan 1, 1970
0
John Popelish wrote:
Those should be NPNtransistors (corrected, below).
 
R

Rich Grise

Jan 1, 1970
0
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,

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
 
P

Pooh Bear

Jan 1, 1970
0
M. Noone said:
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!

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

Graham
 
P

Pooh Bear

Jan 1, 1970
0
M. Noone said:
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?

This *has* to be a troll.

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

Graham
 
P

Pooh Bear

Jan 1, 1970
0
M. Noone said:
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!

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

Graham
 
S

Spehro Pefhany

Jan 1, 1970
0
Drive the resistance with a constant current that produces an almost
full scale voltage at the highest resistance of interest.

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
 
P

Pooh Bear

Jan 1, 1970
0
M. Noone said:
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

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
 
P

Pooh Bear

Jan 1, 1970
0
M. Noone said:
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!

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

http://www.google.com/search?client...rrent+source&sourceid=opera&ie=utf-8&oe=utf-8
It will always be at room temperature. Worst case scenario is it'll be
outside in the sun.

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

Graham
 
P

Pooh Bear

Jan 1, 1970
0
Rich said:
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. :)

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
 
M

M. Noone

Jan 1, 1970
0
Rich said:
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
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
 
M

M. Noone

Jan 1, 1970
0
Pooh said:
Did you ever learn any basic electronics ? Hint - voltage divider.

Graham

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
 
M

M. Noone

Jan 1, 1970
0
Pooh said:
This *has* to be a troll.

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

Graham

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
 
Top