Automatic Watering System using FC-28 Moisture Sensor with arduino

Automatic irrigation is a concept of controlled watering of plants without any manual operations so as to maintain a water level ideal for its cultivation.

For an automatic plant watering system, we can adopt various techniques such as time-based water pump controlling or by sensing various parameters of the soil and surroundings, etc. Here in this project, the water control is done by monitoring the instantaneous level of water content or moisture present in the soil.

FC – 28 sensor

fc 28 soil sensorHere an FC-28 moisture sensor is using for the measurement of the moisture level in the soil. The sensor is a pair of test probes which are placed or inserted into the soil. The sensor module board mainly has an LM393 comparator, potentiometer, indicator LED lights – Power and Digital Output Indicator LEDs; commonly red for power indication and blue for digital output.

The moisture level sensor works with the basic principle of electrical conductivity of water that is the resistance value of the wet soil is lesser than the dry soil. Hence, the moisture level can be estimated with respect to the electrical conductivity or resistance of the soil.

The FC-28 module has both digital and analog outputs. The analog output AO of the FC-28 gives a direct analog value of sensor readings, because it is the value of voltage drop across the probe. So analog output value returns a voltage value proportional to the resistance of the soil. That is, value will be high when the soil is dry and the value decreases as it gets wet.

The FC-28 module has a threshold adjust potentiometer for the digital output to preset the required threshold value. The sensor value will be compared with this threshold value by the LM393 comparator. When the sensor value is above the set threshold value the digital output DO will switch to a HIGH state (+5V).  That is if the soil is less moisture then the voltage across the probe becomes high and that switches digital output to high state. The output LED is just inverse to the digital output if DO is High then the LED turns OFF. An ON DO LED indicates that the resistance is low than the threshold that is the the soil moisture is higher than threshold.

Standalone Fc-28 Soil moisture sensor without a microcontroller

Using the digital output, the FC – 28 sensors can be used as a standalone system to directly drive devices without any microcontrollers. For direct applications, the digital output can be used as an input signal to low power relays or transistors to operate any high power devices.

In the here circuit a solenoid valve is using for water control. So the system automatically opens and closes the water supply depending on soil condition.

The solenoid valve requires an external power supply. An NPN transistor is used as a switch to control the solenoid valve.

automatic-plant-watering-system-using-without-microcontroller

When the water level is low, the sensor value rises above the threshold value as the soil resistance increases. Thus the DO of the sensor switch to a HIGH state and the solenoid valve opens. When the water level increases the sensor value comes below the threshold and the valve closes. The output LED lights as the water level reaches above the preset level.

Automatic irrigation system using Arduino

Using Arduino, additional features can be added to the system. The code can be expanded to use an LCD display, indicators, alerting system, or any other devices.

In Arduino based system both digital and analog outputs of the sensor can be used as an input signal. While using digital signal Arduino can only read the input as a HIGH or LOW state, the threshold adjust has to be done with the potentiometer on the module.

Here code is to use the analog output of the module, so the Arduino can read instantaneous readings from the sensor.

FC-28 moisture sensor Arduino interface

FC 28 Sensor Arduino pin Configuration
FC 28 Pin Arduino Pin
Vcc Vcc
GND GND
SIG  A0 Analog Read

The SIG out is the analog output that is connected to the analog input pin of the Arduino. Analog input reads the SIG output and converts it to corresponding decimal values.

automatic plant water irrigation system using arduino

The Arduino continuously check the sensor reading and check it with the condition function in the code. Here also the solenoid valve Opens and Closes respectively as the water level in the soil decreases and increases.

automatic plant irrigation system fc28 atmega328  automatic watering system without microcontroller

An assembled circuit of the automatic irrigation system; the Arduino sketch runs with a standalone Atmega 328p microcontroller.

Arduino code for an automatic irrigation system

int sensorIN = A0;
int Value = 0;
int threshold = 70;//change threshold.

void setup() {
  pinMode(2, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  Value = analogRead(sensorIN);
  Value = map(Value, 0, 1023, 0, 100);
  if (Value > threshold) {
    //Opens the valve.
    digitalWrite(2, HIGH);
  }
  else {
    //Closes the valve.
    digitalWrite(2, LOW);
  }
  delay(100);
}

In the above code it maps the input voltage between 0 to 100, hence it is measuring the proportional resistance that is the dryness of the soil. So when it is above 70 then solenoid values opens the water supply. The threshold water level can be adjusted by changing the value of the variable “threshold” in the code. Also the input to map is taken form 0 to 1023 which is the minimum 0 and maximum 5V, this can be adjusted respectively with the value returned when the probe has maximum moisture (lowest analog value) and value at minimum moisture(maximum analog value).

7 Responses

  1. Artur Moises says:

    In “The output LED lights as the water level reaches above than the preset level.”, what’s the preset level?

  2. Cole says:

    Can you put a list of the parts that you need please?

    • admin says:

      1) Arduino board – For Arduino based circuit
      2) FC-28 sensor
      3) Solenoid Valve
      4) 7805 – Voltage regulator IC – To obtain 5V in the circuit without Arduino
      5) NPN transistor – BC547
      6) Resistor – 220ohms
      7) Diode – 1N4007
      8) Others – Supply Connectors, jumper wires, breadboard/dot board, etc

  3. Cole says:

    The only sensor I can find has a digital output, will i be able to use it, and if yes what would I have to change?

    • admin says:

      If the only pin you have is a digital output, then you can adjust the threshold by varying the potentiometer in the sensor. You can use the circuit given in “standalone Fc-28 Soil moisture sensor without a microcontroller”.

Leave a Reply

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