Using an oscillator and a microcontroller atmega328 it is possible to build a fill level measurement for scratch, based on a capacitive sensor.
The controller is measuring the frequency of the oscillator. Data are transmitted by SPi to raspberry. A scratchClient adapter is calculating the frequency and forwarding them to scratch.
The video shows the setup on breadboard. Left side is the oscillator, in the middle is the controller and then the connection to raspberry. The sensor is build from a stripe of copper coated epoxy, separated in the middle. As air has different electrical characteristics than water, the capacity of the capacitor changes close to water. An oscillator, using this capacitor, will change its frequency.
The scratchClient uses the adapter ‘Atmel328_ADC_Adapter’. The firmware is the same as for the ADConverter AD-Wandler.
The oscillator ist standard TLC555, the cmos cousin of popular 555. The frequency range is in the example 13,5kHz in dry air and 9,6kHz with water in glass.
Frequency measurement is done in controller on 10ms or prox 72 periods. The controller is averaging the last 16 measurements. The ‘open’ construction causes some disturbances, causing sporadic measurement failures.
Update history: 2014-04-01 Fixed connections of LED