Vous êtes sur la page 1sur 53

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

CHAPTER-1

INTRODUCTION
In a modern agriculture there is a need of so many automation technique from which the farmer perform his work without much of interaction. For this some of the works in a field can be possible to atomize with the help of microcontroller. The basic requirement of agriculture activity is a irrigation in which the old method is just by observing the upper surface of soil and irrigate the plants until the soil upper surface goes to wet but in this method there is an wastage of water about 4 ! because some of plants does not require that much of moisture for their routes as for some plants this may require still more. This problem can be solved by using a technique of sensing actual moisture level of the soil and action of pump can be controlled. The sensors which are inserted in to the soil which absorbs the level of moisture and in a driving stage this is further improved and fed to a microcontroller. "ccording to the moisture level of the soil there is a change in conductivity between two probes. #o the microcontroller is designed in such way that the moisture level develops between probes reach to a normal or abnormal values$ the output of microcontroller triggers the pump to irrigate the fields. The microcontroller also receives a logical signal of the pump condition that what about its temperature %a normal temperature indicates proper working of pump&. The reason for increase temperature of pump is that whenever it runs at dry running %working of pump without water& condition also the microcontroller not allows the pump to '()*. "ccording to these two parameters and the condition of soil$ the pump goes to '()* or '(FF*.

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

The one more problem on field is that the pesticides control$ in a normal method the pesticides can be controlled by putting a chemicals. ,ut this method has some drawbacks. ,y using an electronic method this can be controlled that is by generating an ultrasonic frequency and radiate these frequencies in field by a transducer of piezo electric. "nother feature of the same system is controlling wild animals to entering into a field by providing mild shock to it. " voltage of around + - and current of . m" with a frequency of / k0z is generated$ the output which is connected to electric fence. 1henever any wild animals try to enter the field$ this circuit delivers a shock through the fence but which is not harmful for the wild animal. (ne more feature is monitoring any theft condition of the pump and indicating at farmer house with a wireless link. " special kind of sensor is provided below pump as some body tries to lift the pump this switching signal is given to a transmitter which transmits the signal at some frequency. "s the receiver is fi2ed at farmers house so that$ as it receives a switching signal$ an alarm generator generates an alarm and an indication 345 indicates the status.

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

CHAPTER-2

SYSTEM REQUIREMENT SPECIFICATIONS


..+ 67(849T 74:;I74<4)T#

0"751"74= "T<43 />#?. <icrocontroller. ;"@4+ (6A"<6 ???Atimer 954 +B,9 5ual 5AFlip Flop 954 +@,9 5ecade 9ounter 954 4@,9 <onostableC"stable <ultivibrator <oisture$ Temperature #ensors

#(FT1"74= <icrocontroller 6rogram %"T<43 />9?.&.

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

CHAPTER-3

WORKING PRINCIPLE
B.+ ,3(9D 5I"E7"< (F eA"E7I9"74 ")5 T7")#<ITT47

FigB.+= ,lock 5iagram of eA"gricare and Transmitter

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

3.1.1 RECEIVER SECTION

7F

"3"7< E4)47"T(7

I)5I9"TI()

FigB..= ,lock 5iagram (f eA"gricare 1ith receiver

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

3.2 WORKING PRINCIPLE


<icrocontroller=
It is a low power$ high performance 9<(# /Abit microcomputer with /D, of flash programmable and erasable read only memory %647(<&. The device is manufactured using "T<43*s high density nonvolatile memory technology and is compatible with the industry standards />9?+ and />9?. instruction set and pin out. The on chip flash allows the program memory to be reprogrammed inAsystem or by a conventional nonvolatile memory programmer. ,y combining versatile /Abit 96; with flash on a monolithic chip$ the "T<43 at />9?+ is a powerful microcontroller$ which provides a highly fle2ible and cost effective solution to many embedded control application.

#oil <oisture #ensor=


The soil sensors are made up of copper plates. These copper plates are immersed in soil. "ccording to the condition of soil i.e. 14T or 57G condition$ the conductivity of the plates also changes because of water resistance. If the soil is dry$ the resistance between two probes is at infinite level. "nd according to the condition microcontroller switches the pump.

Temperature #ensor=
<icrocontroller receives logical pulses from temperature sensor %Thermisters& that indicates the temperature condition of the pump. " normal temperature indicates proper working of pump.

1ater 3evel #ensor=


(ne more reason to rise in temperature of pump is when it is dry running %working of pump without water&. "t this condition microcontroller not allows to run the pump.

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4lectric Fencing #ystem=


The electrical fencing system is used to control the wild animal*s entry into a field by providing mild shock using electronic circuit. " voltage of around + volts and current of . m" with a frequency of / k0z is generated$ which is connected to electric fence. 1henever any wild animals try to enter into a field this circuit delivers shock through the fence$ but which is not harmful for wild animals and human beings.

6esticide 9ontroller=
The main problem on field is the pesticides control. ,ut in a normal method can we controlled by putting chemicals$ but this method has some drawbacks. ,y using electronic method this can be controlled by generating an ultrasonic frequency and radiate this frequencies in field by transducer of piezo electric.

<onitoring Theft 9ondition for the 6ump=


The important feature of this system is monitoring any theft condition of the pump and indicating at farmer house with a wireless link. " special kind of sensor is provided below the pump$ as some body tries to lift the pump$ this switching signal is given to a transmitter$ which transmits the signal at some frequency. "s the receiver is fi2ed at farmers house so that$ as it receives a switching signal $ an alarm generator generates an alarm and an
indication 345 indicates the status.

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

CHAPTER-4

CIRCUIT DESCRIPTION
4.1 SOIL SENSOR UNIT

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

Fig4.+= 9ircuit 5iagram (f #oil #ensing

E&C Dept., G.M.I.T, DAVANGERE

>

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.+.+ (647"TI()=
"bove figure shows the circuit diagram of #oil #ensing. It consists of #oil #ensor

%9opper 9onducting 6lates&$ (6I"<6$ Transistor and 7elay. The #oil #ensor is used for the sensing of moisture. 1hen moisture content is less %5ry #oil& resistance is very high and when moisture content is more %1et #oil& resistance is very low. 0ere the (6I"<6 is used as a voltage comparator. The #ensor and variable resistor -7+ are connected to the nonA inverting terminal 6in )o B of the (6I"<6 to provide the potential difference. The inverting terminal 6in )o . of the (6I"<6 gets the potential difference from resistor 7+ and variable resistor -7.$ to adjust the 7eference -oltage. ;nder low moisture content %5ry soil& resistance is very high. #o the voltage at 6in )o B is less than the 7eference -oltage. "s soon as moisture content increases %1et soil&$ its resistance decreases which increases the voltage at 6in )o B i.e. )onAinverting terminal of the (6I"<6. )ow because of this condition the potential difference between two inputs at comparator also changes and the output of the comparator goes from its low to high state to activate %#aturate& the transistor. The collector of the transistor further drives relay. "s long as the moisture content is more$ the (6I"<6 output remains in the same state. 1hen moisture content goes down then the #ensor resistance goes to increase. This decrease the voltage at 6in )o B. ,ecause of this condition the (6I"<6 i.e. 9omparator output changes from its high to low state. "t this instant the transistors goes to cutoff and deactivate the relay.

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.2 TEMPERATURE SENSOR UNIT

Fig4..= 9ircuit 5iagram of Temperature #ensing


E&C Dept., G.M.I.T, DAVANGERE ++

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

E&C Dept., G.M.I.T, DAVANGERE

+.

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4...+ (647"TI()=
" temperature sensing circuit is designed with Thermistor$ (6I"<6$ Transistor and 7elay. The Thermistor is used as a Jthermal sensitive resistorK. The Thermistor resistance is very high at normal temperature. 0ere the (6I"<6 is used as a voltage comparator. The Thermistor 'T* and variable resistor -7+ are connected to the nonA inverting terminal 6in )o B of the (6I"<6 to provide the potential difference. The inverting terminal 6in )o . of the (6I"<6 gets the potential difference from resistor 7+ and variable resistor -7.$ to adjust the 7eference -oltage. ;nder normal temperature Thermistor resistance is very high. #o the voltage at 6in )o B is less than the 7eference -oltage. "s soon as temperature increases its resistance decreases which increases the voltage at 6in )o B i.e. )onAinverting terminal of the (6I"<6. )ow because of this condition the potential difference between two inputs at comparator also changes and the output of the comparator goes from its low to high state to activate %#aturate& the transistor. "s long as the temperature is maintained high the (6I"<6 output remains in the same state. 1hen temperature falls down on Thermistor$ its resistance goes to increase. This decrease the voltage at 6in )o B. ,ecause of this condition the (6I"<6 i.e. 9omparator output changes from its high to low state. "t this instant the transistors goes to cutoff and microcontroller deactivate the relay.

E&C Dept., G.M.I.T, DAVANGERE

+B

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.3 WATER LEVEL SENSOR UNIT

E&C Dept., G.M.I.T, DAVANGERE

+4

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

Fig4.B= 9ircuit 5iagram of 1ater 3evel #ensing

E&C Dept., G.M.I.T, DAVANGERE

+?

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.B.+ (647"TI()=
"bove figure shows the circuit diagram of 1ater #ensing. It consists of 1ater #ensor %9opper 9onducting 6lates or 6robes&$ (6I"<6$ Transistor and 7elay. The 1ater #ensor is used for sensing the water level. The input probes are inserted in the well$ storage tank or submersible system. 0ere the (6I"<6 is used as a voltage comparator. The #ensor and variable resistor -7+ are connected to the nonAinverting terminal 6in )o B of the (6I"<6 to provide the potential difference. The inverting terminal 6in )o . of the (6I"<6 gets the potential difference from resistor 7+ and variable resistor -7.$ to adjust the 7eference -oltage. 1hen there is no water in the storage tank$ well etc then the water resistance between the input probes is more. "t this condition the voltage at 6in )o B is less than the reference voltage and the output of the comparator is at low state which cutoff the transistor. If the input probes get the sufficient water the resistance between the probes decreases and the voltage at 6in )o B increases which is more than the reference voltage. )ow because of this condition the potential difference between two inputs%6in )o B L 6in )o . & at comparator also changes and the output of the comparator goes from its low to high state which activate %#aturate& the transistor. Then the output of the transistor is given to the microcontroller for further manipulation.

E&C Dept., G.M.I.T, DAVANGERE

+H

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.4 VARIABLE FREQUENCY ULTRASONIC PEST REPELLER UNIT:

E&C Dept., G.M.I.T, DAVANGERE

+@

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE Fig4.4= 9ircuit 5iagram of 6est 7epeller.

4.4.+ (647"TI()=
6ests like rats$ rodents$ rabbits$ birds etcMget irritated by ultrasonic frequency in the range of B to ? khz.Fortunately these frequencies are inaudible to humans. Thus these frequencies can be used to get rid of the pests. ,ut all these pests do not react to the same ultrasonic frequency. #ome pests may get repelled at B/ to 4/ k0z while some others may react at B? k0z. To increase the effectiveness of the circuit$ we have used a continuously variable ultrasonic frequency oscillator. " ??? timer is used as a clock generator$ which is configured in astable mode$ i.e. there is no need for e2ternal trigger but it generates clock pulses on its own. The frequency of the pulses can be varied by the potentiometer 7.. These pulses are used as the input pulses for the decade counter I9 954 +@. For each pulse from the timer the logic + is shifted through the outputs of the counter. There are totally + outputs ? of which are connected to the individual presets. 4ach of these presets can be set for different values so as to generate separate frequency values. The : to :4 outputs go high one by one in turn triggering a predetermined frequency through the presets. 1hen one output goes high the previous one goes low. This is shown in the truth table of decade counter. Thus at any particular instant$ only one frequency is generated$ for the preset duration. This duration depends on the clock pulse frequency of the ??? timer I9+. These outputs of the decade counter are used to vary the duty cycle of the ??? timer I9B .The on time and off time of the clock pulses of I9Bcan be varied by varying the resistance across pin no @.The duty cycle is given by$ 5uty cycle N 6ulse 1idth C Total time period

E&C Dept., G.M.I.T, DAVANGERE

+/

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

The ??? timer$ in the astable mode$ generates clock pulse which has unequal on and off timings. This periodic waveform is said to be asymmetrical. The duty cycle determines the on and off operating conditions of the device. Thus by controlling the duty cycle the frequency generated can be varied. The I9B ??? timer operates at around / khz.the output pulses of this I9 are used to trigger the I94A954 +B. I94A954 +B is a dual 5 flipAflop. That delivers symmetrical pulses at its : and : outputs. (nly one of these two flipAflops is used. This behaves like a frequency divider i.e. 5ivide by . counters.

E&C Dept., G.M.I.T, DAVANGERE

+>

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE Thus the pulses from the timer I9B which are applied to this flipAflop will be divided by ..Thus symmetrical clock pulses of frequency of about B A4 k0z can be obtained at : and : outputs of the flipAflop. ,y connecting a transducer to the : and : outputs directly the frequency of B A? k0z is obtained. The frequency can be either varied by varying any of the presets -7+ to -7? i.e. -arying the duty cycle or by varying the frequency of the clock pulses of I9B.The time duration for which each frequency is generated can be varied by varying the frequency of clock pulses of the I9+.Thus the frequency emission of fine step by step variation can be done automatically. The required frequency can be adjusted by trial and error method or by using a 9.7.(. This pest repeller is much effective because the ultrasonic frequency is automatically changed one after the other to match the different pests. The power generated is also sufficiently high. " 5arlington pair transistor can be used to get more amplified signals.

4.! POWER FENCING SYSTEM

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

Fig4.?= 9ircuit 5iagram of +. v$ "9 #ignal Eenerator.

E&C Dept., G.M.I.T, DAVANGERE

.+

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.?.+ (647"TI()=
The circuit is designed with 95 4 4@"stableC<onostable <ultivibrator and ;3) . B$ a 5arlington pair array current amplification I9#. 95 4 4@ used here as "stable <ultivibrator which is generating a frequency of /khz and this frequency is decided by a preset +< O and .+Pf capacitor which forms a tank circuit. The wave shape of such a circuit is quasi sine wave. The output is available across 6in )o ++ and 6in )o +. which is actually consider as : and :* outputs. The amplitude %strength& of this signal is not enough to drive a transformer for step up application. #o there is a need of improving the strength of this signal. ;3) . B I9 is a @ channel I9 which has @ )o of inputs and outputs. The output of 95 4 4@ B.0ere the current has been connected through limiting resistor ?H O to the inputs of ;3) .

strength has been developed to a suitable level so that to drive a step up transformer. The respective output of particular channel is connected to a step up transformer and the output taken across secondary of the transformer which is a high voltage "9. In this we are using a step down transformer in reverse way just to avoid a heavy and bulky step up transformer. The primary winding of step down transformer is taken as output and its secondary winding is input. The voltage developed across output is connected to fencing arrangements$ so that the illegal entries in security application and entering of wild animals in field can be prevented. The output of this circuit does not provide any kind of serious shocks. This is just a mild shock.

E&C Dept., G.M.I.T, DAVANGERE

..

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4." MOTOR THEFT CONTROL UNIT 4.".1 T#$%&'())*#:

"s the name itself indicates$ the 7.FC0.F. transmitter is an electromagnetic device i.e. 7adio transmitter working in the high frequency range. This transmitter circuit is built around the high frequency transistors$ ,F4>4C4>?. 0ere the transistor ,9 ?4/ and au2iliary acts as 0artley (scillator. The other ,9 ?4/ acts as a single stage transistor amplifier. This circuit is consisting of two stages=

+& 0artley (scillator .& "mplifier and coupling stage.

0artley (scillator=
0artley oscillator is very popular and is commonly used as a local oscillator$ which produces continuous undamped oscillations of any desired frequency if tank and feedback circuits are properly connected to it. It has two main advantages viz adaptability to a wide range of frequencies and is easy to tune. The BB D resistors and l uf capacitor are used for biasing purpose. The capacitor ...uf and the inductor are used in an 3. 9. Tank circuit and generate 0.F. carrier signals.

E&C Dept., G.M.I.T, DAVANGERE

.B

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

"mplifier and 9oupling #tage=


The signal which is generated by 0artley (scillator$ which is at low amplitude %0F&$ is fed to the base of amplifying transistor ,9 ?4/. The transistor ,9?4/ controls ,f4>4. The resistor 4@D and capacitor . +uf acts as a 79 timing network which produces 3F tone Frequency which is fed to the base of ,F4>4. This low frequency tone signal is superimposed with 0.F. carrier signal and the output is at the collector of ,F 4>4. To avoid ,F 4>4 acting as a 59 switch$ we insert a timer$ which is nothin g but a capacitor. The timer blocks 59 and acts as a short circuit for hi g h frequency this$ superimposed signal +4 D0z is transmitted through an antenna.

4.".2 R*+*(,*#:

E&C Dept., G.M.I.T, DAVANGERE

.4

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

7eceiver section consists of following stages they are +. .. B. 4. (scillator stage "mplifier stage 6ulse to sound conversion %,ird of crip emulator& 3ight to sound generator

(scillator #tage=
3. (scillators are useful for generating signals from tens of D0z to <0z. "n 3 (scillator consists$ in essence of an amplifying device that gives significant gain between input and output and an 3. network that provides frequency selective of 3.9 network that provides feedback between the output and input terminals of the amplifier. ,ecause of the high frequency selectivity of 3. )- networks$ 3.9 oscillators usually produce reasonably pure sine wave outputs even the loop gain of the circuit is far grater unity and here 3.9 (scillators are in common use. In this :+ %,F 4> 5 & is wired as a common emitter amplifier$ with base bias provides via 74 %..k& and 7B %+BBk& and )th resistor 7? %. & ".9. decoupled via 9? % . .&.The tined collector circuit is formed by 3AlQ 9Al and the signals received by the antenna. 9ollector to base feedback is provided via. 9B and oscillator at a center frequency given by

F N+C. 39

E&C Dept., G.M.I.T, DAVANGERE

.?

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

"mplifier stage=
The common R collector amplifier %also known as the ground collector amplifier or common follower& can be used variety of digital and analog amplifier applications. In the amplifier stage the common collector and emitter amplifier In common collector amplifier @ emitter follower in which the input signal either low %at zero -olts& or high %at a substantial positive value that us not grater than supply rail voltage&. 1hen the low transistor ,9??/ id fully cut off$ and the output is at zero volts. 1hen signal is high :. is () and current I3 flows in load resistor 7S an output voltage across 7 3%+ kO&. Thus the circuit has high inputs and provide unity voltage gain and

when the input signal switches low again :. %,9 ?4/& switches (FF thus unable to sinkT or absorb the charge current of capacitor . %+ kO& product.
This basic principle detailed above can be used as to make an "<

.uf$ which instead has to discharge .uf and 73

via load e2ponentially with a time constant equal to the capacitor .

%"mplitude <odulation& signal radio demodulator by wiring a small capacitor across 73 %+ kO&$ the two components having a time constant that is long compared to the carrier wave time but short compared to the modulation signal time. This demodulated signal is further amplified by the common emitter amplifier$ in the circuit the transistor :B %,9?4/& is wired by with a collector resistor +DO and bias provided via. The resistor +<O and the diode I)4+4/. The operating bias voltage is fired by the base current causes the base current to increase and decrease according to the variations of the input signal current. The resulting the base current has a sinusoidal waveform. The changes in the base current produce correspondingly bigger changes in the collector current. The current flowing through the collector circuit. "lso has a sinusoidal waveform provided the transistor is operated on the liner portion of the characteristics. The sine base current and the sine collector current are in phase.

E&C Dept., G.M.I.T, DAVANGERE

.H

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

P./&* )- &-.%0 +-%,*#&(-% 1B(#0 -# S-.%0 *'./$)-#2:

This stage basically a

multivibrator builds around two silicon transistors :4$:?.The input pulse from the amplifier charges the capacitor BBuFC+H- $rough -7BB %. DO&. 1hen the voltage at point F reaches a sufficient highAlevel :4 L :? are biased and capacitor starts discharging thus a chip is produced. This cycle continues repeatedly at a rate$ which is dependent upon the setting of -7BB %. DO&$ to produce a series of subsequent chips. The signal is again amplified by the transistor :Hand fed to the driver stage through a resistor .DO are the voltage dividers for the base bias capacitor + supply for decoupling from all the stages uFC+H- is shunted across

L(34) O5*#$)*0 P./&* G*%*#$)-#:

0ere a light dependent resistor %357& can be

used with a ??? timer to form pulses. 7esistor in circuits is so adjusted that under normal condition when the light is falling on the photocell$ the voltage across the 357 is less than +CB -99. The actual value of resistor will depend on the resistance of 357 is interrupted= the voltage across it rises above . CB -99 tripping the flipAflop. The output goes low. 1hen the light is restored$ the voltage falls below +CB -99 again tripping the flipA flop causing the output go high.

E&C Dept., G.M.I.T, DAVANGERE

.@

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.6 INTERFACINGS OF HARDWARE CIRCUITS

Fig4.H= 9ircuit 5iagram of microcontroller interfacing. .

E&C Dept., G.M.I.T, DAVANGERE

./

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.6.1 RELAY INTERFACE

Fig4.@= 9ircuit 5iagram of relay interfacing.

E&C Dept., G.M.I.T, DAVANGERE

.>

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

4.@.+.+ (peration=
The circuit diagram shows the connection of 7elay 5river 9ircuit. 1hen the logic signal from the buffer output is applied to base of the transistor through resistor +kohm$ the starts conducting$ it energizes the relay. The transistor acts as a small signal amplifier resistor of +kohm is used to provide proper emitter base voltage to turn the transistor to () state from (FF state. 7elay is an electromechanical switch L it works on the principled energizing an electromagnet. It consists of primary coil$ . contacts one is normally open contact J)(K L the other is normally closed contact J)9KL pole normally identified a common. 1hen relay is in off state the pole is connected to normally closed %)9 contact&.The load is connected to the relay as shown in above circuit diagram. The load may be a fan or dc motor or heater coil$ when transistor starts conducting current starts flowing through the coil. 1hich develops its own magnetic flu2 when the strength of current is suitableQ a sufficient flu2 when produced attracts the pole to make contact with normally open position ')(*. 0ence the load connected to it performs its operation until the contact is broken. " diode connected in parallel across the primary coil is to eliminate the effect of back 4<F on the transistor. 7elays have great application in industry. ;sing the principle of energizing an 4lectromagnet we can handle large voltages L current application.

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

CHAPTER-!

HARDWARE AND SOFTWARE DESCRIPTIONS


!.1 MICROCONTROLLER:
,3(9D 5I"E7"< (F />9?.=

E&C Dept., G.M.I.T, DAVANGERE

B+

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE


P
0 .0

to P

0 .7

2 .0

to P

2 .7

P o r to D r iv e r P o rto L a tc h

P o r to 2 D r iv e r Q u ic k F la s h

RAM ADDR R e g is te r

RAM

B r e g is te r

ACC

S ta c k P o in te r TM P1

P ro g ra m a d d re s s r e g is te r B u ffe r PC In c r e m ent P ro g C o u n te r

TM P2

ALU PSW PSEN ALE / PROG EA /VPP RST IN T , S e r ia l P o r t, & T im e r B lo c k s

T im in g & C o n tro l

IN S T Reg P o r t1 L a tc h P o rt3 L a tc h

DPTR

O SC

P o r t1 D riv e r

P o r t3 D r iv e r

1 .0

to P

1 .7

3 .0

to P

3 .7

Fig?.+= ,lock 5iagram of <icrocontroller

Features=
+. 9ompatible with <9#A?+ T< 6roducts. .. /D byte of in system reAprogrammable flash memory. B. 4ndurance= + write C 4rase cycle. B.

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE 4. Fully static operation. ?. B 3evel program memorial clocks. H. .?H F / bit internal 7"<. @. B. programmable IC( 3ine. /. BA+H bit timerC9ounter. >. /AInterupt #ource. + . 6rogrammable serial channel. ++. 3ow power$ Ideal and 6ower down modes. +.. Four register ,anks each containing / registers

PIN CONFIGURATION OF

78C!2:

E&C Dept., G.M.I.T, DAVANGERE

BB

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

( T 2) P 1 .0 . T 2 (E x ) P 1 .1 P 1 .2 P 1 .3 P 1 .4 P 1 .5 P 1 .6 P 1 .7 RST (R XD) P 3 .0 (T XD) P 3 .1 ( IN T O ) P 3 .2 (IN T 1 ) P 3 .3 . ( T 0) P 3 .4 (T 1) P 3 .5 ( W R ) P 3 .6 (R D ) P 3 .7 X TA L 2 X TA L 1 GND

1 2 3 4 5 6 7 8 9

40

VCC P 0 .0 (A D 0) P 0 .1 (A D 1) P 0 .2 (A D 2) P 0 .3 (A D 3) P 0 .4 (A D 4) P 0 .5 (A D 5) P 0 .6 (A D 6) P 0 .7 (A D 7) EA /VPP ALE /PROG

11 12 13 14 15 16 17 18 19 20

A T M E L 8 9 C 5 2

39 38 37 36 35 34 33 32 31

29 28 27 26 25 24 23 22 21

PSEN P 2 .1 (A 15) P 2 .6 (A 14) P 2 .5 (A 13) P 2 .4 (A 12) P 2 .3 (A 11) P 2 .2 (A 10) P 2 .1 (A 9) P 2 .0 (A 8)

6I) 54#97I6TI() (F />9?.=


6ort = 6ort is an / bit open drain biAdirectional IC( port. 4ach pin can sink / TT3 Input*s. It

can be configured to be multiple2ed low order address C data bus during access to e2ternal program and data memory. 1hen a pin is to be used as an input$ a + must be written to a E&C Dept., G.M.I.T, DAVANGERE B4

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE corresponding port o latch by the program$ thus turning both of the transistors off$ which in turn causes the pin to float in high impedance state$ and the pin is connected to Input buffer. 1hen used as an output the pin latches that are programmed to a will turn on the lower F4T also grounding the pin. "ll latches that are programmed to a + still floatQ thus$ e2ternal pullAup resistors will be needed to supply logic high when using port o as an output. 6ort verification. 6ort += 6ort + is an /Abit biAdirectional IC( port with internal pullAups. The port + output buffers can sinkCsource four TT3 input*s. 1hen +*s are written to port + pin$ they are pulled high by internal pullAups and can be used as Input*s. 6ort + pins that are e2ternally being pulled low will source current in because of the internal pullAups. In addition port +. and port +.+ can be configured to be the timerCcounter . e2ternal count input*s %6+. CT.& and the timer counter . trigger input %6+.+CT.%42&& respectively. 6ort .= 6ort . may be used as an inputCoutput similar in operation to port +. 6ort . emits the high order address byte during fetches from e2ternal program memory and during accesses to e2ternal data memory that use +H bit addresses. In this application$ 6ort . uses strong internal pullAups. 1hen emitting +*s. 5uring e2cesses to e2ternal data memory that / bit address$ 6ort . emits the contents of the 6. #pecial function 7egister. 6ort . also receives the high order address bits and some control signals during flash programming and verification. 6ort B= 6ort B is an inputCoutput port similar to port +. The input and output functions can be programmed under the control of the 6B latches or under the control of various other special function registers. The port B alternate uses are shown in the following table. receives the code bytes during flash programming and output*s the code bytes during program

P-#) P(% 6B. 6B.+ A A 7F5 TF5 A A

A/)*#%$)* F.%+)(-% #erial data input #erial data output B?

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE 6B.. 6B.B 6B.4 6B.? 6B.H 6B.@ A A A A A A I)T( I)T+ T( T+ 17 75 A A A A A A 42ternal Inter 6t ( 42ternal Inter 6t + 42ternal Timer ( I)6;T 42ternal Timer + I)6;T 42ternal 5ata <emory writes pulse 42ternal data <emory 7ead pulse

;nlike port ( and port .$ which can have e2ternal addressing functions and change all eight port bit when in alternate use$ each pin of 6ort B may be individually programmed to be used either as IC( or as one of the alternate functions. 74#4T= " 7eset can be considered to be the ultimate interrupt because the program may not block the action of the voltage on the 7#T pin. This type of interrupt is often called nonA maskable because no combination of bits in any register can stop or mask$ the reset action." reset is an absolute command to jump to program address h and commence running from there. 1hen ever a high level is applied to the 7#T pin the />9?. enters a reset condition. "34 C67(E= "ddress latch enable is an (utput pulse for latching the low byte of the addressing during accesses to e2ternal memory. This pin is also the program pulse Input %67(E& during flash programming. In normal operation$ "34 is emitted at a constant rate of +CH the oscillator frequency and may be used for e2ternal timing or clocking purposes. 0owever that one "34 pulse is skipped during each access to e2ternal data memory. 6#4) = 6rogram store enable is the read strobe to e2ternal program memory. 1hen the />9?. is e2ecuting code from e2ternal program memory. 6#4) is activated twice each machine cycle$ e2cept that two 6#4) activation*s are skipped during each access to e2ternal data memory. E&C Dept., G.M.I.T, DAVANGERE BH

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE 4"C-66= 42ternal access enables. 4" must be strapped to ground in order to enable the device to fetch code from e2ternal program memory location starting at 0 up to FFFF0. 0owever that if lock bit + is programmed. 4" will be internally latched on 7eset. 4" should be strapped to -99 for internal program e2ecutions. ,it 4" is a master or global bit that can enable or disable all of the interrupts. This pin also receives the +. volt programming enable voltage -66 during flash programming when +. volt programming is selected. T and T+= 9ounters and Timers= Timers and +=

<any <icrocontroller applications require the counting of e2ternal event$ such as the frequency of pulse train$ or the generation of precise internal time delays between computer actions. ,oth of these task on be accomplished using software techniques$ but software loops for counting or timing keep the processor occupied so that other$ perhaps more important$ functions are not done. To relive the processor of this burden$ two +H bit up counters$ named T and T+ are provided for general use of the programmer. 4ach counter may be programmed to count internal clock pulses$ acting as timer or programmed to count e2ternal pulse as a counter. The counters are divided into two / bit registers called the timer low T3 $ T3+ and high T0 $ T0+ bytes. "ll counter action is controlled by bit states in the timer mod control register T<(5$ the timerCcounter control register T9() and certain program instructions. Timer .= Timer . is a +H bit timerCcounter that can operate as either a timer or an event counter. The type of operation is selected by bit 9T+. in the #F7*s T.9().

TI<47 . 0"# B (647"TI)E <(54#= +& 9apture mode .& "uto reload mode B& ,aud rate generator mode. E&C Dept., G.M.I.T, DAVANGERE B@

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE The modes are selected by bits in T.9() Timer . 9onsists of two / bit registers T0 . and T3.. In the timer function$ the T3. register is incremented every machine cycle. #ince a machine cycle consists of +. oscillator*s period$ the count rate is +C+. of the oscillator frequency. FT"3I and FT"3.= The heart of the />9?. is the circuitary that generates the clock pulses by which all internal operations are synchronized. 6ins FT"3I and FT"3. are provided for connecting a resonant network to form an (scillator. The 9rystal frequency is the basic internal clock frequency of the microcontroller. The manufacturers make available />9?. designs that can run at specified ma2imum and minimum frequencies. Typically + <0z to +H<hz. <inimum frequency imply that some internal memories are dynamic must always operate above a minimum frequency or data will be lost.

E&C Dept., G.M.I.T, DAVANGERE

B/

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE


C = 82PF 1 8 X TA L 2 C ry s ta l 1 1 .0 5 9 2

19 X TA L 1 C = 82PF

Typically$ a :uartz 9rystal of frequency ++. ?> <0z and capacitors are employed as shown in figure. 0ere + machine cycle consists of H TAstates and each TAstate is of . pulses. To calculate the time for any particular instruction is Eiven by= T %in ts& N 9rystal frequency 1here 9A <achine cycle of the instruction. 9onsider a + byte instruction. If the crystal frequency is ++. ?>. <0z then the time to e2ecute one byte instruction is +. /? microsecond. 92+.d

!.2 !!! TIMERS


E&C Dept., G.M.I.T, DAVANGERE B>

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

Eeneral description=
The )4??? monolithic timing circuit is a highly stable controller capable of producing accurate time delays or oscillation. In the time delay mode of operation$ the time is precisely controlled by one e2ternal resistor and capacitor. For a stable operation as an oscillator$ the free running frequency and the duty cycle are both accurately controlled with two e2ternal resistors and one capacitor. The circuit may be triggered and reset on falling waveforms$ and the output structure can source or sink up to . m". The )4??? is available in plastic and ceramic mini dip package and in an /Alead micro package and in metal can package version.

Features=
3ow turn off time. <a2imum operating

frequency greater than ?

k0z.

Timing from microseconds to hours. (perates in both astable and monostable modes. 0igh output current can source or sink . "djustable duty cycle. TT3 compatible. Temperature stability of . ?! per oc. m"

6in 9onfiguration=

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

"bsolute <a2imum 7atings=


+. #upply voltage%-99& .. (perating temperature ranges B. <a2imum input voltage +/v to @ 9 -99

!.3 UA641 OP-AMP


Eeneral 5escription=
The ;"@4+ is a high performance monolithic operational amplifier constructed on a single silicon chip. It is intended for a wide range of analog applications. +. #umming amplifier .. -oltage 9omparator B. Integrator 4. "ctive filter ?. Function generator. The high gain and wide range of operating voltages provide superior performances in integrator$ summing amplifier and general feedback applications. The internal compensation network %HdbCoctave& insures stability in closed loop circuits.

Features=
3arge input voltage range )o latchAup 0igh gain #hortAcircuit protection )o frequency compensation required. 4+

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

6in configuration=

"bsolute <a2imum 7atings=


+. #upply voltage%-cc& .. 5ifferential input voltage%-id& B. Input voltage%-i& 4. 6ower dissipation%6tot& ?. (perating temperature range A..v to U..v AB v to UB v A+?v to U+?v ? m1 to @ c

E&C Dept., G.M.I.T, DAVANGERE

4.

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

!.4 CD4913BC DUAL D-FLIP FLOP


Eeneral 5escription=
The 954 +B, dual 5Atype flipAflop is a monolithic complementary <(# %9<(#& integrated circuit constructed with ) and 6 channel enhancement mode transistors. 4ach flipAflop has independent data$ set$ reset$ and clock inputs and J:K and J:K outputs. These devices can be used for shift register applications$ and by connecting J:K output to the data input$ for counter and toggle applications. The logic level present at the J5K input is transferred to the : output during the positiveAgoing transition of the clock pulse. #etting or resetting is independent of the clock and is accomplished by a high level on the set or reset line respectively.

Features=
1ide supply voltage range= 0igh noise immunity= 3ow power TT3 9ompatibility= B. - to +?.4? -55 %typ.& fan out of . driving @43 or + driving @43#

"pplications=
"utomotive 5ata terminals Instrumentation <edical electronics "larm system Industrial electronics 7emote metering 9omputers

E&C Dept., G.M.I.T, DAVANGERE

4B

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

"bsolute <a2imum 7atings=


+. 59 #upply -oltage %-55& .. Input -oltage %-I)& B. #torage Temperature 7ange %T#& 4. 6ower 5issipation %65& V .? -59 to U+/ -59 V .? -59 to -55 U .?-59 VH?W9 toU+? W9

5ualAInA3ine #mall (utline ?. 3ead Temperature %T3& %#oldering$ + seconds&

@ ?

m1 m1

.H W9

6in connections=

E&C Dept., G.M.I.T, DAVANGERE

44

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

!.! CD4946BC MONOSTABLE:ASTABLE MULTIVIBRATOR

Eeneral 5escription=
954 4@, is capable of operating in either the monostable or astable mode. It requires an e2ternal capacitor %between pins + and B& and an e2ternal resistor %between pins . and B& to determine the output pulse width in the monostable mode$ and the output frequency in the astable mode. "stable operation is enabled by a high level on the astable input or low level on the astable input. The output frequency %at ? ! duty cycle& at : and : outputs is determined by the timing components. " frequency twice that of : is available at the (scillator (utputQ a ? ! duty cycle is not guaranteed. <onostable operation is obtained when the device is triggered by lowAtoAhigh transition at trigger input or highAtoAlow transition at trigger input. The device can be retriggered E&C Dept., G.M.I.T, DAVANGERE 4?

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE by applying a simultaneous lowAtoAhigh transition to both the trigger and retrigger inputs. " high level on 7eset input resets the outputs : to low$ : to high.

Features=
1ide supply voltage ratings 0igh noise immunity 3ow power TT3 9ompatibility B. - to +?.4? -55 %typ.& Fan out of . driving @43 or + driving @43#

#pecial Features=
3ow power consumption= #pecial 9<(# (scillator 9onfiguration <onostable %oneAshot& or astable %freeArunning& operation True and complemented buffered outputs (nly one e2ternal 7 and 9 required.

<onostable <ultivibrator Features=


+. 6ositiveA or negativeAedge trigger .. (utput pulse width independent of trigger pulse duration B. 7etriggerable option for pulse width e2pansion 4. 3ong pulse widths possible using small 79 components by means of e2ternal counter provision ?. Fast recovery time essentially independent of pulse width H. 6ulseAwidth accuracy maintained at duty cycles approaching + !

"stable <ultivibrator Features=


+. FreeArunning or gatable operating modes E&C Dept., G.M.I.T, DAVANGERE 4H

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE .. ? ! duty cycle B. (scillator output available 4. Eood astable frequency stability Typical Frequency deviation . ! U . B!C 9 X + k0z

.?! U . +?!C 9X+ khz %circuits trimmed to frequency -55 N + -&

"bsolute <a2imum 7atings=


+. .. B. 4. ?. H. @. 59 #upply -oltage %-55& Input -oltage %-I)& #torage Temperature 7ange %T#& 6ower 5issipation %65& 5ualAInA3ine #mall (utline 3ead Temperature %T3& %#oldering$ + seconds& .H 9 @ ? m1 m1 A .?- to U+/-59 A .?- to -55U .?-59 AH?(9 to U+? (9

!." CD4916BC DECADE COUNTER


Eeneral 5escription=
The 954 +@,9 is a ?Astage divide by + 8ohnson counter with + decoded outputs and a carry out bit. These cleared to their zero count by logical J+Kon their reset line these counters are advanced on the positive edge of the clock signal when the clock enable signal is in the logic J Kstate. The configuration of the 954 +@,9 permits E&C Dept., G.M.I.T, DAVANGERE 4@

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE medium speed operation and assures a hazard free counting sequence. The + decoded outputs are normally in the logicK K state and go to the logic J+K state only at their respective time slot. 4ach decoded output remains high for + full clock cycle. The carryout signal completes a full cycle for every + clock input cycles and is used as a ripple carry signal to any succeeding stages.

Features=
+. 1ide supply voltage range B. v to +?v .. 0igh noise immunity .4?vdd%typ& B. 3ow power fan out of . driving 43 4. TT3 compatibility or + driving @43# ?. <edium speed operation ?<0z with + v -55 H. 3ow power + m1 @. Fully static operation

"pplications=
+. "utomotive .. Instrumentation B. <edical electronics 4. "larm systems ?. Industrial electronics H. 7emote metering

!.6 3-TERMINAL 1A POSITIVE VOLTAGE


E&C Dept., G.M.I.T, DAVANGERE 4/

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

REGULATOR1IC 679!2

Eeneral 5escription=
The <9@/FFC3<@/FFC<9@/FF" series of three terminal positive regulators are available in the T(A.. C5A6"D package and with several fi2ed output voltages$ making them useful in a wide range of applications. 4ach type employs internal current limiting$ thermal shut down and safe operating area protection$ making it essentially indestructible. If adequate heat sinking is provided$ they can deliver over +" output current. "lthough designed primarily as fi2ed voltage regulators$ these devices can be used with e2ternal components to obtain adjustable voltages and currents.

Features=
+. .. B. 4. ?. (utput 9urrent up to +". (utput -oltages of ?$ H$ /$ >$ + $ +.$ +?$ +/$ .4-. Thermal (verload 6rotection. #hort 9ircuit 6rotection. (utput Transistor #afe (perating "rea 6rotection.

E&C Dept., G.M.I.T, DAVANGERE

4>

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

!.7 SOFTWARE PROGRAM


org h h

mov p+$ Y ffh mov p.$ Y sjmp start start= mov a$ p+ cjne a$ Y Bh$ loop mov p.$ Y Bh sjmp start loop= cjne a$ Y .h$ loop+ mov p.$ Y ch sjmp start loop+= cjne a$ Y +h$ loop. mov p.$ Y ch sjmp start loop.= cjne a$ Y @h$ start mov p.$ Y ch sjmp start

E&C Dept., G.M.I.T, DAVANGERE

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

!.7.1 FLOW CHART

START

INITIALI;E P1< INPUT P2 < OUTPUT

NO SOIL<9 = YES

NO TEMP< 1 =

TURN OFF THE PUMP

YES

STOP

WATE R<1=

NO

YES TURN ON THE PUMP E&C Dept., G.M.I.T, DAVANGERE ?+

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

CHAPTER-"

APPLICATIONS
9ontrolling irrigation against moisture levels. 6ump protection against temperature and dry running condition. 6esticides control from generating ultrasonic frequency. 1ild animal*s entry can be avoided. 6ump theft can be wirelessly indicated.

FUTURE ENHANCEMENTS

6ump protection against abnormal voltage of the mains. ;sage of solenoid system to avoid the use of many pumps. The system works through solar power.

E&C Dept., G.M.I.T, DAVANGERE

?.

AUTOMATIC MICROCONTROLLER BASED e-AGRICARE

CHAPTER-6

BIBLIOGRAPHY

(perational "mplifier <icrocontroller%/ ?+& 4lectronics for you I9 5ata #heets

,y 7amakanth Eayakwad ,y <azidi %magazines&

E&C Dept., G.M.I.T, DAVANGERE

?B