Capacitance measurement - analog sampling rate


The sketch seems 'broken' when I run it on Arduino 1.0.1 (or 1.0.3) and a Uno type board with ATmega328. It relies on a method given in forum postings in 2008 to speed up the analog sample rate:

It seems the method used in the sketch for changing the analog sampling rate from 128 to 16 does not work or is being subsequently changed back to 256. The example given (using 56pF capacitor) does 10 samples then calculates capacitance. When I run it with a 56pF capacitor it does 3 samples before the capacitor is discharged.

Is there an alternative method of speeding up the analog sampling rate?

Done further experimenting. Changing the pre-scale to 16 does work, so there must be other factors at play. More experimenting needed!

Have now got things going and have referred some issues to writer of the sketch.

you can post your improved code here too if you want …