8
\$\begingroup\$

First of all I'm total nub in electronics.

Recently I got an Arduino Nano. Now I'm trying to understand why there is no potentiometer nominal at http://arduino.cc/en/Tutorial/ReadAnalogVoltage example and how variation of this nominal would affect Analog input readings.

Also why at http://arduino.cc/en/Tutorial/AnalogReadSerial example they picked 10k potentiometer, what would be different with 200k potentiometer.

Thanks!

\$\endgroup\$

3 Answers 3

12
\$\begingroup\$

There would be no difference in the wiper voltage output from any (unloaded) potentiometer, they all work in the same way.

However, the analogue input to your Arduino recommends a source impedance of less than 10kOhm, for optimum performance. This is due to the time it takes to charge the sample and hold capacitor, which can be seen as a dynamic impedance. The below image is taken from the AtMega328 datasheet (the microcontroller the Arduino is based around):

Analogue input impedance

Don't worry too much if you don't completely understand this right now, just accept we need a source impedance of less than 10kOhms.

Now how do we calculate the output impedance from a potentiometer?

For the details, look into Thevenin equivalent impedance. This tells us that the maximum output resistance from the wiper of a pot is 1/4 of it's resistance measured from top to bottom (when the wiper is at the centre) So if your pot is 10k, then the max output resistance is 2.5k.
Here is a simulation of a 10k pot being swept from one end to the other:

Pot Sim

The X axis represents the rotation from 0 to 100% (ignore the actual values shown) The Y axis is the output impedance measured at the wiper. We can see how it starts and ends at 0 ohms and peaks at 2.5kOhms at the middle (50%)
This is comfortably less than the recommended source impedance of 10k.
So, you could use any pot value between e.g. 100 ohms and 40k as your voltage divider.

EDIT - to answer the question about what happens if we use a 200k pot:

As it says in the datasheet excerpt, the higher the source impedance, the longer the S/H capacitor takes to charge. If it's not fully charged before the reading is taken then the reading will show an error compared to the true value.

We can work out how long the capacitor needs to charge to 90% of it's final value, the formula is:

2.3 * R * C

After 1 RC time constant the voltage is at ~63% of it's final value. After 2.3 time constants it's at ~90% as above. This is calculated by 1 - (1 / e^(RC/t)) where e is the natural logarithm ~2.718. For example for 2.3 time constants it would be 1 - (1 / e^2.3) = 0.8997.

So if we plug in the values shown - 50k source impedance, 100k series impedance (assume worst case) and 14pF capacitance:

2.3 * 150k * 14pF = 4.83us to charge to 90%.

We can also calculate the -3dB value:

1 / (2pi * 150k * 14pF) = 75.8kHz

If we want the final value to be within 99% we have to wait around 4.6 tau (time constants):

4.6 * 150k * 14pF = 9.66us to charge to 99% - this corresponds to around 16.5kHz

So we can see how the higher the source impedance the longer the charge time and hence the lower the frequency accurately read by the ADC.

In the case of a pot controlling a ~DC value though, you can sample at a very low frequency and give it plenty of time to charge, as the leakage is very small. So I think 200k should actually be fine in this case. For e.g. an audio signal or any varying (AC) high impedance signal you will have to take all the above into account though.
This link goes into some good detail on the ATMega328 ADC characteristics.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Thank you very much for detailed explanation! Can you please clarify how potentiometer greater then 40 kΩ would affect digital readings? For instance let's multiply by 5 so potentiometer would be 200 kΩ? \$\endgroup\$
    – A B
    Jul 24, 2012 at 16:45
  • \$\begingroup\$ @A.B - I added some more details, hope it helps. I realised the pot in your question is just used to vary the DC value (not control the level of an AC signal) so a higher value should be okay. You can do some of your own tests on the effect of increasing the source impedance >>10k if you have a known voltage and vary the series resistance. \$\endgroup\$
    – Oli Glaser
    Jul 24, 2012 at 22:57
6
\$\begingroup\$

Oli showed you the information in the datasheet, though if you're new to this his explanation may be a bit over your head.

The ADC (Analog-to-Digital Converter) has a small capacitor, which holds the analog input voltage. That capacitor gets charged through the resistance at the input. A high resistance will charge the capacitor more slowly. 10 kΩ is recommended as maximum, so using a potmeter of that value is OK. Oli's 40 kΩ as a maximum is correct, but that will become clear as you learn about Thévenin.

\$\endgroup\$
0
1
\$\begingroup\$

In my experience with Arduinos, with potentiometers beyond 10k, the readings will fluctuate. I resolve this by putting a .1uf capacitor between the wiper and ground. This keeps the voltage steady for analogreads. By using the capacitor, I have used pots up to 1 MegaOhm and get solid, steady readings.

\$\endgroup\$
2
  • \$\begingroup\$ I like this because parallel .1uF capacitor ensures low impedance source after the input pin is switched. 0.1uF / 14pf = 7142, and the resolution of adc(10bit) is 1 in 1023. With extremely large pots there will be slight delay between setting and stabilizing the voltage on the input pin, but this is unlikely to be noticed. 4Mohm pot is 1Mohm imp. * 0.1uF = 0.1 sec. So in 0.46 sec. your value settles to 99% of the change! \$\endgroup\$ Dec 30, 2015 at 17:43
  • \$\begingroup\$ Sorry if this seems dumb, but what happens if the voltage is dropping? \$\endgroup\$
    – HilarieAK
    Feb 8, 2016 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.