Soil Moisture Sensor With Arduino

1116

In this tutorial, we will learn how to interface the Soil Moisture Sensor with Arduino. We also display the soil moisture sensor values on the LCD 16×2 display.

Soil Moisture Sensor has both digital and analog output. So in this article, we are going to interfacing the sensor in both modes.

The Soil Moisture Sensor is used to measure the water content (volumetric water content) of soil.

The soil moisture sensor has two legs which are used to measures the volumetric content of water.

The legs pass current through the soil when the soil has more water than more current will pass and there will be less resistance. Thus the sensor gives values that have moisture is higher.

Read More:

soil moisture sensor

Components Needed


Soil Moisture Sensor Pinout

Soil Moisture sensor FC-28 has four pins. It attached to the LM393 comparator which contains a potentiometer.


Analog Mode – Interfacing Soil Moisture Sensor with Arduino using Analog Pin

In this mode, we are using the analog pin of the sensor to get output. The sensor gives analog values from 0 – 1023 and moisture are measured in percentage, so we will map these values from 0-100 by using map function in code.

Circuit Diagram

Interfacing Soil Moisture Sensor with Arduino using Analog Pin

Code – Analog Output

Open serial monitor to view the sensor values.


Digital Mode – Interfacing Soil Moisture Sensor with Arduino using Digital Pin

In this mode, we are using the digital pin of soil moisture sensor to get output.

Circuit Diagram

Interfacing Soil Moisture Sensor with Arduino using Digital Pin

Code – Digital Output

Upload the code to the Arduino board. When the value of the sensor is high, the inbuild led will on.


Display Soil Moisture Sensor Reading on LCD 16×2

Now we are going to display the soil moisture sensor readings on an LCD 16×2 display. We use the analog pin output of the soil moisture sensor.

Must See:

Circuit Diagram

Display Soil Moisture Sensor Reading on LCD 16x2

Code


Some More Articles For You:

Our Youtube Channel

2 COMMENTS

  1. Hi, thanks for the tutorial!

    Quick question. I dont fully understanf the map function, why did you use 550-0 range if the sensor returns a value of 1023-0? Does the highest value mean the resistance in the soil is in its highest, or in othe words its dry?

    Thanks

LEAVE A REPLY

Please enter your comment!
Please enter your name here