Monitoring soil moisture levels is vital for any gardening or agriculture application. A capacitive soil moisture sensor is an easy and affordable way to achieve this. In this article, I will show you how I built my own capacitive soil moisture sensor using an Arduino microcontroller and basic electronic components for less than $5.

What is a Capacitive Soil Moisture Sensor?

A capacitive soil moisture sensor measures the dielectric permittivity of the soil, which changes based on the volumetric water content. In simpler terms, the sensor measures how well the soil conducts electricity. Dry soil is a poor conductor while wet soil conducts electricity better.

The sensor uses two conductive probes to create an electromagnetic field in the soil. The more water that is present, the more the field shifts when a voltage is applied. This change in capacitance between the two probes is used to determine the soil moisture content.

Required Components

Building this DIY capacitive soil moisture sensor requires just a few low cost components:

The total cost is under $5 for the basic components. You may already have an Arduino board and various electronic components on hand.

How a Capacitive Soil Moisture Sensor Works

Here is a brief overview of how a capacitive soil moisture sensor works:

Step-by-Step Building Instructions

Follow these step-by-step instructions to build your own capacitive soil moisture sensor with an Arduino:

1. Gather the Components

You'll need:

2. Connect the Sensor Probe

Connect the capacitive soil moisture sensor probe to the Arduino board using jumper wires:

3. Add the Pull-Down Resistor

Add a 10k ohm pull-down resistor between the signal pin and ground. This ensures the sensor rests at a low voltage when not taking readings.

4. Upload the Code

Upload this sample Arduino sketch to take soil moisture readings:

const int airValue = 760; //you need to replace this value with Value_1
const int waterValue = 392; //you need to replace this value with Value_2
int soilMoistureValue = 0;
int soilmoisturepercent=0;

void setup(){

void loop(){

soilMoistureValue = analogRead(A0); //put Sensor insert into soil
soilmoisturepercent = map(soilMoistureValue, airValue, waterValue, 0, 100);
Serial.print("Soil Moisture(in Percentage) = ");

This code prints the moisture percentage to the serial monitor based on the sensor readings.

5. Take Initial Readings

With the sensor in open air and submerged in water, take initial readings to determine the minimum and maximum sensor values.

Update the two values in the code. This sets the calibration range for moisture measurements.

6. Insert Sensor in Soil

Insert the capacitive soil moisture sensor probe into the soil to start taking measurements!

The Arduino sketch prints the moisture percentage to the serial monitor. Monitor these readings to track soil hydration and determine when to water your plants.

Improving Accuracy

For improved accuracy, here are some tips:


Building a DIY capacitive soil moisture sensor with Arduino is an easy and fun electronics project. With just a few components, you can accurately monitor soil moisture levels for gardening and agricultural applications.

The capacitive sensing method provides an affordable way to measure soil hydration. This data helps optimize irrigation schedules and prevent over-watering.

Let me know if you have any other tips or questions in the comments! I'm happy to help explain any part of the DIY soil moisture sensor build process.