PCOM – Week 05



This week, I had a chance to look into the soil moisture sensor I got yesterday. I kept searching the datasheet for it on Google, but it didn’t come out, so I referred to several sites instead.

How Does the Arduino Soil Sensor Work?

The soil moisture sensor consists of two probes that 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 there is water, the soil will conduct more electricity, which means that there will be less resistance. 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.


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.

Analog Mode

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 percentages, so we will map these values from 0 to 100, and then show them on the serial monitor. You can set different ranges of the moisture values and turn the water pump on or off according to it.

Circuit Diagram

Connect the FC-28 soil moisture sensor to the Arduino 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

I tested my soil moisture sensor for my basil.

This image has an empty alt attribute; its file name is sensor.jpg

* The principle of the soil moisture sensor is that the resistance value increases when the moisture in the soil is low, and the resistance value decreases when the moisture in the soil is high.

I put the code into my arduino IDE as shown below.

This image has an empty alt attribute; its file name is Screen-Shot-2020-10-14-at-6.44.55-AM-861x1024.jpg

In serial monitor,

  • without moisture
This image has an empty alt attribute; its file name is Screen-Shot-2020-10-14-at-7.00.49-AM.jpg

  • with moisture

As a result of monitoring, I can see that the value comes out ‘1023’ when I did not water yet on my pot, and the resistance value decreases when water is provided. Works well!