Why does potentiometer resistance value not matter?

When I use a 10k or a 5k, it still perfectly makes the serial output from 0 to 1023. I would think it would get to 1023 only moving the wiper HALF way with a 5k, but it still takes a WHOLE spin of the shaft for it to use the full range of numbers (0,1023). How does the Arduino doing this?

The pot makes a voltage divider that feeds the analog input. Vout = Vin * R2/(R1+R2) where R1 is the resistance between Vin and Vout, and R2 is the resistance between Vout and Ground. If the knob is halfway, then R1 = R2, so the equation simplifies: Vout = Vin * R1/(R1+R1) so with 5K: Vout = 5V * 2500/(2500+2500) = 2.5V. and with10K Vout = 5V * 5000/(5000+5000) = 2.5V.

So the overall value of the pot doesn't really matter. Where the value does come into play is how power it dissipates. Power = Current x Voltage, or P=IV. Current = Voltage/Resistance, so a 5K pot with 5V will have 5V/5000ohm = .001A, 1mA going thru it. Power = .001A * 5V = 5mW, which is not much, but might be an issue for battery powered operation where long ontime is a concern. In which case a 10K pot might be better.

kipp: http://arduino.cc/en/Tutorial/AnalogInput When I use a 10k or a 5k, it still perfectly makes the serial output from 0 to 1023. I would think it would get to 1023 only moving the wiper HALF way with a 5k, but it still takes a WHOLE spin of the shaft for it to use the full range of numbers (0,1023). How does the Arduino doing this?

A potentiometer is a resistor with a movable "pick-off" point.

If you turn the shaft 1/2 way, it's "picking off" approximately 1/2 of the voltage applied to it. Since 5 volts is applied to "all of it", taking off 1/2 gives you 1/2 the total, or 2.5 volts. Looked at from this angle, the value is not important.

However, the value of the resistance DOES matter to a certain extent. For example, if you used a 10 ohm potentiometer connected across 5 volts, the pot alone would draw 500 milliamperes and dissipate 5 * 0.5 or 2.5 watts (i.e. it would get quite warm and maybe even burn out).

So, too LOW a value is not good (although if you turned the shaft 1/2 way, you would STILL get 1/2 of the total 5 volts out - if the pot wasn't burned out that is).

On the other hand, you could use a 10 megohm pot. Again, if the shaft was turned 1/2 way, you would get 1/2 the output. But, the input impedance (or "resistance") of the A/D input pin itself is less than infinity. In fact, Atmel recommends that the impedance of the signal you are measuring be 10K ohms or less.

With a 10 megohm pot, setting the shaft at the 1/2 way point would still give you 1/2 of the input voltage, but if you connected that to an Arduino A/D input pin, the A/D input would "load down" the signal and you would read a lot less than the 2.5 volts (or an analog count of 512) that you expected.

So you see choosing the RIGHT value of potentiometer involves a compromise between having a "stiff enough" (low enough impedance) signal to measure accurately while not being too low and drawing a lot of current and possibly overheating.

For use with the Arduino A/D inputs, a pot value in the range of 1K, 5K or 10K will give you the best results.

Make sense?