Vous êtes sur la page 1sur 63

Auto Controlled Irrigation Unit In

Greenhouse

CONTENTS

1. INTRODUCTION………………………………………
2. SYSTEM REQUIREMENTS……………………………
3. HARDWARE IMPLEMENTATION……………………
3.1 BLOCK DIAGRAM
3.2 CIRCUIT DIAGRAM
4. SYSTEM SPECIFICATION……………………………
4.1 MICROCONTROLLER AT89C51
4.2ADC
4.3 555 TIMER
4.4 LM35 TEMPERATURE SENSOR
4.5 LCD 16*2
4.6 LDR SENSOR
4.7 HUMIDITY SENSOR
4.8 ULN WITH RELAY
4.9 KIEL TOOL WITH EMBEDDED C
5. SYSTEM WORKING………….…………….…………
5.1 WORKING
5.2 FLOW CHART
FUTURE ENHANCEMENTS……………………………
LIMITATIONS …………………………………….………
CONCLUSION……………………………………….……
BIBLIOGRAPHY………….………………………….…..
APPENDIX……………………………………………………….

Dept. of Electrical & Electronics Engg.


CEC Page 1
Auto Controlled Irrigation Unit In
Greenhouse

CHAPTER 1

INTRODUCTION
We live in a world where everything can be controlled and operated
automatically, but there are still a few important sectors in our country where
automation has not been adopted or not been put to a full-fledged use, perhaps because of
several reasons one such reason is cost. One such field is that of agriculture. Agriculture
has been one of the primary occupations of man since early civilizations and even today
manual interventions in farming are inevitable. Greenhouses form an important part of
the agriculture and horticulture sectors in our country as they can be used to grow plants
under controlled climatic conditions for optimum produce. Automating a greenhouse
envisages monitoring and controlling of the climatic parameters which directly or
indirectly govern the plant growth and hence their produce. Automation is process control
of industrial machinery and processes, thereby replacing human operators.

The objective of this project is to design a simple, easy to install, microcontroller-


based circuit to monitor and record the values of temperature, humidity, soil moisture
and sunlight of the natural environment that are continuously modified and controlled in
order optimize them to achieve maximum plant growth and yield. The controller used is a
low power, cost efficient chip manufactured by ATMEL having 8K bytes of on-chip flash
memory. It communicates with the various sensor modules in real-time in order to control
the light, aeration and drainage process efficiently inside a greenhouse by actuating a
cooler, fogger, dripper and lights respectively according to the necessary condition of the
crops. An integrated Liquid crystal display (LCD) is also used for real time display of data
acquired from the various sensors and the status of the various devices. Also, the use of
easily available components reduces the manufacturing and maintenance costs. The
design is quite flexible as the software can be changed any time. It can thus be tailor-
made to the specific requirements of the user.

Dept. of Electrical & Electronics Engg.


CEC Page 2
Auto Controlled Irrigation Unit In
Greenhouse

CHAPTER 2

SYSTEM REQUIREMENTS

Following requirements have been identified after analysis:

2.1 SOFTWARE REQUIREMENTS


2.2 HARDWARE REQUIREMENTS

Dept. of Electrical & Electronics Engg.


CEC Page 3
Auto Controlled Irrigation Unit In
Greenhouse

2.1 SOFTWARE REQUIREMENTS:

2.1.1 KEIL µVISION3 IDE:


KeilµVision3 IDE (Integrated Development Environment) is a Windows
based front end for assembler. Keil µVision3 is used for writing Microcontroller
programs. Standard libraries are altered or enhanced to address the peculiarities of an
embedded target processor.

2.2 HARDWARE REQUIREMENTS:

2.2.1 MICROCONTROLLER (ATMEL 89C51):


This is an atmel microcontroller, which we are using in our project. This chip is
100% compatible with Intel 8051 microcontroller applications.
2.2.2 ADC:
Here ADC 0809 is used to convert the incoming analog signal like temperature value
to digital signal. This is an 8 bit ADC AND uses successive approximation as the
conversion technique.

2.2.3 555 Timer:


Here 555 timer in astable mode is used to get the square wave of 32khz and this is
intern given to the clock of the ADC.

2.2.4 LCD:
We are using Hitachi LCD with dot matrix type which supports 16x2= 32
characters.

Dept. of Electrical & Electronics Engg.


CEC Page 4
Auto Controlled Irrigation Unit In
Greenhouse

2.2.5 LM35
. The LM35 series are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35
thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as the
user is not required to subtract a large constant voltage from its output to obtain
convenient Centigrade scaling.

2.2.6 HUMIDITY SENSOR:


This is a 3 pin device used to monitor water content in airand is measured in
percentage.

Dept. of Electrical & Electronics Engg.


CEC Page 5
Auto Controlled Irrigation Unit In
Greenhouse

CHAPTER 3

HARDWARE IMPLEMENTATION
3.1 BLOCK DIAGRAM
3.2 CIRCUIT DIAGRAM

Dept. of Electrical & Electronics Engg.


CEC Page 6
Auto Controlled Irrigation Unit In
Greenhouse

3.1 BLOCK DIAGRAM

Fig BLOCK DIAGRAM

Dept. of Electrical & Electronics Engg.


CEC Page 7
Auto Controlled Irrigation Unit In
Greenhouse

3.2 CIRCUIT DIAGRAM

3.2.1 POWER SUPPLY

Transformer o/p- sine wave of 24v, since it is a 12-0-12 transformer

Diode o/p- Full wave rectifier o/p with 24 v


Dept. of Electrical & Electronics Engg.
CEC Page 8
Auto Controlled Irrigation Unit In
Greenhouse

Capacitor o/p- rippled DC

7805 O/P- pure DC with 5v

7812 O/P- pure DC with 12v


3.2.2 MICRONTROLLER AND LCD

Vcc vss

15 16 7
P1.0
LCD

Microcontroller

1 2 3 4 5 6 14
P1.7

P2.0
P2.1
P2.2

VSS VCC VEE

LCD PINS

1. ground
2. supply(5 volt)
3. pot(contrast)
4. RS
5. R/W
6. E
7. DB0
8. DB1
9. DB2
10. DB3
11. DB4
12. DB5
13. DB6
Dept. of Electrical & Electronics Engg.
CEC Page 9
Auto Controlled Irrigation Unit In
Greenhouse

14. DB7
15. LCD-( Backlight)
16. LCD+(Backlight)

3.2.3 MICROCONTROLLER WITH ADC

Dept. of Electrical & Electronics Engg.


CEC Page 10
Auto Controlled Irrigation Unit In
Greenhouse

5v
ADC
LM35
17 26
14 27
Microcontroller 15
8 Gnd
P0.0 18
P0.1 19 HUMIDITY
P0.2 20
P0.3 21
P0.4 28
P0.5 25(A0) LDR
P0.6 24(A1)
P0.7 23(A2)
22(ALE)
P2.7 9(OE) 5v
P2.6
P2.5 6(START)
P2.4 7(EOC)
P2.3
11
P3.7 12
P3.6
13
16
Vcc
10 MF 10

Gnd Clock

8
R1 18k
7 4
R2 10k
6 555 timer 3

2
C 1nF
3.2.4 555 TIMER AS A CLOCK SOURCE
5 1

0.01MF

Dept. of Electrical & Electronics Engg.


Gnd 10
CEC Page 11
ADC
Auto Controlled Irrigation Unit In
Greenhouse

F= 1/ ((0.693 x C X (R1+ (2 XR2)))


F= 38 KHz
Choose R2= 10k, C=1Nf

So, R1= 18k

3.3.5 ULN WITH RELAY

ULN 2003

1 16 Relay1
2 15
Microcontroller
3 14
8 Relay3
P2.3
P2.4
P2.5

12V

Dept. of Electrical & Electronics Engg.


CEC Page 12
Auto Controlled Irrigation Unit In
Greenhouse

CHAPTER 4

SYSTEM SPECIFICATION

4.1 Microcontroller AT89C51


 General description
 Hardware interactions with microcontroller
4.2 ADC
4.3 555 TIMER
4.4 TEMPERATURE SENSOR LM35
4.5 LCD 16*2
4.6 HUMIDITY SENSOR
4.7 LDR
4.8 ULN
4.9 EMBEDDED C WITH KEIL

Dept. of Electrical & Electronics Engg.


CEC Page 13
Auto Controlled Irrigation Unit In
Greenhouse

4.1 MICROCONTROLLER-ATMEL89C51

4.1.1General description:
This device is a Single-Chip 8-Bit Microcontroller manufactured in an
advanced CMOS process and is a derivative of the 8051 microcontroller family. The
instruction set is 100% compatible with the 8051 instruction set.

The Microcontroller AT89C51 is housed in a 40-pin DIP. The unique features


of Microcontroller are:
 4 Kbytes of On-chip Flash Program Memory
 In-Application Programming (IAP) capability
 Internal RAM of 128 bytes
 RAM expandable externally to 64 Kbytes
 two 16-bit Timer/Counters
 six interrupt sources
 Four interrupt priority levels
 Four 8-bit I/O ports
 Full-duplex enhanced UART
 Operating frequency:11.0592 MHz
 Power control modes
 Clock can be stopped and resumed
 Idle mode
 Power down mode

Dept. of Electrical & Electronics Engg.


CEC Page 14
Auto Controlled Irrigation Unit In
Greenhouse

Fig 4.1 Internal block diagram of AT89C51.

Dept. of Electrical & Electronics Engg.


CEC Page 15
Auto Controlled Irrigation Unit In
Greenhouse

4.1.2 Pin Description:

Fig 4.2 Pin diagram of AT89C51

VCC: Supply voltage.


GND: Ground.
Dept. of Electrical & Electronics Engg.
CEC Page 16
Auto Controlled Irrigation Unit In
Greenhouse

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 inputs.
Port 0 can also be configured to be the multiplexed low-order address/data bus during
accesses to external programmed data memory. In this mode, P0 has internal pull-ups. Port 0
also receives the code bytes during Flash programming and outputs the code bytes during
program verification.

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. As inputs, Port 1 pins that are
externally being pulled low wilt source current (IIL) because of the internal pull-ups. In
addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively.

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. As inputs, Port 2 pins that are
externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2
emits the high-order address byte during fetches from external program memory and during
accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this
application, Port 2 uses strong internal pull-ups when emitting 1s. During

Dept. of Electrical & Electronics Engg.


CEC Page 17
Auto Controlled Irrigation Unit In
Greenhouse

accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the
contents of the P2 Special Function Register.

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. As inputs, Port 3 pins that are
externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also
serves the functions of various special features of the AT89C51.

Port Pin Alternate Functions:


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)

Port 3 also receives some control signals for Flash programming and programming
verification. RST Reset input. A high on this pin for two machine cycles while the oscillator
is running resets the device.

ALE/PROG:
Address Latch Enable 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.

In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency
and may be used for external timing or clocking purposes. Note, however, that

Dept. of Electrical & Electronics Engg.


CEC Page 18
Auto Controlled Irrigation Unit In
Greenhouse

One ALE pulse is skipped during each access to external data memory. If desired, ALE
operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is
active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high.
Setting the ALE-disable bit has no effect if the Microcontroller is in external execution
mode.

PSEN:
Program Store Enable is the read strobe to external program memory. When the
AT89C52 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 memory.

EA/VPP:
External Access Enable: A 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. EA should
be strapped to VCC for internal program executions. This pin also receives the 12-volt
programming enable voltage (VPP) during Flash programming when 12-volt programming is
selected.

XTAL1:
Input to the inverting oscillator amplifier and input to the Internal clock operating
circuit.

Dept. of Electrical & Electronics Engg.


CEC Page 19
Auto Controlled Irrigation Unit In
Greenhouse

XTAL2:
Output from the inverting oscillator amplifier.

4.1.3 OSCILLATOR AND CLOCK:

The heart of the 89C52 is the circuitry that generates the clock pulses. Pins XTAL1
and XTAL2 are provided for connecting a resonant network to form an oscillator. Typically,
a quartz crystal and capacitors are employed as shown in figure. The crystal frequency is the
basic internal clock frequency of the micro controller.
To calculate the time ‘Tinst’ any particular instruction will take to be executed, find
the number of cycles ‘C’,
T inst = (C*12d)/(crystal frequency)
An 11.0592 MHz crystal is connected to XTAL1 and XTAL2 to yield a cycle
frequency of 921.6 KHz.

4.1.4 MICROCONTROLLER AND LCD INTERACTIONS:

Microcontroller interacts with LCD to display data on it. Port 0 pins are used to
interact with the LCD.
P 2.0: is connected to Register Select (RS) pin i.e. Pin 4 of LCD.
If P 3.5 = 0, instruction commands code register is selected, allowing the user to
send a command such as clear display, cursor at home etc.
If P 3.5 = 1, the data register is selected, allowing the user to send data to be
displayed on to the LCD.

P 2.2: is connected to Enable (EN) pin i.e. Pin 6 of LCD.


The LCD to latch information presented on its data pins uses the enable pin. When
data is supplied to data pins, a high-to-low pulse must be applied to this pin in order for

Dept. of Electrical & Electronics Engg.


CEC Page 20
Auto Controlled Irrigation Unit In
Greenhouse

the LCD to latch in the data present at the data pins. This pulse must be a minimum of
450ns wide.

P 1.0: is connected to Data pin bit 0 of LCD.


P 1.1: is connected to Data pin bit 1 of LCD.
P 1.2: is connected to Data pin bit 2 of LCD.
P 1.3: is connected to Data pin bit 3 of LCD.
P 1.4: is connected to Data pin bit 4 of LCD.
P 1.5: is connected to Data pin bit 5 of LCD.
P 1.6: is connected to Data pin bit 6 of LCD.
P 1.7: is connected to Data pin bit 7 of LCD.

4.1.5 SERIAL COMMUNICATION:

To communicate serially, the baud rate has to be set. Configuring the special function
registers (SCON and TMOD) of the microcontroller can set this.
SCON: Serial Port Control Register (Bit –Addressable)

One cost effective way to communicate is to send and receive bits serially.
Asynchronous serial communication is widely used for character-oriented transmission. In
Asynchronous serial communication, the data is placed in between a start bit and one or two
stop bits. This is called Framing. During serial data communication, register SUBF is used to
hold data to be transmitted / received. SCON register controls data communication, PCON
controls data rates.

SBUF is physically two registers. One is writing only and is used to hold data to be
transmitted out of 89C52 via TXD. The other is read only and holds received data from

Dept. of Electrical & Electronics Engg.


CEC Page 21
Auto Controlled Irrigation Unit In
Greenhouse

external sources via RXD. A register called SCON at address 98H controls the serial port of
microcontroller.

4.2 ADC [ANALOG TO DIGITAL CONVERSION]

The ADC0808, ADC0809 data acquisition component is a monolithic CMOS device


with an 8-bit analog-to-digital converter, 8-channel multiplexer and microprocessor
compatible control logic. The 8-bit A/D converter uses successive approximation as the
conversion technique. The converter features a high impedance chopper stabilized
comparator, a 256R voltage divider with analog switch tree and a successive approximation
register. The 8-channel multiplexer can directly access any of 8-single-ended analog signals.

The device eliminates the need for external zero and full-scale adjustments. Easy
interfacing to microprocessors is provided by the latched and decoded multiplexer address
inputs and latched TTL TRI-STATEÉ outputs. The design of the ADC0808, ADC0809 has
been optimized by incorporating the most desirable aspects of several A/D conversion
techniques. The ADC0808, ADC0809 offers high speed, high accuracy, minimal temperature
dependence, excellent long-term accuracy and repeatability, and consumes minimal power.
These features make this device ideally suited to applications from process and machine
control to consumer and automotive applications.

Because the Analog-to-Digital Converter (A/D Converter or ADC) has both analog
and digital functions, it is a mixed-signal device. Many of us consider the ADC to be a
mysterious device. It can, however, be considered very simply to be the instrument that it is:
a device that provides an output that digitally represents the input voltage or current level.
Notice I said voltage or current. Most ADCs convert an input voltage to a digital word, but
the true definition of an ADC does include the possibility of an input current.
An ADC has an analog reference voltage or current against which the analog input is
Compared. The digital output word tells us what fraction of the reference voltage or current
is the input voltage or current. So, basically, the ADC is a divider.

Dept. of Electrical & Electronics Engg.


CEC Page 22
Auto Controlled Irrigation Unit In
Greenhouse

The Input/Output transfer function is given by the formula indicated here. If you have seen
this formula before, you probably did not see the “G” term (gain factor). This is because we
generally consider this to be unity.

However, National Semiconductor has introduced ADCs with other gain factors, so it is
important to understand that this factor is present.

Features
 Easy interface to all microprocessors
 Operates ratiometrically or with 5 VDC or analog span adjusted voltage reference
 No zero or full-scale adjust required
 8-channel multiplexer with address logic
 0V to 5V input range with single 5V power supply
 Outputs meet TTL voltage level specifications
 Standard hermetic or molded 28-pin DIP package
 28-pin molded chip carrier package
 ADC0808 equivalent to MM74C949
 ADC0809 equivalent to MM74C949-1

Key Specifications

 Resolution 8 Bits
 Total Unadjusted Error g(/2 LSB and g1 LSB
 Single Supply 5 VDC
 Low Power 15 mW
 Conversion Time 100 ms

Dept. of Electrical & Electronics Engg.


CEC Page 23
Auto Controlled Irrigation Unit In
Greenhouse

Dept. of Electrical & Electronics Engg.


CEC Page 24
Auto Controlled Irrigation Unit In
Greenhouse

The digital output drivers of the ADC provide fairly fast edge rates (rise and fall
times). This causes the output drivers to draw varying amounts of dynamic supply current
with fast rise times to charge whatever capacitance is on the outputs when the output data
must go from a logic low to logic high. The noise thus introduced on the output driver supply
can upset any analog circuitry if that supply is not decoupled from the ADC output drivers.

4.3. 555 TIMER


The LM555 is a highly stable device for generating accurate time delays or
oscillation. Additional terminals are provided for triggering or resetting if desired. In the time
delay mode of operation, the time is precisely controlled by one external resistor and
capacitor. For astable operation as an oscillator, the free running frequency and duty cycle
are accurately controlled with two external resistors and one capacitor. The circuit may be
triggered and reset on falling waveforms, and the output circuit can source or sink up to
200mA or drive TTL circuits.

Dept. of Electrical & Electronics Engg.


CEC Page 25
Auto Controlled Irrigation Unit In
Greenhouse

Features
 Direct replacement for SE555/NE555
 Timing from microseconds through hours
 Operates in both astable and monostable modes
 Adjustable duty cycle
 Output can source or sink 200 mA
 Output and supply TTL compatible
 Temperature stability better than 0.005% per °C
 Normally on and normally off output
 Available in 8-pin MSOP package

Applications:
 Precision timing
 Pulse generation
 Sequential timing
 Time delay generation
 Pulse width modulation

Dept. of Electrical & Electronics Engg.


CEC Page 26
Auto Controlled Irrigation Unit In
Greenhouse

 Pulse position modulation


 Linear ramp generator

ASTABLE OPERATION

If the circuit is connected as shown in Figure 4 (pins 2 and 6 connected) it will trigger
itself and free run as a multivibrator. The external capacitor charges through RA + RB and
discharges through RB. Thus the duty cycle may be precisely set by the ratio of these two
resistors.

Dept. of Electrical & Electronics Engg.


CEC Page 27
Auto Controlled Irrigation Unit In
Greenhouse

In this mode of operation, the capacitor charges and discharges between 1/3 VCC and
2/3 VCC. As in the triggered mode, the charge and discharge times, and therefore the
frequency are independent of the supply voltage.

Applications Information

Figure shows the waveforms generated in this mode ofoperation.

Dept. of Electrical & Electronics Engg.


CEC Page 28
Auto Controlled Irrigation Unit In
Greenhouse

VCC = 5V Top Trace: Output 5V/Div.


TIME = 20μs/DIV. Bottom Trace: Capacitor Voltage 1V/Div.
RA = 3.9kΩ
RB = 3kΩ
C = 0.01μF

The charge time (output high) is given by:


t1 = 0.693 (RA + RB) C
And the discharge time (output low) by:
t2 = 0.693 (RB) C
Thus the total period is:
T = t1 + t2 = 0.693 (RA +2RB) C
The frequency of oscillation is:

Below fig may be used for quick determination of these RC values.


The duty cycle is:

Dept. of Electrical & Electronics Engg.


CEC Page 29
Auto Controlled Irrigation Unit In
Greenhouse

EXAMPLE OF 555: PULSE WIDTH MODULATOR


When the timer is connected in the monostable mode and triggered with a continuous pulse
train, the output pulse width can be modulated by a signal applied to pin 5. In below Figure
are some waveform examples.

Dept. of Electrical & Electronics Engg.


CEC Page 30
Auto Controlled Irrigation Unit In
Greenhouse

Dept. of Electrical & Electronics Engg.


CEC Page 31
Auto Controlled Irrigation Unit In
Greenhouse

4.4 LM35 TEMPERATURE SENSOR

The LM35 series are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has
an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not
required to subtract a large constant voltage from its output to obtain convenient Centigrade
scaling. The LM35 does not require any external calibration or trimming to provide typical
accuracies of ±1⁄4°C at room temperature and ±3⁄4°C over a full −55 to +150°C temperature
range. Low cost is assured by trimming and calibration at the wafer level.

The LM35’s low output impedance, linear output, and precise inherent calibration
make interfacing to readout or control circuitry especially easy. It can be used with single
power supplies, or with plus and minus supplies. As it draws only 60 μA from its supply, it
has very low self-heating, less than 0.1°C in still air. The LM35 is rated to operate over a
−55° to +150°C temperature range, while the LM35C is rated for a −40° to +110°C range
(−10° with improved accuracy). The LM35 series is available packaged in hermetic TO-46
transistor packages, while the LM35C, LM35CA, and LM35D are also available in the
plastic TO-92 transistor package. The LM35D is also available in an 8-lead surface mount
small outline package and a plastic TO-220 package

Features

 Calibrated directly in ° Celsius (Centigrade)


 Linear + 10.0 mV/°C scale factor
 0.5°C accuracy guarantee able (at +25°C)
 Rated for full −55° to +150°C range
 Suitable for remote applications
 Low cost due to wafer-level trimming
 Operates from 4 to 30 volts
 Less than 60 μA current drain
 Low self-heating, 0.08°C in still air

Dept. of Electrical & Electronics Engg.


CEC Page 32
Auto Controlled Irrigation Unit In
Greenhouse

 Nonlinearity only ±1⁄4°C typical


 Low impedance output, 0.1 W for 1 mA load

The LM35 can be applied easily in the same way as other integrated-circuit
temperature sensors. It can be glued or cemented to a surface and its temperature will be
within about 0.01°C of the surface temperature. This presumes that the ambient air
temperature is almost the same as the surface temperature; if the air temperature were much
higher or lower than the surface temperature, the actual temperature of the LM35 die would
be at an intermediate temperature between the surface temperature and the air temperature.
This is especially true for the TO-92 plastic package, where the copper leads are the principal
thermal path to carry heat into the device, so its temperature might be closer to the air
temperature than to the surface temperature. To minimize this problem, be sure that the
wiring to the LM35, as it leaves the device, is held at the same temperature as the surface of
interest.

The easiest way to do this is to cover up these wires with a bead of epoxy which will
insure that the leads and wires are all at the same temperature as the surface, and that the
LM35 die’s temperature will not be affected by the air temperature. The TO-46 metal
Dept. of Electrical & Electronics Engg.
CEC Page 33
Auto Controlled Irrigation Unit In
Greenhouse

package can also be soldered to a metal surface or pipe without damage. Of course, in that
case the V− terminal of the circuit will be grounded to that metal.
Alternatively, the LM35 can be mounted inside a sealed-end metal tube, and can then be
dipped into a bath or screwed into a threaded hole in a tank. As with any IC, the LM35 and
accompanying wiring and circuits must be kept insulated and dry, to avoid leakage

and corrosion. This is especially true if the circuit may operate at cold temperatures where
condensation can occur. Printed-circuit coatings and varnishes such as Humiseal and epoxy
paints or dips are often used to insure that moisture cannot corrode the LM35 or its
connections. These devices are sometimes soldered to a small light-weight heat fin, to
decrease the thermal time constant and speed up the response in slowly-moving air. On the
other hand, a small thermal mass may be added to the sensor, to give the steadiest reading
despite small deviations in the air temperature.

Like most micro power circuits, the LM35 has a limited ability to drive heavy
capacitive loads. The LM35 by itself is able to drive 50 pf without special precautions. If
heavier loads are anticipated, it is easy to isolate or decouple the load with a resistor; see
Figure 3. Or you can improve the tolerance of capacitance with a series R-C damper from
output to ground;

Dept. of Electrical & Electronics Engg.


CEC Page 34
Auto Controlled Irrigation Unit In
Greenhouse

4.5 LCD 16X2

Liquid crystal displays (LCD’s) offer several advantages over traditional cathode-ray
tube displays that make them ideal for several applications. Of course, LCDs are flat and they
use only a fraction of the power required by cathode-ray tubes. They are easier to read and
more pleasant to work with for long periods of time than most ordinary video monitors.
There are several tradeoffs as well, such as limited view angle, brightness, and contrast, not
to mention high manufacturing cost.

16x2 LCD is used in this project to display data to user. There are two rows and 16
columns. It is possible to display 16 characters on each of the 2 rows. It has two registers,
command register and data register.

Dept. of Electrical & Electronics Engg.


CEC Page 35
Auto Controlled Irrigation Unit In
Greenhouse

Description of pins used:

RS, Register Select:


This pin is used to select command register and data register.
If RS=0, instruction command register is selected, allowing the user to send a command such
as clear display, cursor at home, etc.
If RS =1, the data register is selected, allowing the user to send data to be displayed on the
LCD.

EN (Enable):
The LCD to latch information presented to its data pins uses the enable pin. When
data is supplied to data pins, a high-to-low pulse must be applied to this pin in order for the
LCD to latch in the data present at the data pins. This pulse must be a minimum of 450ns
wide.

R / W: (Read/Write)
This pin is connected to ground, as LCD is used only to display data.

D0 – D7: Data to be displayed is sent to LCD on these pins.

Vcc :
This pin is connected to +5v power supply.
Vss:
This pin is connected to ground

Dept. of Electrical & Electronics Engg.


CEC Page 36
Auto Controlled Irrigation Unit In
Greenhouse

4.6 HUMIDITY SENSOR


The humidity sensor HIH4000, manufactured by Honeywell is used for sensing the
humidity. It delivers instrumentation quality RH (Relative Humidity) sensing performance in
a low cost, solder able SIP (Single In-line Package). Relative humidity is a measure, in
percentage, of the vapour in the air compared to the total amount of vapour that could be held
in the air at a given temperature.

HIH-4000-001 Humidity Sensor

Features:

• Linear voltage output vs. %RH

• Laser trimmed interchangeability

• Low power design

• High accuracy

• Fast response time


• Stable, low drift performance

• Chemically resistant

Dept. of Electrical & Electronics Engg.


CEC Page 37
Auto Controlled Irrigation Unit In
Greenhouse

• The RH sensor is a laser trimmed, thermoset polymer capacitive sensing


element with on-chip integrated signal conditioning. The sensing element's multilayer
construction provides excellent resistance to most application hazards such as wetting, dust,
dirt,oils and common environmental conditions.

4.7 LDR 2

The Light Dependant Resistor which can also be known as a Photo Resistor or Photo
Conductor is an electronic component made of high resistance semiconductor material whose
resistance reduces as the amount of light shining on it increases. The device we will be
looking at in this exercise is a low cost Cadmium Sulphide (CdS) device readily available
from most electronic suppliers.
The LDR is manufactured by adding impurities and a fusing agent to very pure CdS
crystal powder and then mixing with water. The resulting paste is screened over the ceramic
substrate to provide an even coating. The coated substrate is then sintered at a high
temperature to grow the CdS crystals; this will give a thick photo sensitive layer. Lead
terminals and connecting wires are then added to the surface; the whole device is then
protected in a clear plastic coating.

CdS Coating

Lead Terminals

Connecting Wires

Light-dependent resistances (LDR) are cheap light sensors. The light dependent resistor
(LDR) is a sensor whose resistance decreases when light impinges on it. This kind of sensor
is commonly used in light sensor circuits in open areas, to control street lamps for example.
Another possible use is in spectroscopic apparatus. In this kind of apparatus, continuous light

Dept. of Electrical & Electronics Engg.


CEC Page 38
Auto Controlled Irrigation Unit In
Greenhouse

or pulsed light can be used. Continuous light is used in common spectroscopic apparatus. The
use of lock-in amplifiers made the use of pulsed light in spectroscopy easier, as is commonly
used in photo acoustic spectroscopy. LDR’s are made of semiconductors as light sensitive
materials, on an isolating base. The most common semiconductors used in this system are
cadmium sulphide, lead sulphide, germanium, silicon and gallium arsenide

4.8 ULN

ULN 2003 IC is used as a relay driver. It is an inverting buffer. The output current of digital
devices is very low. Therefore ULN2003 is used, which gives sufficient current to drive the
relay. ULN2003AG is an 18-pin IC out of which 8 pins are input and 8 pins are output pins
and other two are Ground and Vcc. It works as a switching device. It is high voltage, high
current Darlington driver. These versatile devices are useful for driving a wide range of
loads, relays, DC motors, LED displays, lamps. Pin Diagram is shown below

Features:
• Seven Darlington’s per package.
• Output current 500mA per driver (600ma peak).
• Output voltage 50V.
• Outputs can be pearled for higher currents.
• TTL/CMOS/PMOS/DTL compatible input.
• Inputs pinned opposite outputs to simplify layout.
• Outputs can be paralleled for higher current

Dept. of Electrical & Electronics Engg.


CEC Page 39
Auto Controlled Irrigation Unit In
Greenhouse

Fig Internal pin connection of ULN2003AG

Dept. of Electrical & Electronics Engg.


CEC Page 40
Auto Controlled Irrigation Unit In
Greenhouse

ULN 2003 is used to provide sufficient current to drive relay. Relay is an electromechanical
device, which is used to couple C with AC.

4.9 ABOUT THE KEIL COMPILER

Keil Software (http://www.keil.com) publishes one of the most complete


development tool suites for 8051 software, which is used throughout industry. For
development of C code, their Developer's Kit product includes their C51 compiler, as well as
an integrated 8051 simulator for debugging. A demonstration version of this product is
available on their website, but it includes several limitations (see next section). This is the
software that will be used for CECS-347.

The C programming language was designed for computers, though, and not
embedded systems. It does not support direct access to registers, nor does it allow for the
reading and setting of single bits, two very important requirements for 8051 software. In
addition, most software developers are accustomed to writing programs that will by executed
by an operating system, which provides system calls the program may use to access the

Dept. of Electrical & Electronics Engg.


CEC Page 41
Auto Controlled Irrigation Unit In
Greenhouse

hardware. However, much code for the 8051 is written for direct use on the processor,
without an operating system. To support this, the Kiel compiler has added several extensions
to the C language to replace what might have normally been implemented in a system call,
such as the connecting of interrupt handlers.

The purpose of this manual is to further explain the limitations of the Keil compiler, the
modifications it has made to the C language, and how to account for these in developing
software for the 8051 micro controller

Sample code
1) basic program to toggle bit Port0.5 10 times
Ans. #include<reg51.h>
Sbit ssss=P0^5;

Main ()
{
Unsigned char a;
P0=0X00;// Make P0 as output port
For (a=0; a<10; a++)
{
ssss=0; //toggling the bit
ssss=1;
}

Kiel Tool

Dept. of Electrical & Electronics Engg.


CEC Page 42
Auto Controlled Irrigation Unit In
Greenhouse

CHAPTER 5

SYSTEM WORKING

5.1 WORKING
5.2 FLOW CHART

Dept. of Electrical & Electronics Engg.


CEC Page 43
Auto Controlled Irrigation Unit In
Greenhouse

5.1 WORKING:
The proposed system is an embedded system which will closely monitor and
control the microclimatic parameters of a greenhouse on a regular basis round the
clock for cultivation of crops or specific plant species which could maximize their production
over the whole crop growth season and to eliminate the difficulties involved in the system by
reducing human intervention to the best possible extent. The system comprises of sensors,
Analog to Digital Converter, microcontroller and actuators.

When any of the above mentioned climatic parameters cross a safety threshold which
has to be maintained to protect the crops, the sensors sense the change and the

Dept. of Electrical & Electronics Engg.


CEC Page 44
Auto Controlled Irrigation Unit In
Greenhouse

microcontroller reads this from the data at its input ports after being converted to a digital
form by the ADC. The microcontroller then performs the needed actions by employing relays
until the strayed-out parameter has been brought back to its optimum level. Since a
microcontroller is used as the heart of the system, it makes the set-up low-cost and effective
nevertheless. As the system also employs an LCD display for continuously alerting the user
about the condition inside the greenhouse, the entire set-up becomes user friendly.

Thus, this system eliminates the drawbacks of the existing set-ups mentioned in the
previous section and is designed as an easy to maintain, flexible and low cost solution.

5.2 FLOW CHART


FLOWCHART REPRESENTING THE WORKING OF THE SYSTEM:

START

INITIALISE THE LCD

DISPLAY INITIALISATION MESSAGE

B
INITIALISE THE ADC

Dept. of Electrical & Electronics Engg.


CEC Page 45
Auto Controlled Irrigation Unit In
Greenhouse

OBTAIN THE SENSOR DATA

OBTAIN DIGITIZED DATA FROM ADC

STORE DIGITAL OUTPUT IN THE BUFFER MEMORY OF


THE MICROCONTROLLER

CLEAR THE LCD

IS MODE
YES
BUTTON
PRESSED

NO

DISPLAY THE DEVICE STATUS

DISPLAY THE SENSOR DATA

Dept. of Electrical & Electronics Engg.


CEC Page 46
A

YES NO
SENSOR
THRESHOLD
CROSSED?

TURN ON ACTUATOR TURN OFF ACTUATOR

FLOWCHART FOR LCD INITIALIZATION

START

INTILIAZE THE LCD WITH 2LINES, 5X7 MATRIX

CLEAR REGISTER SELECT, READ/WRITE


AND SET THE ENABLE PIN OF THE LCD

CALL SOME DELAY

CLEAR THE ENABLE PIN OF THE LCD

CALL SOME DELAY

C
C

SET THE DISPLAY ON AND THE CURSOR ON

CLEAR REGISTER SELECT, READ/WRITE


AND SET THE ENABLE PIN OF THE LCD

CALL SOME DELAY

CLEAR THE ENABLE PIN OF THE LCD

CALL SOME DELAY

CLEAR THE LCD AND SHIFT THE CURSOR TO RIGHT

CLEAR REGISTER SELECT, READ/WRITE


AND SET THE ENABLE PIN OF THE LCD

CALL SOME DELAY

CLEAR THE ENABLE PIN OF THE LCD

CALL SOME DELAY

SHIFT THE CURSOR AT LINE 1, POSITION 0

CLEAR REGISTER SELECT, READ/WRITE


AND SET THE ENABLE PIN OF THE LCD

D
D

CALL SOME DELAY

CLEAR THE ENABLE PIN OF THE LCD

CALL SOME DELAY

STOP

FLOWCHART FOR ADC INITIALIZATION

START

SELECT AN ANALOG CHANNEL BY SETTING


THE ADDRESS LINES A, B AND C

CLEAR THE OUTPUT ENABLE PIN

ACTIVATE THE ALE PIN WITH


A LOW TO HIGH PULSE

ACTIVATE THE START PIN BY A HIGH TO


LOW PULSE TO INITIATE CONVERSION

NO
IS YES

EOC =0? A
A

SET THE OUTPUT ENABLE PIN

CALL SOME DELAY

READ DATA OUT OF THE ADC CHIP

CLEAR THE OUTPUT ENABLE PIN

STOP
Auto Controlled
Irrigation Unit In Greenhouse

FUTURE ENHANCEMENT
1) The performance of the system can be further improved in terms of the
operating speed, memory capacity, instruction cycle period of the microcontroller by
using other controllers such as AVRs and PICs. The number of channels can be
increased to interface more number of sensors which is possible by using advanced
versions of
microcontrollers.

2) The system can be modified with the use of a datalogger and a graphical LCD
panel showing the measured sensor data over a period of time.
3) A speaking voice alarm could be used instead of the normal buzzer.

4) This system can be connected to communication devices such as modems,


cellular phones or satellite terminal to enable the remote collection of recorded data or
alarming of certain parameters.
5) The device can be made to perform better by providing the power supply with
the help of battery source which can be rechargeable or non-rechargeable, to reduce the
requirement of main AC power.
6) Time bound administration of fertilizers, insecticides and pesticides can be
introduced.
7) A multi-controller system can be developed that will enable a master controller
along with its slave controllers to automate multiple greenhouses simultaneously.

Dept. of Electrical & Electronics


CEC
Page 51
Auto Controlled
Irrigation Unit In Greenhouse

LIMITATIONS OF THE PROJECT

Some of the limitations of this project are:

• This project is an 8 bit microcontroller-based. The main limitation is the size of


ROM available on the chip for programming.
• The module is reset if the power goes off.

Dept. of Electrical & Electronics


CEC
Page 52
Auto Controlled
Irrigation Unit In Greenhouse

CONCLUSION

A step-by-step approach in designing the microcontroller based system


for measurement and control of the four essential parameters for plant growth, i.e.
temperature, humidity, soil moisture, and light intensity, has been followed. The results
obtained from the measurement have shown that the system performance is quite
reliable and accurate.
The system has successfully overcome quite a few shortcomings of the
existing systems by reducing the power consumption, maintenance and complexity, at
the same time providing a flexible and precise form of maintaining the environment.
The continuously decreasing costs of hardware and software, the wider
acceptance of electronic systems in agriculture, and an emerging agricultural control
system industry in several areas of agricultural production, will result in reliable
control systems that will address several aspects of quality and quantity of production.
Further improvements will be made as less expensive and more reliable sensors are
developed for use in agricultural production.

Although the enhancements mentioned in the previous chapter may seem far in
the future, the required technology and components are available, many such systems
have been independently developed, or are at least tested at a prototype level. Also,
integration of all these technologies is not a daunting task and can be successfully
carried out.

Dept. of Electrical & Electronics


CEC
Page 53
Auto Controlled
Irrigation Unit In Greenhouse

BIBLIOGRAPHY

Literature references:

 “The 8051 Microcontroller and embedded systems” by Muhammad Ali Mazidi and
Janice Gillispie Mazidi., Sixth edition, Pearson Education
 “The 8051 Microcontroller architecture, programming and applications” by
Kenneth J Ayala, second edition, Penram International Publishing.
 “Programming and Customizing The 8051 Micro controller” by Myke Predko.

Web sites:

 www.atmel/89c51/tutorials/architecture.com
 www.keil.com
 www.philips.com
 www.howstuffworks.com
 Tutorials on 8051, www.8051.com
 www.datasheetcatalog.com

Dept. of Electrical & Electronics


CEC
Page 54
Auto Controlled
Irrigation Unit In Greenhouse

APPENDIX
ATMEL DATA SHEET

Dept. of Electrical & Electronics


CEC
Page 55
Auto Controlled
Irrigation Unit In Greenhouse

RELAY DRIVER ULN2003AG

Dept. of Electrical & Electronics


CEC
Page 56
Auto Controlled
Irrigation Unit In Greenhouse

Dept. of Electrical & Electronics


CEC
Page 57
Auto Controlled
Irrigation Unit In Greenhouse

Dept. of Electrical & Electronics


CEC
Page 58
Auto Controlled
Irrigation Unit In Greenhouse

Dept. of Electrical & Electronics


CEC
Page 59
Auto Controlled
Irrigation Unit In Greenhouse

Dept. of Electrical & Electronics


CEC
Page 60
Auto Controlled
Irrigation Unit In Greenhouse

Dept. of Electrical & Electronics


CEC
Page 61
Auto Controlled
Irrigation Unit In Greenhouse

Dept. of Electrical & Electronics


CEC
Page 62
Auto Controlled
Irrigation Unit In Greenhouse

Dept. of Electrical & Electronics


CEC
Page 63

Vous aimerez peut-être aussi