how to read resistance of variable resistor with ADC?
May 18, 2006 59 Replies
M
M. Noone
You're quite right - I doubled the current when I should have halved it. This is what I get from doing everything in my head, not using a calculator, and not checking my work.
I don't understand why this method wouldn't be accurate though - could you further elaborate on this?
Thanks,
-Mike
Didn't find your answer? Ask the community — no account required.
M
M. Noone
formatting link
Junior in EE at UIUC. Most of our coursework thus far has been more theoretical than practical - for example I know all about how a mosfet works at the atomic level, but I have been taught about using them in only the simplest of circuits. I believe the senior year will be more about practical circuits, but still I personally don't agree with this way of teaching.
-Mike
K
Keith
How about doing what joysticks do then. Convert the resistance to a pulse width (555 circuit left for the interested student).
Keith
P
Pooh Bear
Theer's literally no connection ?
Shame. Means it'll have to be calibrated for the track resistance. Actually, are you sure the joystick lever even moves it the whole way ? I suspect it doesn't. Accuracy issues will be the last of your problems.
Graham
P
Pooh Bear
are
Your 100k variable R is likely anywhere betwen 90k and 110 k track resitance. Use say a 100uA current and you'll get an FSD of anywhere between 9V and 11V.
From what I suspect, the max resistance you'll get may be less than that anyway. I'd suggest you measue the resistance span on the D connector. Didn't realise you were using a stock joystick, though you might be making your own improved one.
Graham
S
Spehro Pefhany
Unfortunately. Also the impedance is a bit high to go right into many ADCs. Using a current source or sink means that the maximum source impedance could be as high as 100K.
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
P
Pooh Bear
formatting link
Sounds daft to me to but typically *academic*. They seem to think it's al labout thero when most engineers I know who are any good want to get down with the nitty gritty. I do believe the practical first method teaches a hell of a lot more, faster.
Graham
P
Pooh Bear
spoon
Given that he's designing his own electronics, I reckoned a voltage follower wasn't too tricky to add. However it isn't an actual pot it seems so that's out anyway. The pot would have been 25K max at centre position of course.
Graham
R
Rich Grise
OK, fair enough - I've seen the nightmare IBM joystick interface. Maybe you could just hang another 100K resistor from it to ground, and read a voltage from 2.5 to 5, and scale it accordingly.
But, for something like this, it seems to me it'd be kind of a daunting project to make something that's guaranteed to work with every possible input configuration; but the "standard" joystick circuit does use the pot in a current source, in which case reading the voltage across a series resistor should still work, depending on if the drive is pulsed, and that sort of thing.
Good Luck! RIch
R
Rich Grise
No, but there is a variable resistor, which, when combined with another resistor, does, in fact, create a voltage divider.
M Noone will have to redo the software, of course, to read the ADC value instead of just timing the ramp.
Cheers! Rich
M
M. Noone
Right - but then linearity is lost, which is what I'm doing my best to avoid. I was thinking there'd just be some standard circuit for this. The current source seems like the best method to me, though.
R
Rich Grise
OF COURSE IT IS!!!!!
+5V ------------+ | / 100K pot \\
P
Pooh Bear
formatting link
Actually this reminds me of the year I spent at University College London on an Electronic Engineering degree course. It was *rubbish* . I learnt vastly more ( about electronics at least ) from my self-study. I distinctly remember 2 of my fellow students on the course commenting after they'd passed their exams that they still didn't know how a transistor worked ( as in a practical circuit ). It put me right off. It is seriously no way to teach engineering. Few ppl even need to know how a mosfet works - leave it til later for heavens sake. Engineers just need to know how to use the data.
Graham
P
Pooh Bear
Have you found a circuit for acurrent source yet ? 2 pnp transistors and a resistor will do what you need.
Actually, linearity may be screwed up a bit by the mechanical linkage used.
Graham
P
Pooh Bear
It's far from linear sadly.
Graahm
M
M. Noone
I've seen that type of circuit before - but it is very much non linear, which is why I'm avoiding it. I'd probabaly have to use a lookup table or something if I were to use that kind of circuit, which is not what I want to do...
-Mike
-Mike
A
a7yvm109gf5d1
", but still I personally don't agree with this way of teaching. "
That is because you think you are in school to learn, this is a tragic misconception. School's primary purpose is to create jobs for teachers and create a market for criminally overpriced textbooks. The reason you are not seeing any practical circuits is that it would cost the school too much. It's far easier to stick a bunch of kids in a plain room with some overpriced books and rake the money in. Did your professor also write the textbook?
S
Spehro Pefhany
Why not?
Okay, here's about the cheapest way to get a linear ADC reading (it's also ratiometric to supply voltage, so it assumes that the ADC - and + references are Vss and Vdd.
It doesn't lend itself very well to filtering of junk on the pot wires, so the circuit would be better built into the joystick than elsewhere.
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
P
Pooh Bear
Is that entirely linear ? I'm thinking of the +1 term in the gain equation.
Not sure the op-amp will like a lot of capacitance from the cable on the - input either.
Graham
S
Spehro Pefhany
Yes, it's entirely linear (assuming an ideal op-amp), just with a constant +200mV offset. The rheostat sees a constant current of
200mV/8K = 25uA. Obviously the output impedance is very low.
LM358s are pretty hard to get to oscillate at the worst of times, unless you start loading the output heavily, but if any problems came up, a 10n from output to inverting input would solve it. And 51R on the output wouldn't hurt if it's a long cable to the ADC.
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
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.