Professional Documents
Culture Documents
Introduction
1.1 Background
Agriculture is the backbone of Nepalese Economy. In todays world, as we see the rapid
growth in global population, agriculture becomes more important to meet the needs of the
human race. However, agriculture requires irrigation, and with every year we have more
water consumption than rainfall, it becomes critical for growers to find ways to conserve
water while still achieving the highest yield .But at the present era, the farmers have been
using irrigation technique through the manual control in which they irrigate the land at the
regular intervals. This process sometimes consumes more water or sometimes the water
reaches late due to which the crops get dried. Over the past 200 years, farmers in both hill
areas and the Terai of Nepal have developed simple irrigation systems based on diversion
of water from seasonal or permanent streams and rivers. The systems were referred to as
farmer-managed irrigation systems (FMIS). This sort of manual irrigation system provide
variable amount of water that is sometimes excess or sometimes insufficient than that
required for the suitable growth of crops .Thus, the farmer has to toil himself all day and
night to monitor the moisture content in the soil.
The advances in the technologies related to wireless communication has led to the
emergence of several engineering designs to aid the human requirements. As we all know
Agriculture play a significant role in developing country like Nepal and implementing
mobile communication for facilitating farmers is the basic idea of our project. GSM
BASED AUTOMATIC IRRIGATION SYSTEM is a simpler, multipurpose, cost-effective
design to control the on-off mechanism of an electric motor for irrigation in the field via
Short Message Service (SMS). This tends to utilize the availability of GSM network,
mobile phones and electronic circuits to achieve an automated system which is
programmed to work as a thinking device to accomplish this purpose. Besides selfmonitoring the moisture content of the soil, this system will also give auxiliary control to
the user to enable him/her to irrigate the field from a remote place In this system, the motor
work on its own with the help of inputs received from the sensors which is measuring the
moisture content of agricultural land and farmer can monitor whether everything is going
normal or some action is needed to be taken. The entire process is controlled and monitored.
Automating farm or nursery irrigation allows farmers to apply the right amount of water at
the right time, regardless of the availability of labor to turn motors on and off. In addition,
farmers using automation equipment are able to reduce runoff from over watering saturated
soils, avoid irrigating at the wrong time of day, which will improve crop performance by
ensuring adequate water and nutrients when needed. Automatic Irrigation is a valuable tool
for accurate soil moisture control in highly specialized greenhouse vegetable production
and it is a simple, precise method for irrigation. In this project there are soil moisture
sensors for monitoring the moisture content of soil which continuously inform about the
moisture present in the soil. There is provision of selecting the amount of moisture content
required for different crops. Whether we have to irrigate the rice field that requires more
water or some other crops that require less amount of moisture content, this system provides
suitable moisture for various types of crops. Use of GSM network can work out irrigation
system with low cost. This system monitors land owner's soil moisture, and send message
to the land owner about the status of field and irrigates the field if there is need of irrigation
and the motor is switched off automatically after the necessary condition of moisture is
met.
1
1.2 Objectives
The main the objective of the project will be concentrated towards the development of the
system that works on SMS feature of the mobile phone. The objectives of our system can
be divided into two categories which are as follows.
Chapter 2
Literature Review
Many research have been done in the agriculture field, most of them are concentrating on
sensors parameters and automatic switching mechanisms of pumps based on sensors
signals. The literature review shows that, with the wide spread use of cellular networks,
automatic irrigation systems have been applied through wireless technology at the farm
area incorporating GSM technology with mobile phone through the mobile network. The
technology is one of the factors which limit the implementation of some of the automated
irrigation system in developing countries.
GSM is the most popular and widely used digital mobile telephony system in the world.
According to GSM world, it is now used by over 1.5 billion people all over the world.
Hence the Ubiquity of GSM enables international roaming arrangements between mobile
phone operators and provides their subscribers the use of the phone in many parts of the
world. Besides that, GSM is considered a second generation (2G) cell phone system as both
the signaling and speech channels are digital which differs from the previous technology.
3
Year
1982
GSM Development
European Conference of Postal and
Telecommunications Administrations (CEPT)
created the Group Special Mobile (GSM) to
develop a standard for mobile telephone system in
Europe.
1987
1989
1990
1991
1993
GSM also found a low-cost implementation of the SMS, short message service, which has
since been supported on other cellular phone standards as well. For example, the worldwide
emergency telephone number feature (112) is included. GSM uses narrowband Time
Division Multiple Access (TDMA) for voice and Short Messaging Service (SMS). TDMA
is a technology used in digital mobile phone communication that divides each cellular
channel into 3 time slots to increase the amount of data that can be carried. GSM digitizes
and compresses data, then sends it down a channel with 2 other user data in its own time
slot.
4
Once the message is sent the message is received by SMSC, which must then get it to the
appropriate mobile device. To do this the SMSC sends a SMS request to Home Location
Register (HLR) to find the roaming customer. Once HLR receives the request, it responds
to the SMSC with the subscribers status i.e. Inactive or active subscriber is roaming.
If the response is inactive, then the SMSC will hold onto the message for a period of
time. When the subscriber access his device, the HLR sends a SMS notification to the
SMSC and the SMSC will attempt delivery.
The SMSC transfer the message in a Short Message Delivery Point to Point format to the
serving system. The system pages the device, and if it responds, the message gets delivered.
The SMSC receives verification that the message was received by the end user then
categorizes the message a sent and will not attempt to send again. SMS provides a
mechanism for transmitting short message to and from wireless devices. The service makes
a use of a SMSC, which acts as a store and forward system for short messages.
Pin name
Description
Alternate Function
(XCK/T0) PB0
(T1) PB1
(INT2/AIN0) PB2
(OC0/AIN1) PB3
(SS) PB4
(MOSI) PB5
(MISO) PB6
(SCK) PB7
RESET
10
Vcc
Vcc = +5V
11
GND
GROUND
12
XTAL2
13
XTAL1
14
(RXD) PD0
15
(TXD) PD1
16
(INT0) PD2
17
(INT1) PD3
18
(OC1B) PD4
Outputs
19
(OC1A) PD5
20
(ICP) PD6
21
PD7 (OC2)
Output
22
PC0 (SCL)
23
PC1 (SDA)
24
PC2 (TCK)
25
PC3 (TMS)
26
PC4 (TDO)
27
PC5 (TDI)
28
PC6 (TOSC1)
29
PC7 (TOSC2)
30
AVcc
Timer Oscillator
Pin 1
I/O PORTC, Pin 7 Timer Oscillator
Pin 2
Voltage Supply = Vcc for ADC
31
GND
GROUND
32
AREF
33
PA7 (ADC7)
ADC Channel 7
34
PA6 (ADC6)
ADC Channel 6
35
PA5 (ADC5)
ADC Channel 5
36
PA4 (ADC4)
ADC Channel 4
37
PA3 (ADC3)
ADC Channel 3
38
PA2 (ADC2)
ADC Channel 2
39
40
PA1 (ADC1)
PA0 (ADC0)
ADC Channel 1
ADC Channel 0
Timer/Counter1
Input Capture
Pin
Timer/Counter2
Output Compare
Match
TWI Interface
JTAG Interface
The AVR core combines a rich set with 32 general purpose working resisters which are
connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be
accessed in one single instruction executed in one clock cycle. The resulting architecture
is more code efficient while achieving throughputs up to ten times faster than conventional
CISC microcontroller.
Features of ATmega16:
1. 16 KB of in system programmable flash with Read-Write capabilities
2. 512 bytes of EEPROM
3. 27 general purpose I/O lines
4. 32 general purpose working resistors
5. One UART HW LIN
6. 11 channel 10-bit ADC
7. 10-bit DAC
GSM Modem
Modem stands for modulator-demodulator. It is a communication device that can modulate
an analog carrier signal with digital data and transmit, while it also demodulates the
incoming modulated signal to extract the analog information. There can be wired as well
as wireless modems. We are using the later one where in the modem captures the modulated
carrier signal with an antenna connected to it. A GSM Modem is a wireless modem that
works with a GSM wireless network. Like a GSM Mobile Phone, a GSM Modem requires
a SIM card from a wireless carrier in order to operate. Once a GSM Modem is placed and
powered it is ready to function as a receiver and transmitter GSM Modem supports a set of
AT commands. Our project focuses on reading, writing, sending, receiving and deleting
SMS messages via AT commands. The GSM we used is SIM 900 and its works on 9600
bps.
10
11
LCD
LCD (Liquid Crystal Display) is an electronic display module commonly used in various
devices and circuits. LCDs are economical, easily programmable, have no limitation of
displaying special and even custom characters and so on. This LCD has two registers
namely Command and Data. The command register stores the command instructions given
to the LCD. A command is an instruction given to LCD to do a predefined task like
initializing it, clearing its screen, setting the cursor position, controlling display etc. The
data register stores the data to be displayed on the LCD. The data is the ASCII value of the
character to be displayed on the LCD.
12
13
14
REGISTER
Resistor is a component that resists the flow of direct or alternating electric circuit.
Resistors can limit or divide the current, reduce the voltage, protect an electric circuit, or
provide large amounts of heat or light. They are often color coded by three or four color
bands that indicate the specific value of resistance. Resistors obey ohms law, which
states that the current density is directly proportional to the electric field when the
temperature is constant.
LEDS
A light-emitting diode (LED) is a semiconductor light source which is used as indicator
lamps in many devices and is increasingly used for other lighting purposes. The color of
the light (corresponding to the energy of the photon) which is determined by the energy
gap of the semiconductor pattern. LEDs are cheap and faster switching.
15
Start
Initialise
LCD
And
Motors and
leds
Is
miscall
Received?
Is
Fields
X<<level?
Turn
Off
Motor
Is
X>level?
stop
16
3.4 Working
GSM based automatic irrigation system consists of four push to on switches, three for crop
selection and one to ON motor forcedly. One of three switches is used to select irrigation
type for a particular crop cultivated in the field. Once the irrigation mode is selected, LCD
displays the moisture contained of the soil as well as displays the state of motor ON or
OFF. It also consists of GSM module LCD and motor to pump water in the field.
When a mode for particular crop is selected, the moisture sensor measures the resistivity
of the soil. Moisture sensor is a transducer which converts the value of moisture contained
in soil into electrical form. The output of moisture sensor is analog in nature. The inbuilt
ADC in ATmega16 converts analog input data into 10-bit digital data. Thus obtained data
is further processed by the processor and displayed in LCD.
Every crop is defined with the lower and higher defined value which is needed for proper
growth. If the value sensed by the moisture sensor is below the lower defined value, motor
automatically ON and pump the water in the field. If higher defined value is met, motor is
OFF again automatically. The state of motor is also displayed in LCD.
If owner of the field want to know the condition of field, staying at home he can call the
number. If call is received at GSM module, the processor send SMS with detail condition
of field to the master SIM.
19
Chapter 4
Software Components
It is often not wise to get a programming into an assembly language if you have high level
programming options that is to say if you have flexibility to write a code into a C language
then you are not supposed to jump into an assembly language. Thus, you have wide
varieties of options for a high level programming in 8051 microcontrollers. The most
common of all is the C language. C language, being a high level language, has many
important advantages over assembly language like portability, automatic proper handling
of various data types including data arithmetic, ease of data organization, ease of expressing
program logic, etc. It is much easier to write a program in C than in assembly language. C
language programming is also much less error prone. The software portion include the
programming of the ATmega16 chip for the whole operation of the designed system. C
language was used to code the program and was converted into hex code to load it into the
flash memory of microcontroller. The program includes the interfacing of sensors and LCD
module unit to the microcontroller. Intel hex code is generated and burnt into the
microcontroller chip using suitable programmer. The software is well commented and easy
to understand.
4.1 C Programming Language
C is a general purpose, block structured, procedural, imperative computer programming
language developed in 1972 by Dennis Ritchie at the bell telephone laboratories for use
with the UNIX operating system. C programming provides low level access to memory,
provide language constructs that map efficiently to machine instruction and require
minimal run time support. In c, all executable code is contained within function parameters
are always passed by value. Pass by reference is achieved in C by explicitly passing pointer
values. Codes written in C are compiled using a compiler. Compiler produce hex files that
we download in to the ROM of the microcontroller. Assembly language produce hex file
that is much smaller than C but programming in assembly is tedious and time consuming.
C-programming language, on the other hand, is less time consuming and much easier to
write but the hex file size produced is much larger than if we used assembly language. The
some of the major reasons for writing programs in C instead of assembly are it is easier and
less time consuming to write in C than assembly. C is easier to modify and update. We can
use code available in function library. C code is portable to other microcontrollers with
little or modification.
types of functions can be handles like Configure delay function calls, Debug and Simulate
AVR Studio Project , add Header and Source files to AVR Studio Project Flash
Programming using Mega Load and EEPROM in AVR Studio .
21
Chapter 5
DESIGN VERIFICATION
5.1. Testing Hardware
Microcontroller test
Much of the testing with this project involved debugging the micro controller code and
interfacing the micro controller with the wired and PCB designed hardware. The debugging
entailed positioning various print statements throughout the code to see exactly which code
were executed. Oftentimes, it was difficult to determine if a problem was rooted in the
hardware wiring or in the source code. We used the computer monitor to explicitly output
the code executed and the oscilloscope to diagnose any potential hardware problems.
The biggest hurdle we had to overcome was making sure that each input was sent to the
right port of the micro controller. This was ensured with numerous compare statements
within the micro code. Therefore, if the micro controller read signals different than those
expected, this could be easily detected when the program was stuck in an endless loop
outputting error statements. Only when the micro controller recognized a valid input did it
jump to the next loop.
Making sure that the micro controller output the correct signals was also important. This
was verified using a number of test LEDs placed in appropriate locations within in our
circuit. If an LED was erroneously triggered, we first traced it back to the source code to
see if any of the instructions interpreted the inputs incorrectly. Next, we looked at how the
particular component was wired and determined if it was behaving correctly based on the
signal sent to it by the micro controller. Ultimately, this was how many of our debugging
problems were rectified. As a result, interfacing the microcontroller with the rest of our
circuit proved to be long and iterative trial and error process.
Sensor module test
Testing with moisture sensor module really need continuation effort. The sensor was placed
in different places for checking the proper amount of moisture content in the soil such that
microcontroller can detect the change in resistivity of the soil. In this project placing the
moisture sensor at the centre of the field we checked the state of the fields through the
resistivity.
GSM module test
By using the GSM SIM 900 the test was over using AT commands for receiving, sending
and reading the SMS in the user mobile.
5.2 Software testing
The software was coded in C language. C Language is peculiar to the processor. Due to
this fact we test the assembly code in a simulator for 8051.After the result was achieved as
desired, the code was burned converting into HEX file using AVR assembler. The Hex file
was loaded into microcontroller ATmega16 and was tested using led for output.
22
6. RESULTS
1. With our project we became successful to demonstrate with regarding the objectives of
the project.
2. The moisture content of the three different types of field were measured successfully.
3. Motor automatically turn on or off with the different level of moisture level content in
the soil.
4. Farmer successfully got the status of his fields whether dry or wet by just giving miscall
from his master mobile.
5. We became successful to meet the moisture content of the crops with their specific level
of moisture content.
23
7. LIMITATIONS
Limitations relating to the software as well as hardware are present. Some of the major
limitation may be grouped as follows.
1. Single moisture sensor only cover the small area of fields
2. Atmospheric moisture contents also brought some fluctuation in the measure value
of soil moisture content
3. Some chemical reaction erode the sensitivity and physical structure of sensor
4. Lack of knowledge about the fixed moisture content require for the particular fields
24
25
9. FURTURE ENHANCEMENTS
The scope of our project GSM Based Automatic Irrigation System is immense. The
future implications of the project are very great considering the amount of time, money and
resources it saves. The project we have undertaken can be used as a reference or as a base
for realizing a scheme to be implemented in other projects of greater level such as GSM
pump controller, weather updates using mobile phones, pest control, control farming
vehicles using mobiles, etc. The project itself can be modified to achieve a complete
Automatic Irrigation system which will then create a platform for the user to interface
between him and the agricultural field.
26
10. CONCLUSION
By using Hardware and software knowledge we built the GSM Based Automatic
Irrigation System. We became successful to receive the message about the state of the
field that is whether the land is dry or wet through the GSM interfacing. The result of our
design has met our expectation, in which every components is working well. Our irrigation
system is easy to use, comparatively cheap in that case that by just giving a miscall we can
received the state of the field, Moisture sensor interfacing helps to detect the moisture
content of the fields and comparing the value predefine in the buffer helps to automatically
to turn on/off the motor easily, low power consumption and highly reliable. The LCD also
offer great interface and user can be familiar with the system and know the state of the field
by just reading the message displayed on the LCD. The three push to on switch are
corresponding used for three different crops so that this somewhat meet the requirement of
farmer and farmer are free from the fact of irrigation overflow or underflow problems for
growing the crop.
The system we had design is also secure because the master SIM only can only receive the
message of the state of the field. This system saves the valuable time of the farmers and
free from worrying about the field and helps to increase the production of the crops because
this system provides the defined amount of water to the particular fields.
If we are given the chance to build it again the number of moisture sensor that should cover the
large field will be under the considerations.
27
10. References
1. M. A. Mazidi, J. G. Mazidi & R. D. Mckinlay, The 8051 microcontroller and
Embedded System,prentice hall.(c) 3,No. 2(2006)
2. www.engineersgarage.com
3. http://www.way2project.com
4. www.atmegaavr.com
28
APPENDIX 1.1
COST ESTIMATION
Components
Quantity
ATmega16
1
ULN 2003
100
Push to On switch
60
LCD
350
DC motor
300
1,1
380
20
Moisture sensor
920
Relay
35
AccessoriesLEDs, resistors,
wires, transistors,
capacitors, diodes,
solder
GSM moule
As per requirement
500
5500
Documentation
6500
Total price
14985
29
APPENDIX 1.2
Some of the AT commands used in GSM SIM 900 communication
30
32
33