DIY Projects

Automated Watering System for Plants Using Arduino UNO

In this article, we are going to see how to interface the Soil Moisture sensor and Servo motor using Arduino Uno and Monitor the soil moisture using serial communication protocol with an LCD at the same time based on the moisture level the water pump Valve can be ON and OFF.  The controller set a certain threshold level, once the sensor detects the particular level the Servo motor will be ON and OFF. The indication of the Servo motor ON and OFF and the Soil Moisture sensor level will be displayed on the LCD connected to the Arduino.

This article helps the reader to understand the interfacing of the Soil Moisture and Servo motor with Arduino. 

Schematic of Interfacing Soil Moisture Sensor and Servo Motor with Serial LCD using Arduino

Automated Watering System for Plants Using Arduino UNO 1
Automated Watering System for Plants Using Arduino UNO 2

#include<LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x26, 16, 2);

#include<Servo.h>

Servo myservo; 

constintsoilsen = A0;

intsermtr = 9;

int dry = 7;

int wet = 6;

voidsetup(){

  myservo.attach(sermtr);

  pinMode(dry, OUTPUT);

  pinMode(wet, OUTPUT);

  lcd.init();         

  lcd.backlight();

  lcd.setCursor(4,0);

  lcd.print(“Automated”);

  lcd.setCursor(0,1);

  lcd.print(“Watering System!”);

  delay(4000);

  lcd.clear();

  lcd.print(“So-Mo = “);

  lcd.setCursor(0,1);

  lcd.print(“WaterPump= “);

  }

voidloop(){

  float Moisture;

  intanalogip;

  analogip = analogRead(soilsen);

  Moisture = ((analogip/1023.00) * 100) ;

  lcd.setCursor(11,0);

  lcd.print(“%”);

  lcd.setCursor(6,0);

  lcd.print(Moisture); 

  lcd.setCursor(11,1);

  if(Moisture <30) {

    myservo.write(0);  

    digitalWrite(dry, HIGH);

    digitalWrite(wet, LOW);

    lcd.print(“ON”);

    delay(1500);

  }

  else{

    myservo.write(180);  

    digitalWrite(dry, LOW);

    digitalWrite(wet, HIGH);

    lcd.print(“OFF”);

    delay(1500);

  }

}

The above circuit consists of Arduino UNO, LCD Screen, Soil Moisture Sensor, and Servo Motor. The major part of this article is about interfacing Arduino with the Soil Moisture Sensor, Servo Motor,and LCD serial communication the following content explains how to interface the sensor with Arduino and Various parts of the Project.

The amount of water stored in the soil horizon can be determined using soil moisture sensors, which measure the water content of the soil. Soil moisture sensors are not designed to measure water content directly. Rather, they monitor variations in another soil characteristic that is consistently linked to the amount of water present. For any soil sensor to function, it needs to come into contact with the soil. When the soil sensor is completely covered by the soil and there are no spaces between the probe and the soil, the greatest accuracy will be achieved.A Soil Moisture Sensor measures the water content of the soil by measuring changes in capacitance or resistance.

  1. Resistive Soil Moisture Sensor
  2. Capacitive Soil Moisture Sensor

Soil moisture sensors come in two different forms.

1. The first uses the electrical characteristics of the soil, such as resistance, ions, and dielectric constant, to measure moisture; 

2. The other uses tensiometers and gypsum blocks to measure water potential.

A resistive soil moisture sensor measures the soil’s moisture content by employing the connection between electrical resistance and water content. Two exposed probes on the sensors are put straight into the soil sample. The sensor measures the resistance of the soil between the probes by sending an electrical current from one to the other. 

Resistive Soil Moisture Sensor Automated Watering System for Plants Using Arduino UNO 3

Soil with a higher water content has a higher electrical conductivity. As a result, higher soil moisture is indicated by a lower resistance reading. Soil with a lower water content has a lower electrical conductivity. As a result, a higher resistance measurement is acquired, signifying low soil moisture.

A capacitive soil moisture sensor measures capacitance changes. The amount of electrical charge that can be stored across an electrical potential is known as capacitance. A dielectric medium is typically positioned between the positive and negative plates in a capacitive soil moisture sensor.

Capacitive Soil Moisture Sensor - -Automated Watering System for Plants Using Arduino UNO 4

The dielectric medium is the soil, and the moisture content affects the capacitance of the soil. An Arduino board can read the analog voltage that is obtained by connecting the sensor to a timer circuit. The soil moisture content is directly correlated with this voltage.

There are many different kinds, sizes, and shapes of servo motors. The term “servo” was first used by Joseph Facort in 1859 when he employed steam to operate a ship’s rudders. The Latin word servus, which means servant or slave, is where the word “servo” originates. This is in line with the traditional application of servo motors as backup drives to support the primary drive system. A DC motor, a gear system, a position sensor, and a control circuit make up a servo motor.The DC motors have a high speed and small torque, and they are battery-powered. This speed is reduced to a sufficient speed and higher torque by the gear and shaft assembly attached to the DC motors. The position sensor provides the control circuit with information about the shaft’s position based on its fixed position. The control circuit decodes the position sensor signals appropriately, compares the actual and desired positions of the motors, and then adjusts the DC motor’s rotational direction to achieve the desired position. Generally, a DC supply of 4.8 V to 6 V is needed for servo motors.

Capacitive Soil Moisture Sensor - -Automated Watering System for Plants servo motor

Servo refers to a feedback control that senses errors and is used to adjust a system’s performance. It also needs a generally complex controller, which is frequently a special module made specifically to work with servomotors. Servo motors are DC motors that enable accurate angular position control. These are DC motors, and the gears gradually reduce their speed. Typically, the revolution cut-off of servo motors ranges from 90Ā° to 180Ā°. A 360Ā° or greater revolution cutoff is another feature of some servo motors. Servo motors, however, do not spin continuously. They can only rotate within the boundaries of the fixed angles. The Pulse Width Modulation Technique is used to control the position of a servo motor.A variable pulse width is applied to the motor for a predetermined duration.

Capacitive Soil Moisture Sensor - -Automated Watering System for Plants servo position

A standard DC motor, a gear reduction unit, a position-sensing device, and a control circuit are the four components that make up a servo motor. A gear mechanism that connects the DC motor to a position sensorā€”mostly a potentiometerā€”provides feedback to the sensor. The servo arm receives the motor’s output from the gearbox via a servo spline. The gear on standard servo motors is typically made of plastic; on high-power servos, however, the gear is made of metal.

Motor: Depending on the power source and the needs of the application, this can be either a DC or an AC motor. The output shaft can rotate or move mechanically thanks to the motor’s power.

Sensor: This can be any device that measures the output shaft’s position, speed, or torque and transmits feedback signals to the controller, such as a potentiometer, encoder, resolver, or other similar apparatus.

Controller: This can be an analog or digital circuit that creates control signals to change the motor’s voltage or current based on a comparison between the feedback signals from the sensor and the desired setpoint signals from an external source (like a computer or joystick).

Three wires of a servo motor: a red wire is connected to the power supply, a white or yellow wire is connected to the control unit, and a black wire is connected to the ground.

Interfacing the Arduino with Soil Moisture Sensor, Servo motor, and LCD Four sections

The First deals with the declaration of the header file and Serial LCD declaration i.e., the address of slave, column, and row size.

Capacitive Soil Moisture Sensor - -Automated Watering System for Plants 3

The second Section deals with the declaration of variables and header file for the servo motor.

Ā 

The next section deals with the declaration of variablesfor inputs and outputs such as analog and digital inputs and outputs.

The next section deals with the hardware interface to the Arduino board such as LCD, LED, and Servo Motor. The void setup() with pinMode declaration for the Servo motor and LED as output.

Capacitive Soil Moisture Sensor - -Automated Watering System for Plants 5

The next section deals with the task that Arduino going to perform. In this article, the variablesare Moisture and analogip. The analogipreads the analog input and the value is calculated and stored in the Moisture variable. Finally, it is displayed in the LCD screen.

The last section is the final stage of the article, checking the dryness of the soil. In this article, the set value is given as 30%, If the moisture level is less than 30% the servo motor switch ON the Value for the plant. If the value is greater than the servo motor switch OFF the Value. At the same time, LED indication is provided for Moisture level dryness. 

The following images show the Servo motor, Moisture Sensor, and LCD serial communication.Ā 

Capacitive Soil Moisture Sensor - -Autom 6ated Watering System for Plants
Capacitive Soil Moisture Sensor - -Automated Watering System for Plants 7
Capacitive Soil Moisture Sensor - -Automated Watering System for Plants 8

The reader can connect the Arduino UNO to the Serial LCD,Moisture Sensor, and Servo Motor by completing the exercise above.

Sundareswaran Iyalunaidu

With over 24 years of dedicated experience, I am a seasoned professional specializing in the commissioning, maintenance, and installation of Electrical, Instrumentation and Control systems. My expertise extends across a spectrum of industries, including Power stations, Oil and Gas, Aluminium, Utilities, Steel and Continuous process industries. Tweet me @sundareshinfohe

Related Articles

Back to top button