Soil Moisture Detection project .pdf
Original filename: Soil Moisture Detection project.pdf
This PDF 1.4 document has been generated by Writer / OpenOffice 4.1.0, and has been sent on pdf-archive.com on 23/01/2017 at 10:39, from IP address 202.157.x.x.
The current document download page has been viewed 231 times.
File size: 860 KB (30 pages).
Privacy: public file
Download original PDF file
Soil Moisture Detection with Automatic Water Pump
Control and Real-time SMS Alert
Farming and Gardening are not trivial jobs. There are a range of crops
and plants and numerous varieties of each plant or crop. Different
plants and crops have different requirements of water, fertilizer and
sunshine. The fertility of soil for any farming or gardening effort is
usually judged by the level of nutrients and moisture in it. A number
of times the farmers or gardeners are not able to nourish the soil
with sufficient fertilizer or water while at many times they just over
do it. This project is to help farmers and gardeners keep a check of
the soil health by real-time tracking the moisture level of their soil.
The project utilizes DHT sensor to keep a track of ambient
temperature and humidity and a moisture sensor to record soil
moisture. The RTC DS1307 is used keep track of real time so that the
moisture rating could be logged and relayed over fixed interval of
time in a real-time fashion. The project sends out the real-time alert
of inappropriate moisture levels through SMS using a GSM/GPRS
modem to a registered mobile number of the farmer or caretaker.
The system is able to automatic control a water pump which can be
switched on through SMS in response to the real-time alert. Once the
water pump is switched on through SMS it automatically switches off
after the appropriate moisture level is attained. The farmer or
caretaker can also switch off the water pump in between by sending
an SMS or manually operating the project interface. The data log of
message alerts can also be cleared through the project interface. The
human interface attached to the project consists of a 16X2 LCD
display which runs the mobile registration process on the start of the
system and allow mobile registration update and display of current
soil health readings when prompted. The input to the system is fed
through a numeric keypad and all the instructions feed to the system
are also numeric codes.
The project has the following execution cycle 1) As the system is powered on, it prompts the user for mobile
number registration by displaying initial messages on the LCD display.
The user has to press "*", enter his mobile number and press "#" to
complete the mobile number registration. If user has already
registered his mobile number on the device, he can cancel the
process by pressing "#" without entering the mobile number.
2) The registered mobile number is saved to the internal memory
of the Arduino Mega.
3) After the mobile number registration, the Arduino board fetch
the real time from RTC module, humidity and temperature using
DHT11 sensor and moisture level through the moisture sensor and
start displaying all the readings on LCD display.
Once the system is initialized, the user need to set the time
interval for SMS alerts of the moisture level. The system can accept
any time duration as required by the user for SMS alerts of moisture
5) When the system will find the moisture level below the set
level, warning SMS alert is sent to the registered mobile number.
6) The user can respond to the warning SMS alert by replying back
an SMS "ON MOTOR" which will switch ON the water pump for a
duration until the moisture level increases to the set level. The water
pump automatically switches OFF once the required moisture level is
7) The user can also turn OFF the water pump manually if finds
Once the project is initialized after mobile number registration and it
starts displaying moisture, date-time and temperature and humidity
readings, it is ready to accept the following numeric instruction
Run time phone number update: When the device starts it
always prompts the user to register the phone number. The phone
number can also be updated during the run time of the project which
can be initiated by pressing “0”. Thereafter, user has to enter the
new mobile number for renewing registration and press "#" to
complete registration process.
Deleting SMS log: By pressing ‘*’ during runtime user can delete
all the messages saved to the SIM card inserted in GSM/GPRS
Setting time interval for SMS alerts: By pressing hash ‘#’ user
can initiate setting the time interval in seconds and pressing ’#’ again
saves the entered time interval to the internal memory of the board.
Manual Moisture Level Check: User can check the moisture
level manually by pressing ‘1’ on the keypad.
Registered Mobile Number Check: User can check the
registered mobile number pressing '2' on the keypad.
• Time Interval Check: User can check the time delay set to wait for
response by pressing ‘3’ on the keypad.
• Arduino Mega2560
• GSM/GPRS Module SIM900
• RTC module-DC1307
• Moisture sensor with analoge output.
• DHT11 humidity and temperature sensor
• 16x2 LCD
• Capacitor 25v,4700uF
• Transformer 18-0, 2Amp -1pc
• 1N4007 diode -4pcs
• 12v Relay-1pc
• BC 547 transistor-1pc
• 1K ohm resisters -3pcs
• 4x3 keypad-1pc
• Voltage regulator -7805 and 7812
• LED -5mm RED- 2
• Wire to carry 2A,230v AC
• Two pin Plug
Circuit Connections As is clear from the block diagram the heart of the project is Arduino
Mega board and all other circuit sections are connected to it. There
are following sections of the project circuit 1)
Power Supply Regulator
Relay Circuit as Power Switching Unit.
RTC Module DS1307
The Arduino Board is the programmable Unit controlling the entire
functionality of the project and every module is interfaced to it. The
circuit is connected in the following manner1)
Power Supply: While the water pump will need AC supply, the
project circuit needs 12V and 5V DC supply. The 12V supply is
provided via 7812 voltage regulator and supplied to the 12V
relay and 7805 voltage regulator. The other components need a
5V DC supply which is provided through 7805 voltage regulator
that is converting the input 12V supply to 5V DC.
Relay Circuit: The water pump is connected to the circuit
through a 12V relay. The relay is connected to the pin 24 of
Arduino Mega board and have a BC547 transistor circuit of a
common emitter configuration for interfacing with the board.
DHT11 connection: The data pin of temperature and humidity
sensor DHT11 is connected to pin 10 of the Arduino Mega and
ground and VCC connected at the relevant pins.
RTC Module: DS1307 RTC module is used in the circuit. The 5V
DC supply and ground to the RTC module are provided by the
7805 voltage regulator. The SDA and SCL pins of the RTC are
connected to the SDA and SCL pins of Arduino Board
respectively. Learn more about RTC and its interfacing with
Arduino UNO. The standard library of Arduino for RTC is used
in the program code to run RTC specific project code.
GSM/GPRS MODULE: Here Arduino Mega is using TX1 and
RX1 from its three USART ports. Vcc and ground are provided
with the external power supply of 12v,2Amp and common
ground. The Tx terminal of GSM module is connected to the pin
19 (RX1) of Arduino Mega and its Rx terminal is connected to
the pin 18 (TX1) of Arduino mega. Read more
LCD Display: The 16X2 LCD display is connected to the Arduino
board by connecting its data pins to pins 3 to 6 of the Arduino
board. The RS and RW pin of LCD is connected to pins 12 and 13
of the Arduino Mega respectively. The RW pin of the LCD is
The standard code library for interfacing Arduino are used in the
project to program LCD with the Arduino board. Learn more about
LCD interfacing with ARDUINO.
6) 4x3 Keypad: This is a numeric keypad having 12 input buttons
arranged in 3 columns and 4 rows. In the keypad 4 wires are used as
ROWS and three wires are used as COLUMNS. The wire number can
be count from the left hand side to the right hand side. The row and
column wires are interfaced to the Arduino pins in following manner.
How the Circuit Works The circuit works in following stages:
1) Initialization of the circuit As the circuit is switched on Arduino loads the imported libraries of
LCD display, DHT library, EEPROM library, keypad library and RTC
library. First Initial messages are flashed on the display screen
prompting to complete mobile number registration. The user needs
to enter his phone number and press "#" to complete registration
process. After that the current date and time are fetched from the
RTC and humidity and temperature readings are fetched from DHT11
sensor and they are displayed on the LCD screen.
2) After phone number registration, user is prompted to enter a time
interval for SMS alert of real-time soil health and the system goes
into the operating mode. The device starts sending SMS containing
details like moisture level, ambient temperature and relative
humidity by the interval set by the user.
3) Low moisture level detection: System checks the moisture level on
a polling basis and whenever system detects low level moisture, it
sends a warning SMS to the user. The device waits till the user
switches ON the water pump or until the moisture level resumes to
its best level.
4) SENDING SMS: When user gets the warning SMS, he has to reply
back by sending SMS “ON MOTOR” to the device in order to switch
the water pump ON and he can send “OFF MOTOR” SMS to switch
the water pump OFF.
Programming Guide The code utilizes standard libraries of the Arduino. Therefore, first of
all predefined libraries for LCD display, DHT sensor, EEPROM library,
keypad library and RTC library are imported in the code. An lcd object
is instantiated and mapped to pins 13, 12, 6, 5, 4 and 3 of the
Arduino. An object of RTC type and an object dht of DHT type is
declared. For keypad interfacing, two constants representing number
of rows and columns of keypad are defined and used in declaration
of arrays for representing individual keys of the keypad. The keys are
mapped to Arduino pins as mentioned in the table given above. The
variables to hold values of temperature, relative humidity and
moisture level are declared. A string object is declared to hold SMS
text and a flag is set to check status of SMS alert. A 'relay' variable is
declared and assigned to the pin 24 where relay has been connected.
The numeric representation of keys are assigned by a two
dimensional array and variables to hold time and phone number are
declared. A keypad object is declared and assigned key map.