Soil moisture sensor
The soil moisture sensor consists of two probes which are used to measure the volumetric content of water. The two probes allow the current to pass through the soil and then it gets the resistance value to measure the moisture value.
When there is more water, the soil will conduct more electricity which means that there will be less resistance. Therefore, the moisture level will be higher. Dry soil conducts electricity poorly, so when there will be less water, then the soil will conduct less electricity which means that there will be more resistance. Therefore, the moisture level will be lower.
This sensor can be connected in two modes; Analog mode and digital mode. First, we will connect it in Analog mode and then we will use it in Digital mode.
Specifications
The specifications of the soil moisture sensor FC-28 are as follows
Input Voltage |
3.3 – 5V |
Output Voltage |
0 – 4.2V |
Input Current |
35mA |
Output Signal |
Both Analog and Digital |
Pin Out – Soil Moisture Sensor
The soil Moisture sensor FC-28 has four pins
- VCC: For power
- A0: Analog output
- D0: Digital output
- GND: Ground
The Module also contains a potentiometer which will set the threshold value and then this threshold value will be compared by the LM393 comparator. The output LED will light up and down according to this threshold value.

Pin Out – Diagram
To connect the sensor in the analog mode, we will need to use the analog output of the sensor. When taking the analog output from the soil moisture sensor FC-28, the sensor gives us the value from 0-1023. 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.
You can further set different ranges of the moisture values and turn on or off the water pump according to it.
Circuit Diagram
The connections for connecting the soil moisture sensor FC-28 to the Arduino are as follows.
- VCC of FC-28 to 5V of Arduino
- GND of FC-28 to GND of Arduino
- A0 of FC-28 to A0 of Arduino
Interfacing with Arduino:

Code:
int sensor_pin = A0;
int output_value ;
void setup() {
Serial.begin(9600);
Serial.println(“Reading From the Sensor …”);
delay(2000);
}
void loop() {
output_value= analogRead(sensor_pin);
output_value = map(output_value,550,0,0,100);
Serial.print(“Mositure : “);
Serial.print(output_value);
Serial.println(“%”);
delay(1000);
}
Application:
A Soil Moisture Sensor has many applications, especially in agriculture. Irrigation is a key factor in farming. Detecting the amount of moisture in the soil and managing irrigation systems (turn on the system when the moisture level falls below a certain predefined value) helps to avoid a lot of wastage of water and human resources. These kinds of sensors make automation of farming easier. This is also used in controlled environments where experiments are conducted.