How to select the resistance value for an Arduino capacitance meter

It is usually desirable to maximize the resistance in order to be able measure relatively small capacitance values.

The ATmega328P datasheet says:

"The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less.

.. and then goes on to describe the effect on the sampling time. The leakage current is also a potential issue.

That does not mean that one could not use less or more resistance in some given situation, with careful analysis, but it's a reasonable starting point.

For example, to measure a 10,000 µF capacitor, 10 kΩ may be too large (\$\tau\$ = 100 seconds). However, if you go too low in resistance then the output resistance of the GPIO pins will start to affect the time constant.


It's just that 10 kΩ make sense for the voltages/currents and capacitances (or: charge, which is just capacitance·voltage) and timescales used. That sets the order of magnitudes. You need to realize that the way you measure things only works if the measurment device (the ADC of the microcontroller, here) has only small effect on the observed phenomenon. Pick a much larger resistor, and a significant amount of the discharge current will flow through the ADC, compared to through the resistor. Pick a much smaller one, and your microcontroller will be too slow to measure smaller capacitors' discharge time.

Why exactly 10 kΩ? That's a bit arbitrary.

There's "series of preferred numbers", from which things such as resistor values are taking. 1, 1.2, 1.5, 1.8, 2.2, 3.3, 3.9, 4.7, 5.6, 6.8 and 8.2 times any power of 10 are easy to buy (it's called the E12-series). Other values do exist, too, but are rarer.

Since this is a measurement device, you'll want to buy a resistor that's the specified resistance with very little error – up to 5% error are "standard" resistors, but you can get resistors with less than 0.1% error specification. However, these are "special purpose" and more expensive, and also not available for just any value.

You'll find that 1.0·10⁴ Ω is a preferred number, and you can get precision resistors with a nomimal 10 kΩ value.