The DUT and the reference capacitor are in series as a voltage divider with the reference capacitor grounded and the ADC connected to the junction between the two.
The step pulse generator pin (A2) is configured as a standard output pin capable of 20mA in either direction, so the source impedance is low for charge/discharge.
The measuring pin (A0) is configured as an ADC input which is specified in the ATmega328/P datasheet to have an input leakage current of +/- 50nA maximum.?
The input capacitance of the chip provides the reference capacitor together with any strays in implementation.? Its value is adjusted in software during calibration to compensate (which presumably also takes out leakage effects which will only affect very small values).? The default is ~24.5pF for an Arduino Uno, mine came out at about 22pF for a Pro-mini module piggy-backed on a motherboard.?
The default measuring cycle time 500ms, more than enough to discharge pF capacitors, longer may be needed for much larger values which IIRC is discussed in later threads along with input protection methods. ADC sampling and conversion time is less than 1us.
Best accuracy occurs when? DUT = reference as discussed in the threads, but it is instructive to plot the potential uncertainty with and without the ADC steps.