How to interface to a capacitive sensor and measure its value with the Netduino

capacitivenetduinosensor

I've just bought a rain detector, not realizing it is a capacitive sensor (I had assumed it was going to be resistive, as most are). However, being capacitive means it can be sealed so no electrodes are exposed to the elements, so I can see the advantage in that. The device simply has 2 terminals and is essentially a variable capacitor.

I am a software engineer by profession and never been any good an analogue electronics (I've tried, but I just am no good at it). The application notes that come with the device make no sense to me. They show an RC series circuit which connects to a microcontroller pin which is labelled with several functions and they make no mention of how the pin is configured or how to measure the value. They also omit all the component values from the schematic.

The only bit of information I've found that is of any real use is that the device has capacitance of 100 pF when completely dry and >= 360 pF when completely wet.

On my Netduino, I have GPIO pins, A to D, PWM, all the usual stuff, it works at 3.3 Volts. Could someone please help me figure out how to connect this sensor, what type of input to use and figure out any circuitry that needs to go around the sensor?

These are links to the data sheet and application notes, although they are not much help (the sensor is literally just a capacitor).
http://en.telecontrolli.com/downloads/category/21-sensor.html?download=83:rain_sensor
http://en.telecontrolli.com/downloads/category/21-sensor.html?download=84:rain_sensor_applic_note

Best Answer

you have several ways to measure the capacity : 1- make a oscillator and measure the period or the frequency (use a CMOS Inverter with resistor connected form output to input and connect the sensor between input and GND) or use LM555 in astable circuit. The period of output depend directly on the value of sensor capacity (T = K * C) where K = Constant . 2- If you apply a step function on R-C network and measure the time t until the C voltage to a reference (Vref) you can use the equation : Vref = Vin * (1 - Exp(-t/Taw)) ; [Taw = R*C]. then t/Taw = -Ln(1 - Vref / Vin) ==> C = -t / [R * Ln(1 - Vref / Vin)] 3- if you use a constant current source to charge the capacitor, the C voltage become : Vref * C = I * t ==> C = I * t / Vref . You can use a LM317 to make a current source, a MCU internal analog compactor to compare the sensor voltage to Vref, a MCU internal voltage reference or TL431 as external voltage reference.