3
\$\begingroup\$

There are a number of capacitive moisture sensor designs on the internet, which use the insulated copper pads on a PCB.For example:

http://zerocharactersleft.blogspot.in/2011/11/pcb-as-capacitive-soil-moisture-sensor.html

In case the above link breaks, here is a photo of a PCB I made using the above design:

capacitive moisture sensor

Just wondering how these work, and how they can be used with a microcontroller to calculate moisture content? I have seen methods that use a square wave, an RC network, and an ADC to do this, but I haven't seen a clear explanation of how it works.

\$\endgroup\$
  • 2
    \$\begingroup\$ FR4 will absorb moisture causing drift in the readings. \$\endgroup\$ – Jasen Aug 9 '15 at 8:02
8
\$\begingroup\$

It's called capacitive because the two copper planes in your sensor are the two plates of a capacitor. In a physics textbook these two plates might be drawn facing one another, with empty space in between. Put a material between the plates, and the capacitance, which is a measure of how much charge is on the plates for a given voltage, changes. This material is called the dielectric, and how much the capacitance changes for a given material is called the dielectric constant of the material.

Dry soil has a different dielectric constant than wet soil, which means that a sensor in wet soil is going to have a different capacitance than one in dry soil.

How do we measure this capacitance? One way is to use an RC circuit, and to measure the voltage on the positive terminal of the capacitor. This terminal is going to reach 63.2% of its maximum voltage \$RC\$ seconds after a voltage is applied, where \$R\$ is the resistance and \$C\$ is the capacitance. By turning on the supply voltage at a time \$t_{on}\$, checking the voltage on the positive terminal of the capacitor continuously until it exceeds 63.2% of the supply voltage, and recording the first time where that voltage was exceeded \$t_{c}\$, we can calculate the capacitance (we know the resistor value because we chose it).

That is,

C = \$(t_{on}-t_c)/R\$

This tutorial will show you how to set something like this up on an Arduino. https://www.arduino.cc/en/Tutorial/CapacitanceMeter

\$\endgroup\$
1
\$\begingroup\$

The sensing strips have alternating A and B zones the A zones form one plate of the capacitor the B zones form the other. the coating on the circuit board and the earth surrounding the sensor forms the dielectric.

when the earth is dry it has high electrical resistance, when it is damp is has lower resistance this partially short-circuits the dielectric of the capacitor increasing its capacitance.

reading the sensor is typically done by charging the capacitor and then timing the discharge. one way to measure the charge time using a microcontroller is to connect it to a timer capture pin, drive the pin low to discharge it, then turn the pin into an input with internal pull-up and enable the timer to measure how many cycles it takes to charge up.

\$\endgroup\$
  • \$\begingroup\$ Capacitive sensors don't measure earth's resistance. Also, there must be a resistor between the driving pin and the capacitor. You souldn't connect them directly if you wish to use this as a sensor. \$\endgroup\$ – Filipe Nicoli Mar 14 '16 at 2:42
  • \$\begingroup\$ have you any evidence that they don't measure resistivity - is dielectric constant even meaningful in the a conductive fluid? microncontroller internal pull-up is a resistor. \$\endgroup\$ – Jasen Mar 14 '16 at 2:57
  • \$\begingroup\$ Microcontroller internal pull-up is not in series with the capacitor. You need an RC circuit to measure capacitance with a microcontroller (at least that's the easiest way). Of course, if you buy an off the shelf sensor, it probably does this for you and gives you some different interface like an analog voltage. \$\endgroup\$ – Filipe Nicoli Mar 22 '16 at 3:10
  • \$\begingroup\$ It is in series. eg: atmel.com/images/… page 78, if you connect a capacitor from that gpio pin to ground, the pull up (when activated) would be in series. \$\endgroup\$ – Jasen Mar 22 '16 at 19:58
  • \$\begingroup\$ Okay, you're right, but you can only connect it to Vcc. So you'll either wait for the leakage current to dissipate the capacitor's charge or discharge it by pulling the pin to LOW. Without any resistance in series between the capacitor and the driving pin, 5v at a high peak current can destroy your microcontroller. \$\endgroup\$ – Filipe Nicoli Mar 25 '16 at 18:45
1
\$\begingroup\$

For those still interested of a possible answer, see "Automatic watering system with capacitive probe and Arduino on the cheap" on instructables.com for one such method.

Essentially, a NE555 astable using the capacitance probe as the charge/discharge capacitor, thus translating the changes of humidity in changes of frequency. An Arduino used to count the number of pulses in a time interval and implement (in that case) the watering logic.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.