Arduino based Automatic Plant Irrigation System with Message Alert
Arduino based Automatic Plant
Irrigation Project with SMS Alert
Whenever
we go out of town for few days, we always used to worry about our plants as
they need water on regular basis. So
here we are making Automatic Plant Irrigation System using Arduino,
which automatically provides water to your plants and keep you updated by
sending message to your cell phone.
In
This Plant Watering System, Soil Moisture Sensor checks
the moisture level in the soil and if moisture level is low then Arduino
switches On a water pump to provide water to the plant. Water pump gets automatically off when system
finds enough moisture in the soil. Whenever
system switched On or off the pump, a message is sent to the user via GSM
module, updating the status of water pump and soil moisture. This system is very useful in Farms, gardens, home
etc. This system is completely automated and
there is no need for any human intervention.
Required Components:
·
Arduino Uno
·
GSM Module
·
Transistor BC547 (2)
·
Connecting wires
·
16x2 LCD (optional)
·
Power supply 12v 1A
·
Relay 12v
·
Water cooler pump
·
Soil Moisture Sensor
·
Resistors (1k, 10k)
·
Variable Resister (10k, 100k)
·
Terminal connector
·
Voltage Regulator IC LM317
GSM Module:
Here
we have used TTL SIM800 GSM module. The SIM800 is a complete Quad-band GSM/GPRS Module which can be embedded easily by customer or hobbyist. SIM900 GSM Module provides an industry-standard interface; the SIM800 delivers GSM/GPRS 850/900/1800/1900MHz performance for voice, SMS, Data with low
power consumption.
The design of this SIM800 GSM
Module is slim and compact. It is
easily available in the market or online from eBay.
·
Quad - band GSM/GPRS module in small size.
·
GPRS Enabled
·
TTL Output
Learn
more about GSM
module and AT commands here. Also check our various projects
using GSM and Arduino for properly understand their
interfacing.
Circuit Explanation:
In
this Plant Irrigation System, we have used a Homemade Soil
Moisture Sensor Probe to sense the soil moisture level. To make probe, we have cut
and etched a Copper clad Board according to the Picture
shown below.
One side of the probe is
directly connected to Vcc and other probe terminal goes to the base of BC547
transistor.
A potentiometer is connected
to the base of the transistor to adjust the sensitivity of the sensor.
Arduino is
used for controlling whole the process of this Automatic Plant Watering
System.
The output of soil sensor
circuit is directly connected to digital pin D7 of Arduino. A LED is used at the sensor circuit, this LED’s ON state indicates the presence of moisture in
the soil and OFF state indicates the absense of moisture in the soil.
GSM module is
used for sending SMS to the user. Here
we have used TTL SIM800 GSM module, which gives and takes TTL logic
directly (user may use any GSM module). A LM317 Voltage regulator is used
to power the SIM800 GSM module. LM317 is
very sensitive to voltage rating and it is recommended to read its datasheet
before use.
Its operating voltage rating
is 3.8v to 4.2v (please prefer 3.8v to operate it). Below is the Circuit Diagram of Power
Supply given to the TTL sim800 GSM Module:
If
user wants to use SIM900 TTL Module then he should use 5V and if the user wants
to use SIM900 Module then apply 12v in the DC Jack slot of the board.
A 12V
Relay is used to control the 220VAC small water pump. The relay is driven by a BC547 Transistor which is
further connected to digital pin 11 of Arduino.
An
optional LCD is also used for displaying status and messages. Control pins of LCD, RS and EN are connected to
pin 14 and 15 of Arduino and data pins of LCD D4-D7 are directly connected at pin 16, 17, 18 and 19
of Arduino. LCD
is used in 4-bit
mode and driven by Arduino’s inbuilt LCD library.
Below
is the circuit diagram of this Irrigation System with arduino and soil
moisture sensor:
Working Explanation:
Working
of this Automatic Plant Irrigation System is quite simple. First of all, it is a Completely Automated
System and there is no need of manpower to control the system. Arduino is used for controlling the whole process
and GSM module is used for sending alert messages to user on his Cellphone.
If
moisture is present in soil then there is conduction between the two probes of
Soil Moisture sensor and due to this conduction, transistor Q2 remains in
triggered/on state and Arduino Pin D7 remains Low. When Arduino reads LOW signal at D7, then it sends
SMS to user about “Soil Moisture is Normal. Motor turned OFF” and water pump remains in Off state.
Now if
there is no Moisture in soil then Transistor Q2 becomes Off and Pin D7 becomes
High.
Then Arduino reads the Pin D7
and turns On the water motor and also sends message to user about “Low Soil Moisture detected. Motor turned ON”. Motor will automatically turn off when there is
sufficient moisture in the soil. Further
check the Demonstration Video and Code (given at the end) for better understanding the project working
process.
Programming Explanation:
Code
for this program is easily understandable. First of all we have included SoftwareSerial library
to make pin 2 and 3 as Rx & Tx and also included LiquidCrystal for
LCD.
Then we defined some
variables for motor, soil moisture sensor, LED etc.
#include<SoftwareSerial.h>
SoftwareSerial
Serial1(2,3);
#include<LiquidCrystal.h>
LiquidCrystal
lcd(14,15,16,17,18,19);
int
led=13;
int
flag=0;
String
str="";
#define
motor 11
#define
sensor 7
Then
in void setup () function,
serial communication is initialized at 9600 bps and directions are given to the
various Pins. gsmInit function is called for
initialize the GSM module.
Serial1.begin(9600);
Serial.begin(9600);
pinMode(led,
OUTPUT);
pinMode(motor,
OUTPUT);
pinMode(sensor,
INPUT_PULLUP);
lcd.print("Water Irrigaton");
lcd.setCursor(4,1);
delay(2000);
lcd.clear();
lcd.print("Circuit Digest");
lcd.setCursor(0,1);
lcd.print("Welcomes You");
delay(2000);
gsmInit();
Then
sensor is read in void loop () function, and motor is turned on or off
according to the sensor status and a SMS is also being sent to the user
using sendSMS function. Check the various functions in full code given at the end.
void
loop()
{
lcd.setCursor(0,0);
lcd.print("Automatic Mode ");
if(digitalRead(sensor)==1 && flag==0)
{
delay(1000);
if(digitalRead(sensor)==1)
{
digitalWrite(led, HIGH);
sendSMS("Low Soil Moisture detected. Motor
turned ON");
lcd.begin(16,2);
lcd.setCursor(0,1);
.... ......
..... ......
Here
the gsmInit () function
is important and users mostly find it difficult to set if properly. It is used to initialize the GSM module,
where firstly GSM module is checked whether it is connected or not by sending ‘AT’ command
to GSM module.
If response OK is received,
means it is ready.
System keeps checking for the
module until it becomes ready or until ‘OK’
is received. Then ECHO is turned off by sending the ATE0
command, otherwise GSM module will echo all the commands. Then finally Network availability is checked
through the ‘AT+CPIN?’ command, if inserted card is SIM card and PIN is
present, it gives the response READY. This
is also check repeatedly until the network is found. This can be clearly understood by the Video below.
void
gsmInit()
{
lcd.clear();
lcd.print("Finding Module..");
boolean at_flag=1;
while(at_flag)
{
Serial1.println("AT");
while(Serial1.available()>0)
{
if(Serial1.find("OK"))
at_flag=0;
}
delay(1000);
}
.... .....
..... .....
Demo & Code
Arduino based Automatic Plant Irrigation System with Message Alert
Reviewed by XXX
on
สิงหาคม 27, 2560
Rating:
ไม่มีความคิดเห็น