Capacitive Soil Moisture Sensor Basics

Introduction: Capacitive Soil Moisture Sensor Basics

About: Part software developer, part maker.

Hi everyone, in this Instructable we will look at a capacitive soil moisture sensor, how it works, how to connect it, and how to read the values that it produces.

A capacitive soil moisture sensor is used in gardening where we want to monitor the moisture levels in the soil so we can control an automatic irrigation system with it or get alerted once we need to water our plants.

Supplies:

Materials used in the project:

Alternative links on Banggood:

Step 1: How It Works

The sensor electronics are built around a 555 timer IC.

The timer and the other supportive components form an oscillator that works on a set frequency. Since the measuring part of the sensor is made out of two PCB tracks on the board, they act as a capacitor that is connected to this oscillating circuit.

Once the sensor is placed in soil, the moisture in the soil changes the capacitance of this capacitor, and with that, the frequency of oscillation on the 555 timer is changed.

This change in frequency is then translated to an analog voltage from 1 to 3 volts and this can then be detected with an Arduino and translated into a percentage.

Depending on the precision of the electronics that form the oscillator, each sensor can have slight differences in the output so it is necessary that we test them and adjust the limits accordingly later on in the steps.

Step 2: Connecting It to Arduino

The sensor has three connections, VCC, GND, and AOUT.

VCC can be connected to either 3.3V or to 5V, and in my case, I have it connected to 3.3.V. GND is connected to the GND on the Arduino and VOUT can be connected to any analog input. In my case I use A0.

To check out the output of the sensor, I've created a basic sketch where I read the analog input and directly print the value to the serial console.

This way, we can see what are the output values when the sensor is exposed to air where that corresponds to 0% moisture and submerged in water for 100% moisture.

We will use these limits in the next step where we will map these values to an actual percentage.

Step 3: Analog Voltage to Moisture Percentage

Now that we have the reading from the sensor, we can use the Arduino map function to map this range from the sensor into a percentage value from 0 to 100.

After the value is mapped, I've updated the sketch to now print out both of the values, the raw output, and the mapped percentage.

If we now move the sensor in and out of the water, we can observe the change in percentage.

Step 4: Next Steps

This Instructable covers the basics of reading a capacitive soil moisture sensor. This value can then be used to be displayed on a screen, send to a processing server, or even control a connected pump to automatically water the plants.

I plan to upgrade this sensor with a central sensors hub and use it with Home Automation so I can automate the watering of my garden.

If that sounds interesting to you, then be sure to subscribe to my YouTube channel and follow me here on Instructables.

Microcontroller Contest

This is an entry in the
Microcontroller Contest

Be the First to Share

    Recommendations

    • Pi Day Speed Challenge

      Pi Day Speed Challenge
    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Microcontroller Contest

      Microcontroller Contest

    Comments