# Poor man's capacitance meter with range control

I'm interested in making a capacitance meter with on-hand parts. Rather than connecting a bare microcontroller I'm inclined on using my Arduino Mega, since it has a built-in power supply and USB transceiver.

I want to measure capacitance values in the 10pF-1μF range. It doesn't need to be terribly accurate or fast (but certainly sub-second). I'm not going to make an integrated display; it can simply write values to the terminal.

Option 1 is to use a simple comparator and measure the time it takes for the input to cross half of a full charge from a first-order RC, i.e. t = 0.693 τ. This is also described in https://electronics.stackexchange.com/a/64910/10008 . Since the Arduino Mega is a 16MHz device, using micros() will yield about 4μs resolution. For a worst-case 10pF capacitor, this means the discharge resistor should be at least 4μs/ln2/10pF = 577kΩ . Using 10MΩ would be able to detect sub-pF caps (in theory only) or allow a 10pF cap to charge in 69.3μs, for which the mega would measure 17 time increments. The problem is that for the other end, a 1μF cap would take 6.93s to charge. Thus, either the charging time is too high, or the resolution is too poor.

Option 2 is to use a variant of the above, but with a basic range switch. An HPF instead of LPF is used due to the convenience of having the discharge resistors controllable by N-channel MOSFETS instead of having to wire up transmission gates. A diode is needed to prevent the output from going temporarily negative when the input goes to zero.

simulate this circuit – Schematic created using CircuitLab

Option 3 is doing away with the comparator, and running the output of the RC circuit directly to an ADC input of the mega. This would require the selection of an appropriate resistor (probably again with the range circuit) to ensure that the cap charges slowly enough such that it does not greatly affect the stability of the ADC. The ADC apparently takes north of 100μs on these devices, so some substantive multiple of that would be considered a minimum time constant. It would run repetitive conversions, and either wait until the voltage crosses the halfway point or do some iterative approximation based on a lookup table for exponential values.

Yet another option is, rather than connecting the RC circuit as a first-order filter, connect it as a linear integrator using an opamp. However, I think the range switch would be more complex in this case, because the input resistor does not run to ground.

Questions:

• Are there any faults in my reasoning?
• Could I get away with the ADC method?
• Are there any other simple methods I'm forgetting?
• You can simply use the comparator method with a couple of different resistors controlled by GPIOs and auto range from the stiff resistor down to the weak one if the others are charging too fast. This is what the \$10 kits do, and it works far better that you would imagine. – Chris Stratton Sep 17 '17 at 22:59
• @Chris that's a good idea. I'll accept it as an answer – Reinderien Sep 18 '17 at 0:56
• The author of the code used by those meters has written an extensive explanation of how it works: mikrocontroller.net/wikifiles/8/8f/Ttester_eng111k.pdf – duskwuff Sep 18 '17 at 4:42