Arduino Forum

Topics => Science and Measurement => Topic started by: peterwn on Mar 02, 2013, 05:50 am

Title: Capacitance measurement - analog sampling rate
Post by: peterwn on Mar 02, 2013, 05:50 am
See:
http://playground.arduino.cc/Main/CapacitanceMeasurement

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:
http://arduino.cc/forum/index.php/topic,6549.0.html

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?
Title: Re: Capacitance measurement - analog sampling rate
Post by: peterwn on Mar 03, 2013, 10:44 am
Done further experimenting. Changing the pre-scale to 16 does work, so there must be other factors at play. More experimenting needed!
Title: Re: Capacitance measurement - analog sampling rate
Post by: peterwn on Mar 05, 2013, 08:33 pm
Have now got things going and have referred some issues to writer of the sketch.
Title: Re: Capacitance measurement - analog sampling rate
Post by: robtillaart on Mar 05, 2013, 09:21 pm
you can post  your improved code here too if you want ...