Why can an Arduino measure a digital potentiometer but not a rheostat?

A couple of months ago, some people gave me some good advice on a rheostat. In particular, Richard Crowley noted that you cannot use an Arduino to measure a rheostat, like you can do with a potentiometer:

www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1294391588/10#10

He's right. I could get some repeatable output from the rheostat, but the measurement using the analog pin of the Arduino was pretty nonlinear. I'm pretty sure the resistance increased linearly, but I just could not see it.

By contrast, I tried a couple of digital potentiometers, hooking one end up to 5 Volts and end up to ground, and the Arduino analog input worked perfectly. The output was exactly linear.

Obviously, the fact that the rheostat has one end floating instead of hooked up to ground made a difference. But what is the difference? I can't figure it out. Anyone have an explanation?

Obviously, the fact that the rheostat has one end floating instead of hooked up to ground made a difference. But what is the difference? I can't figure it out. Anyone have an explanation?

To put it as simple and terse as possible, a rheostat is just a two terminal adjustable resistor. A 3 terminal potentiometer, wired correctly, is a variable voltage divider. An arduino analog input measures voltage, not resistance.

Rheostat is a single resistor, pot is really acting like two resistors.

Lefty

Have a look on the link:

That is completely different with linear equation

Y = k * X + a;

When you have a measurements with rheostat:

415e91d513b35ad4092e9c5eb59980f0.png

Thanks, Lefty. Excellent explanation. And thanks, Magician, for following up with the math. I've got it now. Makes perfect sense.

Let me just finish off this thread. Once Lefty had forced me to take proper note of the fact that the Arduino measures voltage, not resistance, I was able to calculate the resistance for the rheostat. It turns out that the resistance for the 10k Ohm, 256-step digital rheostat does step up very linearly -- it will be fine for my application.

I calculated the resistance as follows. I hooked the input pin for the rheostat to 5 Volts. I hooked the output pin up to an analog input pin on the Arduino. I also hooked it up to a 2.5k Ohm resistor tied to ground. So I had a voltage divider. The top resistor varied from 0 to 10k Ohms. The bottom resistor was fixed at 2.5k Ohms.

Then I sent the digital rheostat steps 0 through 255 and recorded the voltage level on the Arduino analog input pin for each step. Since the Arduino input pin was getting a voltage instead of a resistance, I used one of Magician's formulas to calculate the resistance. My formula was R = 2,500 Ohms * ((Voltage in) / (Voltage out) - 1).

Even though the measured voltage out was nonlinear, the calculated resistance went from 93 Ohms (the wiper resistance is 75 Ohms) to 9.8k Ohms in a very linear fashion.