Home ARDUINO How to Build Plant Automation system with Arduino and Moisture sensor

How to Build Plant Automation system with Arduino and Moisture sensor


When you hear the word smart garden, one thing you can think of is the automatic measurement of moisture in the soil. If you want to make a smart garden or Automated watering plant system that automatically irrigates plants and provide water and also provides you with soil moisture readings, So you definitely need a soil moisture sensor.

Build Plant Automation system with Arduino and Moisture sensor

In this article, I show you how to connect a soil moisture sensor to an Arduino Uno and read the value on a serial monitor.

What is Soil Moisture?

A typical soil moisture sensor consists of two parts. Legs, lead into the soil or any other water must be measured. There are two plug pins connected to the amplifier / A-D circuit, which in turn is connected to the Arduino.

Build Plant Automation system with Arduino and Moisture sensor

The amplifier has Vin, GND, analog and digital data pins. This means that you can get numerical values in both analog and digital form.

How does Soil Moisture Sensor work?

Most soil moisture sensors design the soil volumetric water content based on the dielectric constant of the soil (soil volumetric permittivity). The dielectric constant can be considered as the ability of soil to transmit electricity. The dielectric constant of the soil increases with the increase of soil water content. This response is due to the fact that the dielectric constant of water is much greater than other soil constituents, including air. Therefore, the dielectric constant can predict the water content.

Collect Hardware Requirements

For this project, you will need following things

Make Connection

Please check the picture so then you can easily connect up each and everything according to my project.

  • Connect the two pins of the sensor to the two pins of the amplifier circuit through the connecting wires.
  • Connect Vcc from the amplifier to the Arduino 3.3V pin and Gnd pin to the Arduino Gnd
  • So now you just have to connect the Analog Gpio Pin of A0 of Arduino to the data pin of Arduino.

In order to simply read the value, I will use the AnalogRead sketch from the sample menu. You can modify the code according to your requirements.

Upload Source Code

void setup() {

// So here it is I am broadcasting the serial monitor display over 9600bps speed




// the loop routine runs over and over again forever:

void loop() {

// read the input on analog pin 0:

int sensorValue = analogRead(A0);

// print out the value you read:


delay(1);        // delay in between reads for stability


After copy and pasting the code just select the Arduino board I am using Arduino Uno Also you can use Any Arduino board of your choice.

After it Clicks on upload

Serial Monitor
After verifying the code, upload it to the board and open the serial monitor. When you immerse the sensor leads in water and dry, you will see changes in the sensor data on the display. If you intend to trigger actions based on these values, you can use these values as thresholds.

You can also use a short key of Serial Monitor Display by pressing these key simultaneously,


You may also like to read these awesome articles

Getting started with LCD Shield, Arduino and connect the DS3231

How to Build DIY Calculator using Arduino Uno, Keypad and character LCD


Please enter your comment!
Please enter your name here