Logging small capacitance
For capacitance as small as pF, The RC time constant method yields dirty results on an Arduino board.
You can use the Arduino pins built in small capacitance (which is in Pf itself) to create a "capacitance divider" circuit and calculate much like you would resistance from a voltage divider circuit.
See this excellent post by Nethercott for reference Arduino capacitance meter
Measuring small capacitance value via RC constant estimation essentially requires precise time measurement. ATmega chips have TCNT1
timer which can be programmed to increment each clock cycle, and can be stopped by a comparator using bit ACIC
in ACSR
register. Running a counter at 16 MHz will give you a resolution of 62,5 ns which is enough for capacity measurements in picofarad range. Here's an example of code which uses this measurement technique.
AnalogRead
is about 1000 times slower, so you'll be limited to nF range if you use it.
Note that you should calibrate your system when measuring such a small capacitance. This is done by running a measurement with your probes connected but without the target system. You will then subtract this capacitance value (typically 20-50 pF, depending on the probes you use) from your raw measurements to obtain the capacitance of your system alone.
(fluctuate from 50pF to 100 pF).
a few ways for such small values -> assuming you can really read it like a capacitor.
1) form a lc tank and measure its frequency -> most effective in measuring small value capacitance. but needs precision inductor / calibration, and is subject to parasitics.
2) charge / discharge it via a CCS: and measure the time. simplest as a ccs can be formed via a large resistor. not effective with really small capacitance;
3) charge transfer: using the capacitance of the adc. very effective against small capacitance: < 10x of adc capacitance. needs calibration.
each has its own problems.