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.
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.
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.
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.
Some More Articles For You: