Você está na página 1de 50

The project we have undertaken is “Automatic Irrigation System Using Moisture Sensor”.

project is taken up as India is an agriculture oriented country and the rate at which water
resources are depleting is a dangerous threat hence there is a need of smart and efficient way of
irrigation. In this project we have implemented sensors which detect the humidity in the soil
(agricultural field) and supply water to the field which has water requirement. The project is
8051 microcontroller based design which controls the water supply and the field to be irrigated.
There are sensors present in each field which are not activated till water is present on the field.
Once the field gets dry sensors sense the requirement of water in the field and send a signal to
the microcontroller. Microcontroller then supply water to that particular field which has water
requirement till the sensors is deactivated again. In case, when there are more than one signal for
water requirement then the microcontroller will prioritize the first received signal and irrigate the
fields accordingly. The development of the automated irrigation system based on
microcontrollers and wireless communication at experimental scale within rural areas is
presented. The aim of the implementation was to demonstrate that the automatic irrigation can be
used to reduce water use.
A microcontroller for data acquisition, and transceiver; the sensor measurements are transmitted
to a microcontroller based receiver. This gateway permits the automated activation of irrigation
when the threshold values of soil moisture and temperature is reached.

Embedded systems[1] are finding increasing application not only in Domestic applications but
also in areas of industrial automation, automobiles, power electronics, defense and space
equipment‟s. Microcontrollers from the basic building blocks for many embedded systems. The
project deals with the development of infrared remote controller of home appliances using
AT89S51 micro controller, which is used to regulate the power flowing in the a.c. load using a
remote controller sending signals to the micro controller AT89S51 as interrupts. The device is
manufactured using Atmel‟s high -density non-volatile memory technology and is compatible
with the industry standards MCS-51 instruction set. By combining a versatile 8-bit CPU with
flash on a monolithic chip, the AT89S51 is a powerful micro controller which provides a highly
flexible and cost effective solution to many embedded control applications.
Other 3-channels are used for ON / OFF type control or for switching devices.
The revolution of home networking is an emerging technology in this digital era. Like many
other a.c drives gets to be automated with the embedded controllers for most of the devices for
safety at residential areas or in industries. The project is an attempt to implementation of few
consumer electronic products mostly at homes.

The objective of this project is to provide a combination of manual supervision and partial
automation and is similar to manual set-up in most respects but it reduces the labor involved in
terms of Irrigation design is simple, easy to install, microcontroller-based circuit to monitor and
record the values of temperature, soil moisture (Transistor circuit) that are continuously modified
and controlled in order optimize them to achieve maximum plant growth and yield.
Also, the use of easily available components reduces the manufacturing and. The design is quite
flexible as the software can be changed any time. It can thus be made to the specific
requirements of the user. This makes the proposed system to be an economical, portable and a
low maintenance solution for greenhouse applications, especially in rural areas and for small
scale agriculturists.

The software application and the hardware implementation help the microcontroller read the data
from the temperature sensor verify the data with the already stored data and take the next action.
The system is totally designed module and embedded systems technology. The Controlling unit
has an application program to allow the microcontroller interface with the LM35, SOIL moisture
module, the reader reads the data from the sensor, passes the data to the microcontroller and the
controller verifies this data with the already existing data in the controller‟s memory and then
implements the commands directed by the controller section. The performance of the design is
maintained by controlling unit.

In view of the proposed thesis work explanation of theoretical aspects and algorithms used in this
work are presented as per the sequence described below.
 Describes a brief review of the objectives and goals of the work.
 Discusses the existing technologies and the study of various technologies in detail.
 Describes the Block diagram, Circuit diagram of the project and its description. The
construction and description of various modules used for the application are described in
 Description of AT89S51
 Description of soil moisture, temperature
 Description of Relays, Motor, LCD, ADC.
 Explains the Software tools required for the project, the Code developed for the design.

1.4.1 Embedded Systems:
An embedded system [2] can be defined as a computing device that does a specific focused job.
Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile
phone etc. are examples of embedded systems. Each of these appliances will have a processor
and special hardware to meet the specific requirement of the application along with the
embedded software that is executed by the processor for meeting that specific requirement.
The embedded software is also called “firm ware”. The desktop/laptop computer is a general
purpose computer. You can use it for a variety of applications such as playing games, word
processing, accounting, software development and soon.
Embedded systems do a very specific task, they cannot be programmed to do different things.
Embedded systems have very limited resources, particularly the memory. Generally, they do not
have secondary storage devices such as the CDROM or the floppy disk. Embedded systems have
to work against some deadlines. A specific job has to be completed within a specific time. In
some embedded systems, called real-time systems, the deadlines are stringent. Missing a
deadline may cause a catastrophe-loss of life or damage to property. Embedded systems are
constrained for power. As many embedded systems operate through a battery, the power
consumption has to be very low. Some embedded systems have to operate in extreme
environmental conditions such as very high temperatures and humidity.

Following are the advantages of Embedded Systems:

1. They are designed to do a specific task and have real time performance constraints which
must be met.
2. They allow the system hardware to be simplified so costs are reduced.
They are usually in the form of small computerized parts in larger devices which serve a general

In the Project Stage 1 we have simulated our project design through Proteus (v6.02) software in
the following manner

In this software we can simulate our project to verify the required result .It is the virtual
simulation of the project before implementing it in hardware. [17]
Various steps were involve in simulating the project as shown below.
1) Open proteus from the start menu.
2) A window will appear on the screen similar as the PCB board.
3) Now select the components by clicking on the “P” button situated on the left side
of the proteus software.
4) Now join the circuit similar to the circuit diagram shown in this project report.
5) After joining the circuit diagram, then double click on the microcontroller to burn
the hex code in the microcontroller.
6) Now run the program by clicking the play button on the bottom left of the
software [17].
The result were as follows:
1) When the value of soil moisture is zero or the potentiometer will be at 100% a infinite
impedance will occur between the two electrodes . Hence it will result in turning ON the

Fig 2.1: Output of LCD when MOTOR ON

Fig 2.2: Motor ON

2) When the value of potentiometer is below 100% , then there some moisture between the
two electrodes, hence it will result in turning OFF the motor.

Fig 2.3: Output on LCD when Motor Off

Fig 2.4: Motor OFF

The implementation of the project design can be divided in two parts.
*Hardware implementation
*Firmware implementation

Hardware implementation deals in drawing the schematic on the plane paper according to the
application, testing the schematic design over the breadboard using the various IC‟s to find if the
design meets the objective, carrying out the PCB layout of the schematic tested on breadboard,
finally preparing the board and testing the designed hardware.
The firmware part deals in programming the microcontroller so that it can control the operation
of the IC‟s used in the implementation. In the present work, we have used the proteus design
software for PCB circuit design, the Keil Compiler development tool to write and compile the
source code, which has been written in the C language. The Flash magic programmer has been
used to write this compile code into the microcontroller. The firmware implementation is
explained in the next chapter.
The project design and principle are explained in this chapter using the block diagram and circuit
diagram. The block diagram discusses about the required components of the design and working
condition is explained using circuit diagram and system wiring diagram.

The block diagram of the project is as shown in the given below Fig:-

Soil Moisture Relay Water

sensor pump

Temperature LCD
sensor Micro

Power supply

Fig3.1: Block diagram of circuit [7]

Brief explanation of functioning of each block of the system is given below the detailed is given
in next chapters

Power Supply:
The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V from
the mains supply is step down by the transformer to 12V and is fed to a rectifier. The output
obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the
output voltage from the rectifier is fed to a filter to remove any a.c components present even after

rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc
voltage. The block diagram of regulated power supply is shown in the Fig

Fig 3.2: Components of power supply

Usually, DC voltages are required to operate various electronic equipment and these voltages are
5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c input available at the
mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a
transformer. Thus, a step down transformer is employed to decrease the voltage to a required

The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The
rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used
because of its merits like good stability and full wave rectification.

Capacitive filter is used in this project. It removes the ripples from the output of rectifier and
smoothens the D.C. Output received from this filter is constant until the mains voltage and load
is maintained constant. However, if either of the two is varied, D.C. voltage received at this point
changes. Therefore a regulator is applied at the output stage.

Voltage regulator:
As the name itself implies, it regulates the input applied to it. A voltage regulator is an electrical
regulator designed to automatically maintain a constant voltage level. In this project, power
supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812
voltage regulators are to be used. The first number 78 represents positive supply and the numbers
05, 12 represent the required output voltage levels.

The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of
In-System Programmable Flash memory. The device is manufactured using Atmel‟s high-density
nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction
set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or
by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with In-
System Programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful
microcontroller which provides a highly-flexible and cost-effective solution to many embedded
control applications.

Relay is an electromagnetic device which is used to isolate two circuits electrically and connect
them magnetically. They are very useful devices and allow one circuit to switch another one
while they are completely separate. They are often used to interface an electronic circuit
(working at a low voltage) to an electrical circuit which works at very high voltage. For example,
a relay can make a 5V DC battery circuit to switch a 230V AC mains circuit. Thus a small sensor
circuit can drive, say, a fan or an electric bulb

Fig 3.3: Circuit diagram

Microcontroller, as the name suggests, are small controllers. They are like single chip computers
that are often embedded into other systems to function as processing/controlling unit. For
example, the remote control you are using probably has microcontrollers inside that do decoding
and other controlling functions. They are also used in automobiles, washing machines,
microwave ovens, toys etc., where automation is needed.

The key features of microcontrollers include:

 High Integration of Functionality

 Microcontrollers sometimes are called single-chip computers because they have on-chip
memory and I/O circuitry and other circuitries that enable them to function as small
standalone computers without other supporting circuitry.
 Field Programmability, Flexibility
 Microcontrollers often use EEPROM or EPROM as their storage device to allow field
programmability so they are flexible to use. Once the program is tested to be correct then
large quantities of microcontrollers can be programmed to be used in embedded systems.
 Easy to Use
 Assembly language is often used in microcontrollers and since they usually follow RISC
architecture, the instruction set is small. The development package of microcontrollers
often includes an assembler, a simulator, a programmer to "burn" the chip and a
demonstration board. Some packages include a high level language compiler such as a C
compiler and more sophisticated libraries.

Most microcontrollers will also combine other devices such as:

 A Timer module to allow the microcontroller to perform tasks for certain time periods.

 A serial I/O port to allow data to flow between the microcontroller and other devices such
as a PC or another microcontroller.

 An ADC to allow the microcontroller to accept analogue input data for processing.

Fig 4.1: A typical microcontroller device and its different subunits [10]

The heart of the microcontroller is the CPU core. In the past this has traditionally been based on
an 8-bit microprocessor unit. Fig above Shows a typical microcontroller device and its different

Microcontroller differs from a microprocessor in many ways. First and the most important is its
functionality. In order for a microprocessor to be used, other components such as memory, or
components for receiving and sending data must be added to it. In short that means that
microprocessor is the heart of the computer. On the other hand, microcontroller is designed to be
all of that in one. No other external components are needed for its application because all
necessary peripherals are already built into it. Thus, we save the time and space needed to
construct devices.

AT89S51 [10]

Fig 4.2: Pin diagram of AT89S51 [9]

The AT89S51 is a low-power, high-performance CMOS [9] 8-bit microcontroller with 4K bytes
of In-System Programmable Flash memory. The device is manufactured using Atmel‟s high-
density nonvolatile memory technology and is compatible with the industry-standard 80C51
instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed
in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit
CPU with In-System Programmable Flash on a monolithic chip, the Atmel AT89S51 is a

powerful microcontroller which provides a highly-flexible and cost-effective solution to many
embedded control applications.

The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM,
32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a five-vector two-
level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In
addition, the AT89S51 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The
Power-down mode saves the RAM con-tents but freezes the oscillator, disabling all other chip
functions until the next external interrupt or hardware reset.

Pin Description[10]
VCC- Supply voltage.

GND- Ground.

Port 0 Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance

Port 1 Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers
can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the
internal pull-ups and can be used as inputs.
P1.5 MOSI (used for In-System Programming)
P1.6 MISO (used for In-System Programming)
P1.7 SCK (used for In-System Programming)

Port 2 Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers
can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the
internal pull-ups and can be used as inputs.

Port 3 Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the
internal pull-ups and can be used as inputs
P3.0 RXD (serial input port)
P3.1 TXD (serial output port)
P3.2 INT0 (external interrupt 0)
P3.3 INT1 (external interrupt 1)
P3.4 T0 (timer 0 external input)
P3.5 T1 (timer 1 external input)
P3.6 WR (external data memory write strobe)
P3.7 RD (external data memory read strobe

RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets
the device. This pin drives High for 98 oscillator periods after the Watchdog times out.

ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the
address during accesses to external memory. This pin is also the program pulse input (PROG)
during Flash programming.

PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S51 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external data

EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset

XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating

XTAL2 Output from the inverting oscillator amplifier

Memory Organization [10]

MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes
each of external Program and Data Memory can be addressed.

Program Memory If the EA pin is connected to GND, all program fetches are directed to
external memory. On the AT89S51, if EA is connected to VCC, program fetches to addresses
0000H through FFFH are directed to internal memory and fetches to addresses 1000H through
FFFFH are directed to external memory.

Data Memory The AT89S51 implements 128 bytes of on-chip RAM. The 128 bytes are
accessible via direct and indirect addressing modes. Stack operations are examples of indirect
addressing, so the 128 bytes of data RAM are available as stack space

Watchdog Timer (One-time Enabled with Reset-out) [10]

The WDT is intended as a recovery method in situations where the CPU may be subjected to
software upsets. The WDT consists of a 14-bit counter and the Watchdog Timer Reset
(WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, a
user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H).
When the WDT is enabled, it will increment every machine cycle while the oscillator is running.
The WDT timeout period is dependent on the external clock frequency. There is no way to
disable the WDT except through reset (either hardware reset or WDT overflow reset). When
WDT over-flows, it will drive an output RESET HIGH pulse at the RST pin.

Using the WDT

To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register
(SFR location 0A6H). When the WDT is enabled, the user needs to service it by writing 01EH
and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter overflows when it reaches

16383 (3FFFH), and this will reset the device. When the WDT is enabled, it will increment every
machine cycle while the oscillator is running.

WDT during Power-down and Idle

In Power-down mode the oscillator stops, which means the WDT also stops. While in Power-
down mode, the user does not need to service the WDT. There are two methods of exiting
Power-down mode: by a hardware reset or via a level-activated external interrupt, which is
enabled prior to entering Power-down mode. When Power-down is exited with hardware reset,
servicing the WDT should occur as it normally does whenever the AT89S51 is reset. Exiting
Power-down with an interrupt is significantly different. The interrupt is held low long enough for
the oscillator to stabilize. When the interrupt is brought high, the interrupt is serviced. To prevent
the WDT from resetting the device while the interrupt pin is held low, the WDT is not started
until the interrupt is pulled high. It is suggested that the WDT be reset during the interrupt
service for the interrupt used to exit Power-down mode.20

Fig 4.3: Microcontroller IC

The LM35 [8] is an integrated circuit sensor that can be used to measure temperature with an
electrical output proportional to the temperature (in oC).The LM35 is an Integrated Circuit
Temperature Sensor.

Use of LM35 Temperature sensor:

o You can measure temperature more accurately than by using a thermistor.

o The sensor circuitry is sealed and not subject to oxidation, etc.
o The LM35 generates a higher output voltage than thermocouples and may not
require that the output voltage be amplified.

 LM35 Look Like

Fig 4.4: LM35 IC [8[

 Working of LM35
o It has an output voltage that is proportional to the Celsius temperature.
o The scale factor is .01V/oC
o The LM35 does not require any external calibration or trimming and maintains an
accuracy of +/-0.4 oC at room temperature and +/- 0.8 oC over a range of 0 oC to
+100 oC.
o Another important characteristic of the LM35DZ is that it draws only 60 micro
amps from its supply and possesses a low self-heating capability. The sensor self-
heating causes less than 0.1 oC temperature rise in still air.

 Use An LM35 (Electrical Connections)

o Here is a commonly used circuit. For connections refer to the picture above.
o In this circuit, parameter values commonly used are:
 Vc = 4 to 30v

 5v or 12 v are typical values used.
 Ra = Vc /10-6
 Actually, it can range from 80 KW to 600 KW , but most just use 80 KW.

Fig 4.5: LM35 Electrical Connections [8]

o Here is a photo of the LM 35 wired on a circuit board.

 The white wire in the photo goes to the power supply.
 Both the resistor and the black wire go to ground.
 The output voltage is measured from the middle pin to ground l.

Fig 4.6: LM35 IC Connection On Breadborad [8]

 What Can You Expect When You Use An LM35

o You will need to use a voltmeter to sense Vout.
o The output voltage is converted to temperature by a simple conversion factor.
o The sensor has a sensitivity of 10mV / oC.
o Use a conversion factor that is the reciprocal, that is 100 oC/V.

o The general equation used to convert output voltage to temperature is:
 Temperature ( oC) = Vout * (100 oC/V)
 So if Vout is 1V , then, Temperature = 100 oC
 The output voltage varies linearly with temperature.
In order to calculate the Celsius reading from the analog value, we use the following
formula to calculate the temperature in Celsius:

Val = is the value send to the computer by the serial port.
tempC = is the calculated temperature value (in Celsius)
5 is the reference we are using.
1024 is the resolution of the 10 bit internal ADC

LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of
applications. A 16x2 LCD display is very basic module and is very commonly used in various
devices and circuits. These modules are preferred over seven segments and other multi segment
LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation of
displaying special & even custom characters (unlike in seven segments), animations and so on.

A 16x2 LCD [11] means it can display 16 characters per line and there are 2 such lines. In this
LCD each character is displayed in 5x7 pixel matrix. 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.

Fig 4.7: LCD Panel [11]
4.3.1 Pin Configuration of LCD:
Pin No Function Name
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable resistor VEE

4 Selects command register when low; and data register when high Register Select

5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-

It is an electrically worked switch. Various exchanges use an electromagnet to mechanically
work a switch, yet other working models are similarly used, for instance, solid state exchanges.
Exchanges are used where it is vital to control a circuit by a low-power signal (with complete
electrical withdrawal amidst control and controlled circuits), or where a couple of circuits must
be controlled by one sign. The main transfers were utilized as a part of long separation broadcast
circuits as enhancers: they rehashed the sign rolling in from one circuit and re-transmitted it on
another circuit.

Fig 4.8: Relay [12]

A light-emitting diode (LED) [15] is a semiconductor light source. LEDs are used as indicator
lamps in many devices and are increasingly used for general lighting. Appearing as practical
electronic components in 1962, early LEDs emitted low-intensity red light, but modern versions
are available across the visible, ultraviolet, and infrared wavelengths, with very high brightness.
When a light-emitting diode is switched on, electrons are able to recombine with holes within the
device, releasing energy in the form of photons. This effect is called electroluminescence, and
the color of the light (corresponding to the energy of the photon) is determined by the
energy band gap of the semiconductor. An LED is often small in area (less than 1 mm2), and
integrated optical components may be used to shape its radiation pattern. LEDs have many
advantages over incandescent light sources including lower energy consumption, longer lifetime,
improved physical robustness, smaller size, and faster switching. However, LEDs powerful

enough for room lighting are relatively expensive, and require more precise current and heat
management than compact fluorescent lamp sources of comparable output.

Light-emitting diodes are used in applications as diverse as aviation lighting, automotive

lighting, advertising, general lighting, and traffic signals. LEDs have allowed new text, video
displays, and sensors to be developed, while their high switching rates are also useful in
advanced communications technology. Infrared LEDs are also used in the remote control units of
many commercial products including televisions, DVD players and other domestic appliances.
LEDs are also used in seven-segment display.

An electric motor is an electromechanical device that converts electrical energy into mechanical

4.9: DC motor [13]

Most electric motors operate through the interaction of magnetic fields and current-carrying
conductors to generate force. The reverse process, producing electrical energy from mechanical
energy, is done by generators such as an alternator or a dynamo; some electric motors can also be
used as generators, for example, a traction motor on a vehicle may perform both tasks. Electric
motors and generators are commonly referred to as electric machines.

Electric motors are found in applications as diverse as industrial fans, blowers and pumps,
machine tools, household appliances, power tools, and disk drives.

DC Motor Working:

Fig 4.10: Working Of DC motor [14]

Direct current (DC) motors are widely used to generate motion in a variety of products.
Permanent magnet DC (direct current) motors are enjoying increasing popularity in applications
requiring compact size, high torque, high efficiency, and low power consumption. [14]

In a brushed DC motor, the brushes make mechanical contact with a set of electrical contacts
provided on a commutation secured to an armature, forming an electrical circuit between the DC
electrical source and coil windings on the armature. As the armature rotates on an axis, the
stationary brushes come into contact with different sections of the rotating commentator.

Permanent magnet DC motors utilize two or more brushes contacting a commutator which
provides the direct current flow to the windings of the rotor, which in turn provide the desired
magnetic repulsion/attraction with the permanent magnets located around the periphery of the

The brushes are conventionally located in brush boxes and utilize a U-shaped spring which
biases the brush into contact with the commentator. Permanent magnet brushless dc motors are
widely used in a variety of applications due to their simplicity of design, high efficiency, and low
noise. These motors operate by electronic commutation of stator windings rather than the

conventional mechanical commutation accomplished by the pressing engagement of brushes
against a rotating commentator.

A brushless DC motor basically consists of a shaft, a rotor assembly equipped with one or more
permanent magnets arranged on the shaft, and a stator assembly which incorporates a stator
component and phase windings. Rotating magnetic fields are formed by the currents applied to
the coils.

The rotator is formed of at least one permanent magnet surrounded by the stator, wherein the
rotator rotates within the stator. Two bearings are mounted at an axial distance to each other on
the shaft to support the rotor assembly and stator assembly relative to each other. To achieve
electronic commutation, brushless dc motor designs usually include an electronic controller for
controlling the excitation of the stator windings.


ADC is an 8 bit analog to digital converter with eight input analog channels, i.e., it can take eight
different analog inputs. The inputs which is to be converted to digital from can be selected by
using three address lines. The voltage reference can be set using the Vref+ and Vref- pins. The
step size is decided based on set reference value. Step size is change in analog input to cause a
unit change in the output of ADC. The default step size is 19.53mV corresponding to 5V
reference voltage. ADC0808 needs an external clock to operate. The ADC needs some specific
control signals for its operations like start conversions and bring data to output pins. When the
conversions is complete the EOC pins goes low to indicate the end of conversion and data ready
to be packed up.

The deficiency of water in the field is sensed by the op-amp based sensor. Whenever there is
need of water in the particular field, the high signal(“1”) appears on the output pin of the sensor
of that particular field. The output pins of all the sensors are connected to the PORT 2 of
microcontroller [5]. The high signal(logic 1) from the sensor is entertained by the
microcontroller at a particular pin. By knowing the position of the pin on which signal appears ,
the microcontroller rotates the water funnel type cup at the desired speed by using DC motor
connected at PORT 0 in clockwise direction. & switch ON the RELAY (i.e. Water pump)
connected at port 0. Now water starts flowing into the required field. After completion of
watering the sensor sends low signal (logic 0) to microcontroller. When microcontroller receives
this signal, it switches OFF the water pump & rotates the stepper motor in anticlockwise
direction to the previous angle to bring the funnel cup in its initial position. Now microcontroller
starts sensing the signal at PORT 2. Whenever there is signal at any pin the microcontroller
repeats the above process. So this process continues & we get the automatic irrigation the fields
by using intelligent device microcontroller 8051.

The following steps were followed:



Prepare the layout of the circuit diagram using software Proteus 7.1 / Express PCB.

Take the print out of layout on transparent sheet or butter paper in inverted format.


Take the impression of layout on Clad board using carbon paper or electric iron.

Now dip the clad board having printed layout into the etch solution.
The etch solution removes the unwanted copper .
Now we are able to get the required layout printed on PCB in the form of copper.

Now test the tracks using multimeter.

Now drill the required holes for component mounting.


Fig 5.1: Layout of microcontroller



Soldering iron
A soldering iron [18] is a hand tool most commonly used in soldering. It supplies heat to melt the
solder so that it can flow into the joint between two workpieces.

A soldering iron is composed of a heated metal tip and an insulated handle. Heating is often
achieved electrically, by passing an electric current (supplied through an electrical cord or
battery cables) through the resistive material of a heating element. Another heating method
includes combustion of a suitable gas, which can either be delivered through a tank mounted on
the iron (flameless), or through an external flame.

Less common uses include pyrography (burning designs into wood) and plastic welding.
Soldering irons are most often used for installation, repairs, and limited production work. High-
volume production lines use other soldering methods.

Fig5.2: Solder iron

Wire Stripper

Wire stripper is used to strip off wire insulator from its conductor before it is used to connect to
another wire or soldered into the printed circuit board. Some wire stripper or wire cutter has a
measurement engraved on it to indicate the length that will be stripped.

Side-Cutting Plier

A 4-inch side cutting plier will come in handy as one of the electronic tools when one need to
trim off excess component leads on the printed circuit board. It can also be used to cut wires into
shorter length before being used. Tweezer

Fig 5.3: Tweezer

Small tweezer is used to hold small components especially when doing soldering and de-
soldering of surface mount components.


Now mount all the components on the PCBs using the above mentioned tool.

After designing the circuit we get the following hardware:

Fig5.4: Hardware Of The Project

Fig5.5: DC Motor Used

Fig5.6: Hardware Setup when switched on

Fig5.7: Irrigation Field and Water Tank With Motor


KEIL uVision 3 :

Fig 5.8: Keil µvision 3

The Keil 8051 Development Tools [16] are designed to solve the complex problems facing
embedded software developers.

1) When starting a new project, simply select the microcontroller you use from the Device
Database and the μVision IDE sets all compiler, assembler, linker, and memory options for you.

2) Numerous example programs are included to help you get started with the most popular
embedded 8051 devices.

3) The Keil μVision Debugger accurately simulates on-chip peripherals (I²C, CAN, UART, SPI,
Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051 device.
Simulation helps you understand hardware configurations and avoids time wasted on setup
problems. Additionally, with simulation, you can write and test applications before target
hardware is available.

Various steps to use the KEIL Compiler

1) Open keil from the start menu.

2) Select a new project from the project menu.
3) Make a new folder in any drive.
4) Name the project as ABC and then click save.
5) Right click on target, then options for the target, then choose the device, set the crystal
frequency, click on the create hex file option to create hex file at the output.
6) Then create a new file from the file menu and save it with the same name of project using
extension .c or .asm.
7) Right clicks on the source group, then click on add files option to add the files and then click
on close.

How to debug the program :

1) After writing the code, click on file menu and select save.
2) Click on project menu and rebuild all target files.
3) In build window, it should report as „0 Error(s), 0 Warning(s).
4) Click on debug menu and select start/stop debug session.
5) Click on peripherals, select I/O ports like as port 1.

6) A new window will pop up, which represents the port and pins.

Fig 5.9: Parallel Port

7) Now to execute the program stepwise click on F10 key.

8) To exit out click on debug menu and select start/stop debug session.


Burn the hex file to microcontroller using the Proload V4.1 software.

1. Connect the burner to PC using serial communication port

2. Browse the hex file .

3. Now burn the hex file to microcontroller using send command.

Fig 5.10: Programmer


sbit ale=P3^6;

sbit oe=P3^5;

sbit sc=P3^3;

sbit eoc=P3^4;

sbit clk=P3^2;

sbit ADD_A=P1^0;

sbit ADD_B=P1^1;

sbit ADD_C=P1^2;

sfr lcd_data_pin=0x80;

sbit rs=P3^0;

sbit rw=P3^1;

sbit en=P3^7;

sbit relay1=P1^3;

sbit led=P1^4;

sfr input_port=0xA0;

unsigned char readad[2];

unsigned char word1[16]={""};

unsigned char datsch[10]={"0123456789"};

unsigned int key,number,flag,key1;

unsigned int a,b,c;

void timer0() interrupt 1


void delay(unsigned int count)

int i,j;



void lcd_command(unsigned char comm)







void lcd_data(unsigned char disp)







lcd_dataa(unsigned char *disp)

int x;




void lcd_ini()







void relay()





lcd_dataa("ON ");






void soil_moisture()

float tt;







word1[4]=(unsigned char )(tt);

word1[5]=(unsigned char )(tt*10-word1[4]*10);



void adc()
























void main()















lcd_dataa("SOIL MOISTURE ");


lcd_dataa("WATER PUMP : ");


After successful Hardware Implementation of the circuit diagram in PCB following outputs will
be obtained:-
1) When the value of soil moisture is zero there will be no connection between the
electrodes and a infinite impedance will occur between the two electrodes. This makes relay in
ON state. The microcontroller send output „1‟ to the motor circuit. Hence it will result in turning
ON the motor.

Fig 6.1: Output on LCD When MOTOR ON

2) When there is sufficient moisture is present between the electrodes of the circuit. Then
it makes a complete connection between the electrodes. The relay will switch OFF. Then
microcontroller will send output „0‟ to the motor. This will result in turning OFF the motor.

Fig 6.2: Output on LCD When Motor Off

Since prior days agriculturist should visit their horticultural land and check the dampness
substance of soil physically. It permits the client to screen and keep up the dampness remotely
regardless of time. It is truly a viable and financial approach to decrease human exertion and
water wastage in farming area. Ebb and flow systems in farming have decreased the ground-
water level and accessibility of human asset. This Irrigation control framework utilizing Android
can help agriculturist as a part of numerous courses.

Aside from horticultural fields, this framework can be utilized as a part of Cricket stadiums or
Golf stadiums furthermore openly cultivates. The framework has an immense interest and future
extension as well.

It permits a ton of improvement inside it and prompts the standard and valuable framework
which can be utilized differ generally as a part of rural field.

1.Irrigation In Fields
2.Irrigation In Garden Parks.
3.Very Efficient For Paddy Fields.

 Automation eliminates the manual operation of opening or closing valves.

 Possibility to change frequency of irrigation and fertigation processes and to optimize these

 Adoption of advanced crop systems and new technologies, especially new crop systems
that are complex and difficult to operate manually.
 Use of water from different sources and increased efficiency in water and fertilizer use.
 System can be operated at night, water loss from evaporation is thus minimized.
 Irrigation process starts and stops exactly when required, thus optimizing energy

 The systems can be very expensive.

 Self-help compatibility is very low with big-scale systems, which are very complex.
 Most automated irrigation systems need electricity.
 For crops like rice we cannot use this same project because of excess need of water. We
will use DTMF technique in the fields where large amount of water is needed.

[1] .Kim MK, Park JH, Cho YW. Current Trends and Industrial Strategies of IT Convergence. 1
Vol. 25. ETRI Electronic Communications Trend Report; Electronics and Telecommunications
Research Institute; Daejeon, Korea: Feb, 2010.

[2] . Yoo S, Kim J, Kim T, Ahn S, Sung J, Kim D. A2S: Automated Agriculture System Based
on WSN. Proceedings of ISCE 2007. IEEE International Symposium on Consumer Electronics;
Irving, TX, USA. 20–23 June 2007

[3]. Lea-Cox JD, Kantor G, Anhalt J, Ristvey A, Ross DS. A Wireless Sensor Network for the
Nursery and Greenhouse Industry. Proceedings of Southern Nursery Association Research
Conference; Atlanta, GA, USA. 8–9 August 2007

[4]. https://en.wikipedia.org/wiki/Soil_moisture_sensor

[5]. http://www.edgefxkits.com/automatic-irrigation-system-on-sensing-soil-moisture-content.

[6]. http://www.instructables.com/id/Automatic-Plant-Watering-and-Soil-Moisture-Sensing/

[7]. http://www.slideshare.net/stk25/ppt-for-automatic-plant-irrigation-syste

[8]. http://www.facstaff.bucknell.edu/mastascu/elessonshtml/sensors/templm35.html

[9]. http://electronicsjmbh.blogspot.in/2011/03/microcontroller-mcu-is-small-computer.html

[10]. http://www.atmel.com/images/doc2487.pdf

[11]. http://www.engineersgarage.com/electronic-components/16x2-lcd-module-datasheet

[12]. http://www.phidgets.com/docs/3051_User_Guide


[14]. http://www.electrical4u.com/working-or-operating-principle-of-dc-motor/

[15]. https://electrosome.com/led-blinking-8051-microcontroller-keil-c-tutorial-at89c51/

[16]. http://www.keil.com/c51/c51.asp

[17]. http://www.labcenter.com/index.cfm