Soil Moisture Sensor With Arduino

Hi Guys in this instructables we will learn how to use soil Moisture Sensor with Arduino.

So as the name suggests soil moisture sensor which means it will detect the moisture in the soil. So it will tell about the water content available inside the soil so this sensor could be useful in doing automation Project with plants, farming etc.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Things You Need

so for this project you will need following things :

1x Arduino Uno (or any other equivalent)

1x soil moisture Sensor

Few Jumpers

Step 2: Circuit Diagram & Working Theory

So the circuit diagram is very easy, please follow the given circuit and connect everything According to it.

Measuring soil moisture in terms of percentage.

Here, the analog output of soil moisture sensor is processed using ADC. The moisture content in terms of percentage is displayed on the serial monitor.

The output of the soil moisture sensor changes in the range of ADC value from 0 to 1023.

This can be represented as moisture value in terms of percentage using formula given below.

Analog output = ADC Value /1023

Moisture in percentage = 100 – (Analog output * 100)

For zero moisture, we get maximum value of 10-bit ADC, i.e. 1023. This, in turn, gives 0% moisture.

Step 3: Code

copy the following code & upload it to your arduino :

const int sensor_pin = A1; /* Soil moisture sensor O/P pin */

void setup() {

Serial.begin(9600); /* Define baud rate for serial communication */

}

void loop() {

float moisture_percentage;

int sensor_analog;

sensor_analog = analogRead(sensor_pin);

moisture_percentage = ( 100 - ( (sensor_analog/1023.00) * 100 ) );

Serial.print("Moisture Percentage = ");

Serial.print(moisture_percentage);

Serial.print("%\n\n");

delay(1000);

}

Step 4: Testing

After all the connections & coding , you need to get a pot or bucket anything like that then put some soil in it and then put the sensor in that soil and open the serial monitor it will show the % of moisture in the soil ( it depends on how much quantity of water your soil have) and then pour some water in it and soil moisture will change on serial monitor as mine did. Refer my attached images to see my output.

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    Discussions