In the classical astable configuration shown below:
the frequency is given by:
I preferred instead the configuration with a 50% duty cycle, for a better output measurement:
and the frequency is given by:
C1 is the capacitance to be measured and i chose R1=R2 (ideally).
The output is read with an arduino, thanks to FreqCounter library, and the capacitance is calculated by inverting the above relation:
The value is then displayed on a 16×2 character LCD.
In the attachment you can find the scheme and the arduino sketch.
A couple of photos (i run out of breadboards so i used the free space on the ones used for the 2bits full adder, i edited the photos to hide the parts not used):
In the measurements i’ve not considered the ESR because it is orders of magnitude lower than R1 and R2.
This cap meter system can also be used to measure resistances, you need to modify the equation to get the resistance value. The resistance will change the duty cycle as well, so you can choose to use either the frequency or the duty cycle relation to get the value.
EDIT: using low voltages (<10V), the 50% duty cycle solution would produce incorrect measures due to the 0.7 voltage drop on the diode. In this case remove the diode and replace (R1+R2) with (R1+2*R2) in the source code.C meter source code and schematic (501)