DIY Soil Testing with Arduino and FC-28 Moisture Sensor
In this article, we are going to interface an FC-28 Soil moisture sensor with an Arduino. This sensor measures the volumetric content of water in soil and gives us the moisture level. The sensor gives us both analog and digital output, so it can be used in both analog and digital mode. We are going to connect it in both modes in this article.
How Does it Work?
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 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 is 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.
The specifications of the FC-28 soil moisture sensor are as follows:
- Input Voltage: 3.3 – 5V
- Output Voltage: 0 – 4.2V
- Input Current: 35mA
- Output Signal: Both Analog and Digital
The FC-28 soil moisture sensor has four pins:
- VCC: Power
- A0: Analog Output
- D0: Digital Output
- GND: Ground
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.
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 a value from 0 to 1023. The moisture is measured in percentage, so we will map these values from 0 to 100 and then we will show these values on the serial monitor.
You can set different ranges of the moisture values and turn the water pump on or off according to it.
The connections for theFC-28 soil moisture sensor to the Arduino are as follows:
- VCC of the FC-28 to 5V of the Arduino
- GND of the FC-28 to GND of the Arduino
- A0 of the FC-28 to A0 of the Arduino