add wishlist add wishlist show wishlist add compare add compare show compare preloader

Soil Moisture Sensor Module

Soil moisture sensor module

Buy it here: Soil Moisture Sensor

What is soil moisture sensor module

  • Soil moisture sensor consists of two conducting plates which function as a probe and acting as a variable resistor together. They are used to measure the volumetric content of water. 
  • The two probes allow the current to pass through the soil, which gives the resistance value to measure the moisture value.
  • When the sensor is inserted into the water, the resistance will decrease and get better conductivity between plates.
  • Dry soil conducts electricity poorly, so when there is less water, then the soil will conduct less electricity, which means that there will be more resistance. 

 Pin description of soil moisture sensor module

This soil moisture sensor module is used to detect the moisture of the soil. The module has both digital and analog outputs and a potentiometer to adjust the threshold level.

Soil moisture sensor pin out configuration

Pin Name

Description

VCC      

The VCC pin powers the module, typically with +5V

GND                                

Power Supply Ground

DO 

Digital Out Pin for Digital Output

AO

Analog out Pin for Analog Output

 

Specification

The specifications of the FC-28 soil moisture sensor are as follows:

  • Input Voltage: 3.3–5V
  • Operating Current: 15mA
  • Output Digital - 0V or 5V, Adjustable trigger level from preset
  • Output Analog - 0V to 5V i.e. 0-1023 on serial monitor

The module also contains a potentiometer, which will set the threshold value. This threshold value will be compared by the LM393 comparator. The output LED will light up and down according to this threshold value.

LM393 IC

The LM393 is a DIP comparator IC, meaning the IC has two comparators inside a single 8-pin package. One good feature is its wide supply voltage range that makes it possible to use this IC in wide variety of applications. The IC also requires low operating current due to which it is ideal to use in portable and battery operated devices. LM393 Comparator IC is used as a voltage comparator in this Moisture sensor module. Pin 2 of LM393 is connected to Preset (10KΩ Pot) while pin 3 is connected to Moisture sensor pin. The comparator IC will compare the threshold voltage set using the preset (pin2) and the sensor pin (pin3).

Preset (Trimmer Pot)

Using the onboard preset you can adjust the threshold (sensitivity) of the digital output.

Working of soil moisture sensor

The working of the Soil Moisture Sensor is very simple. It works on the principle of voltage comparison. Moisture sensor module consists of four pins i.e. VCC, GND, DO, AO. Digital out pin is connected to the output pin of LM393 comparator IC while the analog pin is connected to Moisture sensor. The internal Circuit diagram of the Moisture sensor module is given below.

The following circuit will be helpful in understanding the working of a typical soil moisture sensor.

As you can see, one input of the comparator is connected to a 10KΩ Potentiometer while the other input is connected to a voltage divider network formed by a 10KΩ Resistor and the Soil Moisture Probe.

Using a Moisture sensor module with a microcontroller is very easy. Connect the Analog/Digital Output pin of the module to the Analog/Digital pin of Microcontroller. Connect VCC and GND pins to 5V and GND pins of Microcontroller, after that insert the probes inside the soil. When there is more water presented in the soil, it will conduct more electricity that means resistance will be low and the moisture level will be high.

Interfacing Soil Moisture Sensor With Arduino

Connect the analog pin of the sensor to the A0 of Arduino Uno. When taking the analog output from the soil moisture sensor FC-28, the sensor gives us the value which don’t have to be 0 or VCC, they can be in between them which is then converted by the 10-bit ADC on the Arduino Uno and therefore we get 0-1023 readings on the serial monitor. The moisture is measured in percentage, so we will map these values from 0-100 and then we will show these values on the serial monitor.

In the loop function, we will read from the sensor analog pin and will store the values in the “output” variable. Then, we will map the output values to 0-100, because the moisture is measured in percentage. When we took the readings from the dry soil, then the sensor value was 1016 and in the wet soil, the sensor value was 215. So, we mapped these values to get the moisture. After that, we printed these values on the serial monitor.

The connections for connecting the soil moisture sensor FC-28 to the Arduino UNO are as follows.

  • VCC of FC-28 to 5V of Arduino UNO
  • GND of FC-28 to GND of Arduino UNO
  • A0 of FC-28 to A0 of Arduino UNO

NOTE: You can use any Arduino i.e. Uno, Nano, Mega

Connection diagram of soil moisture sensor with the Arduino Uno

Code

int sensor = A0;

int output;

void setup() {

Serial.begin(9600);

Serial.println("Reading From the Sensor ...");

delay(2000);

}

void loop() {

output = analogRead(sensor);

output  = map(output,1016,215,0,100);

Serial.print("Mositure : ");

Serial.print(output);

Serial.println("%");

delay(1000);

}

Output on Serial Monitor

Soil moisture sensor data on serial port

Output of soil moisture sensor varies when placed in dry soil, wet soil, water etc. Readings differ as you can see in the serial monitor image shown above.

Sensing moisture in different conditions by using soil moisture sensor

FAQs

Q1. Can soil moisture sensor be placed in water? How to test soil moisture sensor?

Ans. Yes, one can place soil moisture sensor in water, i.e. the conducting plates which we also call probes. But it is of no use. If you want to use soil moisture sensor for watering the plants, proper readings is required. Positioning of the sensor should be correct. When we place soil moisture sensor in the water, we get readings ranging from 150-283 on the serial monitor, in dry soil we get 1015-1020 and in wet soil we get 236-300. It varies depending upon the moisture content in the soil. You can observe/test that on serial monitor by interfacing the sensor with Arduino/Node MCU.

Q2. Can soil moisture sensor be used as pH sensor?

Ans. No, you cannot use soil moisture sensor as the pH sensor.

Q3. What is the output of soil moisture sensor?

Ans. The sensor is equipped with both analog and digital output, so it can be used in both analog and digital mode. Digital output can be 0 or VCC i.e. HIGH or LOW whereas analog outputs don’t have to be 0 or VCC, they can be in between them.

Q4. How to set threshold value in soil moisture sensor?

Ans. You can use the potentiometer dial on the sensor for setting the threshold value. Another way is that just take the readings from the serial monitor by varying the water content of the soil and alter the if condition in the program accordingly.

Q5. Can humidity sensor be used as moisture sensor in soil?

Ans. No, you cannot use humidity sensor as moisture sensor in soil. It should be placed in a sheltered area that is protected from water; otherwise, it will get damaged.

Q6. What is the range of soil moisture sensor?

Ans. You are provided with a potentiometer dial on the soil moisture sensor which you can adjust to set the reference voltage in case you are using D0 pin of the sensor. Digital output can be 0 or VCC i.e. HIGH or LOW whereas if you are using A0 pin of the sensor then the analog outputs can be 0V to 5V. The ADC on the Arduino is a 10-bit ADC which converts analog voltages into digital values.

Leave a comment

Logo
Logo
Logo
Logo
Logo
Logo
Logo
Logo
Your Cart