how to read resistance of variable resistor with ADC?

linearly

read

Of course. Should have spotted that.

input

Yup. Sounds like a good one to go with in that case.

Graham

Reply to
Pooh Bear
Loading thread data ...

For some of my classes, yes. Many classes don't have a textbook or have a spiral bound textbook that costs $10 or so. I find that I normally spend the most on textbooks for classes that are not part of my major - for example I spent about $250 on all the materials for organic chemistry. That was less than fun.

-Mike

Reply to
M. Noone

The secret to that, of course, is to have an older brother (or a sister could work, of course) whose books you can study five years before you have to take the class. ;-)

Cheers! Rich

Reply to
Rich Grise

Doesn't the guy know how to do a look-up table?

Thanks, Rich

Reply to
Rich Grise

Well, goddammit! What _DO_ you want to do? We're stabbing in the dark here, trying to offer you suggestions - can you state your goal in 25 words or less?

Thanks, Rich

Reply to
Rich Grise

But the original problem arose becaue the OP doesn't have access to all three ends of the pot.

Thanks, Rich

Reply to
Rich Grise

The circuit does not require access to all three ends. The right-hand side of the element can be floating, but it's good practice to tie it to the wiper if possible.

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

It can easily be linearized without resorting to a brute-force LUT.

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

Hi Rich - to be honest, I don't think I could have been much more clear. This is my OP:

I never mentioned having a potentiometer, only that the resistance was variable. I also said that I need it to be linear. I did leave out that one end was tied high to 5V, and for that overisght you have my apologies.

Anyways - Let's see, 25 words or less? I would like to get a voltage ranging from 0-5V linearly proportional to the resistance of a variable resistor tied to 5V which changes from 0-100K.

OK that's slightly more than 25, but close enough right? :)

But anyways - John's solution looks just right to me, so I think I will use that, unless there's something I'm not understanding about it. Thanks,

-Mike

Reply to
M. Noone

I don't understand. Why is Vsense not a linear function of the resistance of the joystick rheostat?

Is Vsense = [5/(R+100k)]*100k not corect?

It looks to me like a linear function with a 2.5V offset. Using a 10bit, A/D wouldn't it be as simple as reading the A/D and subtracting 512 from it to yield and 8 bit linear result? Or probably better to use an opamp to buffer Vsense and subtract 2.5V.

Mike

Reply to
Mike

Vsense = 5* 100/(100+x), that's nonlinear. x is on the bottom.

dVsense/dx = -500/(100+x)^2 so the sensitivity at x = 0 is

50mV/Kohm and at x = 100 is 12.5mV/Kohm, which is a ratio of 4:1, so you lose ln4/ln2 = 2 bits of resolution at the high resistance end. So your 10 bit ADC gives you resolution of an 8 bit worst-case. Still plenty for a joystick, eh?

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

"Oh I see", He said as the lights came on. I shoulda realized that. Thank you!

Mike

Reply to
Mike

OK, it's my turn to apologize for being so bitchy - you've got a workable answer, and that's what really counts. :-)

Thanks! Rich

Reply to
Rich Grise

No- this is the simplest: View in a fixed-width font such as Courier.

. . . . . +5V . | . | . / . \\ . / OUT . \\ . / . \\ . | . --- . . . .

Reply to
Fred Bloggs

You're really slipping Fred. The OP is using off-the-shelf joy sticks, one end of the pot is NOT connected.

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

--- Agreed.

Unfortunately, the OP asked for:

"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"

-- John Fields Professional Circuit Designer

Reply to
John Fields

Right- I just checked with the ePanorama lowdown on the IBM PC joystick- and they say the rheostats can vary from 100K to 470K. The essential task here is to measure displacement and not unknown resistance. The tap voltage is the same if the pot is grounded at the other end and no tap current is drawn, OR, the pot is not grounded at the other end and a current of magnitude Vcc/Rpot is drawn from the tap. This second observation leads to something like this more or less-some details omitted: View in a fixed-width font such as Courier.

. . . joystick . +------------+ OA dual RRIO . | | . | .-------|-------------------------+---- OUT 0->5V . | \\ Rjs | | .-|-/ | | . | / | | | |/ | | . | \\ | | | | | . | | | '-------' | . | | .---+ | . +------------+ | | /| | . === -| /+|--------+ . 10N| |--< | | . --- -| \\-|-. | . | \\| | | . |2N7000 | | . | | | . +---------' | . | | . [1.0K] [1.0K] . | | . | | . --- --- .

Reply to
Fred Bloggs

Yep. A low head-room current sink.

(But that 10nF may be too much for fast gamers ;-)

...Jim Thompson

--
|  James E.Thompson, P.E.                           |    mens     |
|  Analog Innovations, Inc.                         |     et      |
|  Analog/Mixed-Signal ASIC\'s and Discrete Systems  |    manus    |
|  Phoenix, Arizona            Voice:(480)460-2350  |             |
|  E-mail Address at Website     Fax:(480)460-2142  |  Brass Rat  |
|       http://www.analog-innovations.com           |    1962     |
             
I love to cook with wine.      Sometimes I even put it in the food.
Reply to
Jim Thompson

As long as the OAs are there, the compliance and offset requirements can be relaxed somewhat by gaining: View in a fixed-width font such as Courier.

. . . . . . Adjust Rcal=Rjs-10K . e.g. Rjs=100K . Rcal=90K . joystick . +------------+ OA dual RRIO . | | . | .-------|------------+------------+---- OUT 0->5V . | \\ Rjs | | +-|-/ | | . | / | | | |/ | | . | \\ | | | | | . | | | '-[100K]-' | . | | | | . +------------+ | | . .---+ | . | | /| | . === -| /+|--------+ . 1N| |--< | | . --- -| \\-|-. | . | \\| | | . |2N7000 | | . | | | . +---------' | . | | . [20K] [10K] . | | . | | . --- --- . . .

Reply to
Fred Bloggs

The Apple ][ paddles/joystick interface used a 555-type circuit (ISTR it was a 554 'quad' 555-type circuit for four channels) that converted a variable resistance into a 0-to-255 range value using a bit of software to count when the timer timed out. But OP doesn't want this, OP wants a linear-with-joystick voltage into an ADC.

I'd use the "standard" op-amp current source (see any op-amp textbook or look online - this current source gives full dynamic range and doesn't vary [as much] with temperature), driving one side of the 'variable resistor' with the other side tied to ground. Then buffer that with another op-amp, with some gain and offset as needed to compensate for a joystick whose pot wiper doesn't go over the full range of its resistance, to make the output voltage range correspond to the ADC input range. Use a couple of trimpots to tweak offset and gain to compensate for the tolerance of each pot's min and max resistance.

If that's a problem, then there's the lookup table idea again. I'd prefer doing that in software rather than making a nonlinear circuit to linearize the response, but IIRC the OP would rather do something like that in analog hardware.

Reply to
Ben Bradley

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.