FC-28 Soil mositure Sensor with Arduino and Buzzer

In this tutorial, we are going to measure soil moisture content with FC-28 soil moisture sensor interfaced to an Arduino board. For those of us that have flower ports at home that requires constant watering, I think this is for you and when you think of smart garden, this should be your starting point.

Below are the list of components we will be needing for this tutorial, and all of them can be gotten from our STORE:


Working of 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.

Most soil moisture sensors are designed to estimate soil volumetric water content based on the dielectric constant (soil bulk permittivity) of the soil. The dielectric constant can be thought of as the soil’s ability to transmit electricity. The dielectric constant of soil increases as the water content of the soil increases. This response is due to the fact that the dielectric constant of water is much larger than the other soil components, including air. Thus, measurement of the dielectric constant gives a predictable estimation of water content.

See Also:


FC-28 soil moisture sensor can be operated in Analog and Digital mode but we will be working with the analog mode in this tutorial.


Specifications of the Sensor

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

Input Voltage: 3.3v – 5v (I will advice you use 3.3v)

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.


Interfacing Soil Moisture Sensor and Arduino

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 = 3.3V of Arduino
  • GND of FC-28 = GND of Arduino
  • A1 of FC-28 = A1 of Arduino
  • The LED is connected to D13 on the Arduino board through a resistor
  • The Buzzer is connected to the D12 on the Arduino through an Amplifier (BC337 transistor)
soil sensor - steinacoz
soil sensor – steinacoz


bc337 sensor - steinacoz
bc337 sensor – steinacoz


Open your Arduino IDE and paste these lines of codes in it:

this copy belongs to steinacoz platform/stores: www.steinacoz.com , return credit if you intend to use it
Author: Ugwumsinachi Nnadi - CEO steinacoz Ventures

int sensor_pin = A1; //analog pin to attach sensor pin
int buzzer_pin = 12; //attach buzzer via bc337 base to D12
int led_pin = 13; // attach led to D13 or use LED onboard arduino board on D13

int sensor_value ; //variable to hold sensor value
int sensor_value_threshold = 60; //soil moisture threshold value

void setup() {

  pinMode(buzzer_pin, OUTPUT); //assign buzzer pin as output
  pinMode(led_pin, OUTPUT); //assign LED pin as output


   Serial.println("Reading soil moisture content From the Sensor ...");

   delay(2000); //delay for 2secs


void loop() {

   sensor_value= analogRead(sensor_pin); //read sensor value from analog pin

   sensor_value = map(sensor_value,550,0,0,100);

   Serial.print("Mositure : ");



   if(sensor_value < sensor_value_threshold) { //if moisture level is less than, set buzzer and LED to HIGH 
    digitalWrite(buzzer_pin, HIGH);
    digitalWrite(led_pin, HIGH);
    Serial.println("low soil moisture content");
    digitalWrite(buzzer_pin, LOW);
    digitalWrite(led_pin, LOW);





In as much as I tried to comment well on the lines of the code, I will also throw more light on it:

In the loop function, we will read from the sensor analog pin and will store the values in the “sensor_ value” 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 550 and in the wet soil, the sensor value was 10. So, we mapped these values to get the moisture. After that, we printed these values on the serial monitor.

if the sensor value is less than the threshold value, the Buzzer and Pin will be activated.


For more tutorials like these, follow our social media channels and our blog. Don’t forget to drop your comments and discussions on this tutorial.

One thought on “FC-28 Soil mositure Sensor with Arduino and Buzzer

  1. Pingback: Raspberry Pi Arduino SPI Communication: Soil Moisture Sensor

Leave a Reply

Your email address will not be published. Required fields are marked *