Вы находитесь на странице: 1из 43

TABLE OF CONTENTS

Abstract

TITLE

1. INTRODUCTION

2. WORKING

2.1 CIRCUIT DIAGRAM

2.2 CIRCUIT DESCRIPTION

2.2.1 COMPONENT LIST

2.2.2 COMPONENT DESRIPTION

2.3 INTRODUCTION TO 8051 CONTROLLER

2.4 BASICS OF CONTROLLER

2.5 BLOCK DIAGRAM OF 8051

2.6 WORKING OF PROJECT

3. PROCEDURE ADOPTED

3.1 PCB DESIGNING

3.2 COMPONENT MOUNTING ON PCB

3.2.1 TOOLS USED

3.3 BURNING HEX CODE TO MICROCONTROLLER

3.3.1 SOFTWARE USED

3.3.2 C PROGRAM FILE

4. APPLICATIONS

5. REFERENCES

6. EXTENTIONS IN THE PROJECT FOR 8th SEMESTER


AUTOMATIC IRRIGATION SYSTEM

ABSTRACT:

In the field of agriculture, use of proper method of irrigation is important because the

main reason is the lack of rains & scarcity of land reservoir water. The continuous extraction of

water from earth is reducing the water level due to which lot of land is coming slowly in the

zones of un-irrigated land. Another very important reason of this is due to unplanned use of

water due to which a significant amount of water goes waste. For this purpose; we use this

automatic plant irrigation system. The system derives power from solar energy through photo-

voltaic cells. Hence, dependency on erratic commercial power is not required.

In this project we use energy which is used to operate the irrigation pump. The circuit

comprises of sensor parts built using op-amp IC. Op-amps are configured here as a comparator.

Two stiff copper wires are inserted in the soil to sense whether the soil is wet or dry. A

microcontroller is used to control the whole system by monitoring the sensors and when sensors

sense dry condition of soil, then the microcontroller will send command to relay driver IC the

contacts of which are used to switch on the motor and it will switch off the motor when the soil

is in wet condition. The microcontroller does the above job as it receives the signal from the

sensors through the output of the comparator, and these signals operate under the control of

software which is stored in ROM of the microcontroller.

Further the project can be enhanced by interfacing it with a GSM modem to gain control

over the switching operation of the motor.


BLOCK DIAGRAM:

POWER SUPPLY

HARDWARE REQUIREMENTS: SOFTWARE REQUIREMENTS:


8051 series Microcontroller, Relay, Keil compiler
Motor, Voltage Regulator, Diodes,
Capacitors, Resistors, LED, Crystal,
Transistors. Languages: Embedded C or Assembly
COMPONENT DESCRIPTION

STEP DOWN TRANSFORMER

Power supply is a reference to a source of electrical power. A device or system that supplies
electrical or other types of energy to an output load or group of loads is called a power
supply unit or PSU. The term is most commonly applied to electrical energy supplies, less
often to mechanical ones, and rarely to others.
Here in our application we need a 5v DC power supply for all electronics involved in the
project. This requires step down transformer, rectifier, voltage regulator, and filter circuit for
generation of 5v DC power. Here a brief description of all the components are given as
follows:

VOLTAGE REGULATOR IC 7805

This is most common voltage regulator that is still used in embedded designs. LM7805 voltage
regulator is a linear regulator made by several manufacturers like Fairchild, or ST
Microelectronics. They can come in several types of packages. For output current up to 1A there
may be two types of packages: TO-220 (vertical) and D-PAK (horizontal).

With proper heat sink these LM78xx types can handle even more than 1A current. They also
have Thermal overload protection, Short circuit protection.
If your design wont exceed 0.1A current you may chose regulator LM78L05 with smaller
packages and lower maximum current up to 0.1A. They come in three main types of packages
SO-8, SOT-89 and TO-92

OP-AMP

An operational amplifier ("op-amp") is a DC-coupled high-gain electronic voltage amplifier


with a differential input and, usually, a single-ended output. An op-amp produces an output
voltage that is typically hundreds of thousands times larger than the voltage difference between
its input terminals.

Operational amplifiers are important building blocks for a wide range of electronic circuits. They
had their origins in analog computers where they were used in many linear, non-linear and
frequency-dependent circuits. Their popularity in circuit design largely stems from the fact that
characteristics of the final op-amp circuits with negative feedback (such as their gain) are set by
external components with little dependence on temperature changes and manufacturing
variations in the op-amp itself.

Op-amps are among the most widely used electronic devices today, being used in a vast array of
consumer, industrial, and scientific devices. Many standard IC op-amps cost only a few cents in
moderate production volume; however some integrated or hybrid operational amplifiers with
special performance specifications may cost over $100 US in small quantities. Op-amps may be
packaged as components, or used as elements of more complex integrated circuits.

The op-amp is one type of differential amplifier. Other types of differential amplifier include the
fully differential amplifier (similar to the op-amp, but with two outputs), the instrumentation
amplifier (usually built from three op-amps), the isolation amplifier (similar to the
instrumentation amplifier, but with tolerance to common-mode voltages that would destroy an
ordinary op-amp), and negative feedback amplifier (usually built from one or more op-amps and
a resistive feedback network).

PIN CONFIGURATION

CIRCUIT NOTATION

V+: non-inverting input


V: inverting input
Vout: output
VS+: positive power supply
VS: negative power supply
CRYSTAL OSCILLATOR

IMAGE SYMBOL

A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a
vibrating crystal of piezoelectric material to create an electrical signal with a very precise
frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to
provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio
transmitters and receivers. The most common type of piezoelectric resonator used is the quartz
crystal, so oscillator circuits designed around them became known as "crystal oscillators."

Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of
megahertz. More than two billion (2109) crystals are manufactured annually. Most are used for
consumer devices such as wristwatches, clocks, radios, computers, and cellphones. Quartz
crystals are also found inside test and measurement equipment, such as counters, signal
generators, and oscilloscopes.

DIODE

SYMBOL
The 1N4007 series (or 1N4000 series) is a family of popular 1.0 amp general purpose silicon
rectifier diodes commonly used in AC adapters for common household appliances. Blocking
voltage varies from 50 to 1000 volts. This diode is made in an axial-lead DO-41 plastic package.

The 1N5400 series is a similarly popular series for higher current applications, up to 3 A. These
diodes come in the larger DO-201 axial package.

These are fairly low-speed rectifier diodes, being inefficient for square waves of more than 15
kHz. The series was second sourced by many manufacturers. The 1N4000 series were in the
Motorola Silicon Rectifier Handbook in 1966, as replacements for 1N2609 through 1N2617. The
1N5400 series were announced in Electrical Design News in 1968, along with the now lesser
known 1.5-ampere 1N5391 series.

These devices are widely used and recommended. The table below shows the maximum
repetitive reverse blocking voltages of each of the members of the 1N4000 and 1N5400 series

IMAGE OF DIODES

LED
A light-emitting diode (LED) is a semiconductor device that emits visible light when an electric
current passes through it. The light is not particularly bright, but in most LEDs it is
monochromatic, occurring at a single wavelength. The output from an LED can range from red
(at a wavelength of approximately 700 nanometers) to blue-violet (about 400 nanometers). Some
LEDs emit infrared (IR) energy (830 nanometers or longer); such a device is known as an
infrared-emitting diode (IRED). An LED or IRED consists of two elements of processed material
called P-type semiconductors and N-type semiconductors. These two elements are placed in
direct contact, forming a region called the P-N junction. In this respect, the LED or IRED
resembles most other diode types, but there are important differences. The LED or IRED has a
transparent package, allowing visible or IR energy to pass through. Also, the LED or IRED has a
large PN-junction area whose shape is tailored to the application.

Benefits of LEDs
Low power requirement: Most types can be operated with battery powersupplies.
High efficiency: Most of the power supplied to an LED or IRED isconverted into radiation in
the desired form, with minimal heat production.
Long life: When properly installed, an LED or IRED can function for
decades.

RESISTOR

A resistor is an electrical component that limits or regulates the flow of electrical current in an
electronic circuit. Resistors can also be used to provide a specific voltage for an active device
such as a transistor. All other factors being equal, in a direct-current (DC) circuit, the current
through a resistor is inversely proportional to its resistance, and directly proportional to the
voltage across it. This is the well-known Ohm's Law. In alternating-current (AC) circuits, this
rule also applies as long as the resistor does not contain inductance or capacitance.
Resistors can be fabricated in a variety of ways. The most common type inelectronic devices and
systems is the carbon-composition resistor. Finegr anulated carbon (graphite) is mixed with clay
and hardened. The resistance depends on the proportion of carbon to clay; the higher this ratio,
the lower the resistance.
Another type of resistor is made from winding Nichrome or similar wire onan insulating form.
This component, called a wire wound resistor, is able to handle higher currents than a carbon-
composition resistor of the same physical size. However, because the wire is wound into a coil,
the component acts as an inductors as well as exhibiting resistance. This does not affect
performance in DC circuits, but can have an adverse effect in AC circuits because inductance
renders the device sensitive to changes in output.

CAPACITOR
A capacitor is a tool consisting of two conductive plates, each of which hosts an opposite charge.
These plates are separated by a dielectric or other form of insulator, which helps them maintain
an electric charge. There are several types of insulators used in capacitors. Examples include
ceramic, polyester, tantalum air, and polystyrene. Other common capacitor insulators include air,
paper, and plastic. Each effectively prevents the plates from touching each other. A capacitor is
often used to store analogue signals and digital data. Another type of capacitor is used in the
telecommunications equipment industry. This type of capacitor is able to adjust the frequency
and tuning of telecommunications equipment and is often referred to a variable capacitor. A
capacitor is also ideal for storing an electron. A capacitor cannot, however, make electrons. A
capacitor measures in voltage, which differs on each of the two interior plates. Both plates of the
capacitor are charged, but the current flows in opposite directions. A capacitor contains 1.5 volts,
which is the same voltage found in a common AA battery. As voltage is used in a capacitor, one
of the two plates becomes filled with a steady flow of current. At the same time, the current
flows away from the other plate. To understand the flow of voltage in a capacitor, it is helpful to
look at naturally occurring examples. Lightning, for example, is similar to a capacitor. The cloud
represents one of the plates and the ground represents the other. The lightning is the charging
factor moving between the ground and the cloud.

IMAGE OF ELECTROLYTIC CAPACITOR


UNPOLARISED / CERAMIC CAPACITORS
A non-polarized ("non polar") capacitor is a type of capacitor that has no implicit polarity -- it
can be connected either way in a circuit. Ceramic, mica and some electrolytic capacitors are non-
polarized. You'll also sometimes hear people call them "bipolar" capacitors.

SYMBOL
IMAGE OF CERAMIC CAPACITOR

STEPPER MOTOR
Motion Control, in electronic terms, means to accurately control the movement of an object
based on either speed, distance, load, inertia or a combination of all these factors. There are
numerous types of motion control systems, including; Stepper Motor, Linear Step Motor, DC
Brush, Brushless, Servo, Brushless Servo and more.
A stepper motor is an electromechanical device which converts electrical pulses into discrete
mechanical movements. Stepper motor is a form of ac. motor .The shaft or spindle of a stepper
motor rotates in discrete step increments when electrical command pulses are applied to it in the
proper sequence. The motors rotation has several direct relationships to these applied input
pulses. The sequence of the applied pulses is directly related to the direction of motor shafts
rotation. The speed of the motor shafts rotation is directly related to the frequency of the input
pulses and the length of rotation is directly related to the number of input pulses applied.
For every input pulse, the motor shaft turns through a specified number of degrees, called
a step. Its working principle is one step rotation for one input pulse. The range of step size may
vary from 0.72 degree to 90 degree. In position control application, if the number of input pulses
sent to the motor is known, the actual position of the driven job can be obtained.
A stepper motor differs from a conventional motor (CM) as under:
a. Input to SM is in the form of electric pulses whereas input to a CM is invariably from a
constant voltage source.
b. A CM has a free running shaft whereas shaft of SM moves through angular steps.
c. In control system applications, no feedback loop is required when SM is used but a
feedback loop is required when CM is used.
d. A SM is a digital electromechanical device whereas a CM is an analog electromechanical
device .
Step Angle & Steps per Revolution
Movement associated with a single step, depends on the internal construction of the motor, in
particular the number of teeth on the stator and the rotor. The step angle is the minimum degree
of rotation associated with a single step.
Step per revolution is the total number of steps needed to rotate one complete rotation or 360
degrees (e.g., 180 steps * 2 degree = 360)
Since the stepper motor is not ordinary motor and has four separate coils, which have to
be energized one by one in a stepwise fashion. We term them as coil A, B, C and D. At a
particular instant the coil A should get supply and then after some delay the coil B should get a
supply and then coil C and then coil D and so on the cycle continues. The more the delay is
introduced between the energizing of the coils the lesser is the speed of the stepper motor and
vice versa.

RELAY
The electromagnetic relay consists of a multi-turn coil, wound on an iron core, to form an
electromagnet. When the coil is energised, by passing current through it, the core becomes
temporarily magnetised. The magnetised core attracts the iron armature. The armature is pivoted
which causes it to operate one or more sets of contacts.When the coil is de-energised the
armature and contacts are released. The coil can be energised from a low power source such as a
transistor while the contacts can switch high powers such as the mains supply. The relay can also
be situated remotely from the control source. Relays can generate a very high voltage across the
coil when switched off.This can damage other components in the circuit. To prevent this a diode
is connected across the coil.
As there are always some chances of high voltage spikes back from the switching circuit i.e.
heater so an optocoupler/isolator MCT2e is used. It provides and electrical isolation between the
microcontroller and the heater. MCT2e is a 6-pin IC with a combination of optical transmitter
LED and an optical receiver as phototransistor. Microcontroller is connected to pin no 2 of
MCT2e through a 470-ohm resistor. Pin no.1 is given +5V supply and pin no.4 is grounded. To
handle the current drawn by the heater a power transistor BC-369 is used as a current driver. Pin
no.5 of optocoupler is connected to the base of transistor. It takes all its output to V cc and
activates the heater through relay circuit. The electromagnetic relay consists of a multi-turn coil,
wound on an iron core, to form an electromagnet. When the coil is energized, by passing current
through it, the core becomes temporarily magnetized. The magnetized core attracts the iron
armature. The armature is pivoted which causes it to operate one or more sets of contacts. When
the coil is de-energised the armature and contacts are released. Relays can generate a very high
voltage across the coil when switched off. This can damage other components in the circuit. To
prevent this a diode is connected across the coil. Relay has five points. Out of the 2 operating
points one is permanently connected to the ground and the other point is connected to the
collector side of the power transistor. When V cc reaches the collector side i.e. signal is given to
the operating points the coil gets magnetized and attracts the iron armature. The iron plate moves
from normally connected (NC) position to normally open (NO) position. Thus the heater gets the
phase signal and is ON. To remove the base leakage voltage when no signal is present a 470-ohm
resistance is used.

ULN 2003A
I. SEVEN DARLINGTONS PER PACKAGE OUTPUT CURRENT 500mA PER
DRIVER
II. (600mA PEAK)
III. OUTPUT VOLTAGE 50V INTEGRATED SUPPRESSION DIODES FOR
IV. INDUCTIVE LOADS OUTPUTS CAN BE PARALLELED FOR HIGHER CURRENT
V. TTL/CMOS/PMOS/DTL COMPATIBLE INPUTS INPUTS PINNED OPPOSITE
OUTPUTS TO SIMPLIFY LAYOUT

DESCRIPTION

PIN CONFIGURATION

The ULN2001A, ULN2002A, ULN2003 andULN2004A are high voltage, high current
darlington
arrays each containing seven open collector darlingtonpairs with common emitters. Each channel
rated at 500mA and can withstand peak currents of 600mA. Suppression diodes are included for
inductive load driving and the inputs are pinned opposite the outputs to simplify board layout.
The four versions interface to all common logic families
a) ULN2001A General Purpose, DTL, TTL, PMOS,CMOS
b) ULN2002A 14-25V PMOS
c) ULN2003A 5V TTL, CMOS
d) ULN2004A 615V CMOS, PMOS
These versatile devices are useful for driving a wide range of loads including solenoids, relays
DC motors, LED displays filament lamps, thermal printheads and high power buffers. The
ULN2001A/2002A/2003A and 2004A are supplied in 16 pin plastic DIP packages with a copper
leadframe to reduce thermal resistance. They are available also in small outline package (SO-16)
as ULN2001D/2002D/2003D/2004D.
INTRODUCTION TO 8051 CONTROLLER
The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited
to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and
Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051
models often have a different form factor, and are not "drop-in compatible". All these things are
called 8051 because they can all be programmed using 8051 assembly language, and they all
share certain features (although the different models all have their own special features).

Some of the features that have made the 8051 popular are:

4 KB on chip program memory.


128 bytes on chip data memory(RAM).
4 reg banks.
128 user defined software flags.
8-bit data bus
16-bit address bus
32 general purpose registers each of 8 bits
16 bit timers (usually 2, but may have more, or less).
3 internal and 2 external interrupts.
Bit as well as byte addressable RAM area of 16 bytes.
Four 8-bit ports, (short models have two 8-bit ports).
16-bit program counter and data pointer.
1 Microsecond instruction cycle with 12 MHz Crystal.

8051 models may also have a number of special, model-specific features, such as UARTs, ADC,
OpAmps, etc...

PIN CONFIGURATION

PIN 9: PIN 9 is the reset pin which is used reset the microcontrollers internal registers and ports
upon starting up. (Pin should be held high for 2 machine cycles.)
PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a
crystal at these pins to provide clock pulses to the circuit.

PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V
500mA to function properly, although there are lower powered versions like the Atmel 2051
which is a scaled down version of the 8051 which runs on +3V.

PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash
memory. In order to program this we need to supply a voltage of +12V at pin 31. If external
memory is connected then PIN 31, also called EA/VPP, should be connected to ground to
indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is
used when multiple memory chips are connected to the controller and only one of them needs to
be selected.We will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is
"program store enable". In order to use the external memory it is required to provide the low
voltage (0) on both PSEN and EA pins.

There are 4 8-bit ports: P0, P1, P2 and P3.

PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for
a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional
functions associated with them based upon the context of their usage.

PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional
functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter
inputs, read and write pins for memory access.

PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no
external memory is present, but if external memory access is required then PORT P2 will act as
an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8-
A15, as can be seen from fig 1.1

PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external
memory is present, but if external memory access is required then PORT P0 acts as a
multiplexed address and data bus that can be used to access external memory in conjunction with
PORT P2. P0 acts as AD0-AD7,

PIN DIAGRAM

BASICS OF CONTROLLER

Before actually going through this tutorial let me tell you something about number systems used
in Computer Systems. As you know human know the decimal number system 1,2,3---9, but how
will computer understand our language hence we use binary system which uses 0 & 1.
Computers understand the language of 0 & 1. We also have a hexadecimal system which is
nothing but a way of representing a binary number. Similarly we have a ASCII System for
information sharing between computers.

Memory inside computer system: There are Basically two types of memories RAM & ROM.
RAM as you know is Random Access Memory and data stored in it is temporary whereas ROM
is read only memory and data stored in it is permanent. CPU (Central Processing Unit is
combination of ALU Arithmetic Logic Unit & Control Unit. The A.L.U. (Arithmetic and Logic
Unit) performs all the calculations.

BLOCK DIAGRAM
Data and Program Memory
The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number of
other high-level languages. Many compilers even have support for compiling C++ for an
8051.Program memory in the 8051 is read-only, while the data memory is considered to be
read/write accessible. When stored on EEPROM or Flash, the program memory can be rewritten
when the microcontroller is in the special programmer circuit.
Program Start Address
The 8051 starts executing program instructions from address 0000 in the program memory.
Direct Memory
The 8051 has 256 bytes of internal addressable RAM, although only the first 128 bytes are
available for general use by the programmer. The first 128 bytes of RAM (from 0x00 to 0x7F)
are called the Direct Memory, and can be used to store data.
Special Function Register
The Special Function Register (SFR) is the upper area of addressable memory, from address
0x80 to 0xFF. A, B, PSW, DPTR are called SFR.This area of memory cannot be used for data or
program storage, but is instead a series of memory-mapped ports and registers. All port input and
output can therefore be performed by memory mov operations on specified addresses in the SFR.
Also, different status registers are mapped into the SFR, for use in checking the status of the
8051, and changing some operational parameters of the 8051.

General Purpose Registers

The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that there
are essentially 32 available general purpose registers, although only 8 (one bank) can be directly
accessed at a time. To access the other banks, we need to change the current bank number in the
flag status register.
A and B Registers

The A register is located in the SFR memory location 0xE0. The A register works in a similar
fashion to the AX register of x86 processors. The A register is called the accumulator, and by
default it receives the result of all arithmetic operations. The B register is used in a similar
manner, except that it can receive the extended answers from the multiply and divide operations.
When not being used for multiplication and Division, the B register is available as an extra
general-purpose register.

BLOCK DIGRAM OF 8051 CONTROLLER


WORKING OF PROJECT

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. The high signsl(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 angle (i.e. 90 ,180 ,270) by using stepper 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 uc 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 uc starts sensing the signal at
PORT 2. Whenever there is signal at any pin the uc repeats the above process. So this process
continues & we get the automatic irrigation the fields by using intelligent device uc 8051.
PROCEDURE ADOPTED
PCB DESIGNING
STEPS TO DESIGN PCB
1. LAYOUT PREPARATION
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.
2. LAYOUT IMPRESSION ON CLAD BORD
Take the impression of layout on Clad board using carbon paper or electric iron.
3. ETCHING
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.
4. TESTING
Now test the tracks using multimeter.
5. DRILLING/PUNCHING
Now drill the required holes for component mounting.
COMPONENTS MOUNTING ON PCB

TOOLS USED:
Soldering iron

A soldering iron 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.

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
Small tweezer is used to hold small components especially when doing soldering and de-
soldering of surface mount components.

SOFTWARE REQUIREMENTS

5.1 INTRODUCTION TO KEIL MICRO VISION (IDE)


Keil an ARM Company makes C compilers, macro assemblers, real-time kernels, debuggers,
simulators, integrated environments, evaluation boards, and emulators for ARM7/ARM9/Cortex-
M3, XC16x/C16x/ST10, 251, and 8051 MCU families.
Keil development tools for the 8051 Microcontroller Architecture support every level of
software developer from the professional applications engineer to the student just learning about
embedded software development. 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.
Keil is a cross compiler. So first we have to understand the concept of compilers and
cross compilers. After then we shall learn how to work with keil.

5.2 CONCEPT OF COMPILER


Compilers are programs used to convert a High Level Language to object code. Desktop
compilers produce an output object code for the underlying microprocessor, but not for other
microprocessors. I.E the programs written in one of the HLL like C will compile the code to
run on the system for a particular processor like x86 (underlying microprocessor in the
computer). For example compilers for Dos platform is different from the Compilers for Unix
platform So if one wants to define a compiler then compiler is a program that translates source
code into object code.
The compiler derives its name from the way it works, looking at the entire piece of
source code and collecting and reorganizing the instruction. See there is a bit little difference
between compiler and an interpreter. Interpreter just interprets whole program at a time while
compiler analyses and execute each line of source code in succession, without looking at the
entire program.
The advantage of interpreters is that they can execute a program immediately. Secondly
programs produced by compilers run much faster than the same programs executed by an
interpreter. However compilers require some time before an executable program emerges. Now
as compilers translate source code into object code, which is unique for each type of computer,
many compilers are available for the same language.

5.3 CONCEPT OF CROSS COMPILER


A cross compiler is similar to the compilers but we write a program for the target
processor (like 8051 and its derivatives) on the host processors (like computer of x86). It means
being in one environment you are writing a code for another environment is called cross
development. And the compiler used for cross development is called cross compiler. So the
definition of cross compiler is a compiler that runs on one computer but produces object code for
a different type of computer.

5.4 KEIL C CROSS COMPILER


Keil is a German based Software development company. It provides several development
tools like
IDE (Integrated Development environment)
Project Manager
Simulator
Debugger
C Cross Compiler, Cross Assembler, Locator/Linker
The Keil ARM tool kit includes three main tools, assembler, compiler and linker. An assembler
is used to assemble the ARM assembly program. A compiler is used to compile the C source
code into an object file. A linker is used to create an absolute object module suitable for our in-
circuit emulator.

5.5 Building an Application in Vision2


To build (compile, assemble, and link) an application in Vision2, you must:
1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2).
2. Select Project - Rebuild all target files or Build target.Vision2 compiles, assembles,
and links the files in your project.

5.6 Creating Your Own Application in Vision2


To create a new project in Vision2, you must:
1. Select Project - New Project.
2. Select a directory and enter the name of the project file.
3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the
Device Database.
4. Create source files to add to the project.
5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the
source files to the project.
6. Select Project - Options and set the tool options. Note when you select the target device
from the Device Database all special options are set automatically. You typically only need to
configure the memory map of your target hardware. Default memory model settings are optimal
for most applications.
7. Select Project - Rebuild all target files or Build target.

5.7 Debugging an Application in Vision2


To debug an application created using Vision2, you must:
1. Select Debug - Start/Stop Debug Session.
2. Use the Step toolbar buttons to single-step through your program. You may enter G, main
in the Output Window to execute to the main C function.
3. Open the Serial Window using the Serial #1 button on the toolbar.
Debug your program using standard options like Step, Go, Break, and so on.

5.8 Starting Vision2 and Creating a Project


Vision2 is a standard Windows application and started by clicking on the program icon. To
create a new project file select from the Vision2 menu Project New Project. This opens a
standard Windows dialog that asks you for the new project file name. We suggest that you use a
separate folder for each project. You can simply use the icon Create New Folder in this dialog to
get a new empty folder. Then select this folder and enter the file name for the new project, i.e.
Project1. Vision2 creates a new project file with the name PROJECT1.UV2 which contains a
default target and file group name. You can see these names in the Project.

5.9 Window Files.


Now use from the menu Project Select Device for Target and select a CPU for your project.
The Select Device dialog box shows the Vision2 device data base. Just select the
microcontroller you use. We are using for our examples the Philips 80C51RD+ CPU. This
selection sets necessary tool Options for the 80C51RD+ device and simplifies in this way the
tool Configuration.

5.10 Building Projects and Creating a HEX Files


Typical, the tool settings under Options Target are all you need to start a new application. You
may translate all source files and line the application with a click on the Build Target toolbar
icon. When you build an application with syntax errors, Vision2 will display errors and
warning messages in the Output Window Build page. A double click on a message line opens
the source file on the correct location in a Vision2 editor window. Once you have successfully
generated your application you can start debugging.
After you have tested your application, it is required to create an Intel HEX file to download the
software into an EPROM programmer or simulator. Vision2 creates HEX files with each build
process when Create HEX files under Options for Target Output is enabled. You may start
your PROM programming utility after the make process when you specify the program under the
option Run User Program #1.

5.11 CPU Simulation


Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write,
or code execution access. The Vision2 simulator traps
and reports illegal memory accesses. In addition to memory mapping, the simulator also provides
support for the integrated peripherals of the various 8051 derivatives. The on-chip peripherals of
the CPU you have selected are configured from the Device.

5.12 Database selection


You have made when you create your project target. Refer to page 58 for more Information
about selecting a device. You may select and display the on-chip peripheral components using
the Debug menu. You can also change the aspects of each peripheral using the controls in the
dialog boxes.

5.13 Start Debugging


You start the debug mode of Vision2 with the Debug Start/Stop Debug
Session Command. Depending on the Options for Target Debug Configuration, Vision2 will
load the application program and run the startup code Vision2 saves the editor screen layout
and restores the screen layout of the last debug session. If the program execution stops, Vision2
opens an editor window with the source text or shows CPU instructions in the disassembly
window. The next executable statement is marked with a yellow arrow. During debugging, most
editor features are still available.
For example, you can use the find command or correct program errors. Program source text of
your application is shown in the same windows. The Vision2 debug mode differs from the edit
mode in the following aspects:
_ The Debug Menu and Debug Commands described on page 28 are available. The additional
debug windows are discussed in the following.
_ The project structure or tool parameters cannot be modified. All build commands are disabled.

5.14 Disassembly Window


The Disassembly window shows your target program as mixed source and assembly program or
just assembly code. A trace history of previously executed instructions may be displayed with
Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace
Recording.
If you select the Disassembly Window as the active window all program step commands work
on CPU instruction level rather than program source lines. You can select a text line and set or
modify code breakpoints using toolbar buttons or the context menu commands.
You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allows
you to correct mistakes or to make temporary changes to the target program you are debugging.
Numerous example programs are included to help you get started with the most popular
embedded 8051 devices.

The Keil Vision Debugger accurately simulates on-chip peripherals (IC, 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.

5.15 EMBEDDED C
Use of embedded processors in passenger cars, mobile phones, medical equipment,
aerospace systems and defense systems is widespread, and even everyday domestic appliances
such as dish washers, televisions, washing machines and video recorders now include at least one
such device.
Because most embedded projects have severe cost constraints, they tend to use low-cost
processors like the 8051 family of devices considered in this book. These popular chips have
very limited resources available most such devices have around 256 bytes (not megabytes!) of
RAM, and the available processor power is around 1000 times less than that of a desktop
processor. As a result, developing embedded software presents significant new challenges, even
for experienced desktop programmers. If you have some programming experience - in C, C++
or Java - then this book and its accompanying CD will help make your move to the embedded
world as quick and painless as possible.
COMPILER

1. Click on the Keil Vision Icon on Desktop


2. The following fig will appear

3. Click on the Project menu from the title bar


4. Then Click on New Project
5. Save the Project by typing suitable project name with no extension in u r own folder
sited in either C:\ or D:\

6. Then Click on Save button above.


7. Select the component for u r project. i.e. Atmel
8. Click on the + Symbol beside of Atmel
9. Select AT89C51 as shown below

10. Then Click on OK


11. The Following fig will appear
12. Then Click either YES or NOmostly NO.
13. Now your project is ready to USE.
14. Now double click on the Target1, you would get another option Source group 1 as
shown in next page.

15. Click on the file option from menu bar and select new.
16. The next screen will be as shown in next page, and just maximize it by double
clicking on its blue boarder.

17. Now start writing program in either in EMBEDDED C or ASM.


18. For a program written in Assembly, then save it with extension . asm and for
EMBEDDED C based program save it with extension .C
19. Now right click on Source group 1 and click on Add files to Group Source.

20. Now you will get another window, on which by default EMBEDDED C files will
appear.
21. Now select as per your file extension given while saving the file
22. Click only one time on option ADD.

23. Now Press function key F7 to compile. Any error will appear if so happen.

24. If the file contains no error, then press Control+F5 simultaneously.


25. The new window is as follows
26. Then Click OK.

27. Now click on the Peripherals from menu bar, and check your required port as shown
in fig below.

28. Drag the port a side and click in the program file.
29. Now keep Pressing function key F11 slowly and observe.
30. You are running your program successfully.

9. HARDWARE TESTING

9.1 CONTINUITY TEST:


In electronics, a continuity test is the checking of an electric circuit to see if current flows (that it
is in fact a complete circuit). A continuity test is performed by placing a small voltage (wired in
series with an LED or noise-producing component such as a piezoelectric speaker) across the
chosen path. If electron flow is inhibited by broken conductors, damaged components, or
excessive resistance, the circuit is "open".
Devices that can be used to perform continuity tests include multi meters which measure current
and specialized continuity testers which are cheaper, more basic devices, generally with a simple
light bulb that lights up when current flows.
An important application is the continuity test of a bundle of wires so as to find the two ends
belonging to a particular one of these wires; there will be a negligible resistance between the
"right" ends, and only between the "right" ends.
This test is the performed just after the hardware soldering and configuration has been
completed. This test aims at finding any electrical open paths in the circuit after the soldering.
Many a times, the electrical continuity in the circuit is lost due to improper soldering, wrong and
rough handling of the PCB, improper usage of the soldering iron, component failures and
presence of bugs in the circuit diagram. We use a multi meter to perform this test. We keep the
multi meter in buzzer mode and connect the ground terminal of the multi meter to the ground.
We connect both the terminals across the path that needs to be checked. If there is continuation
then you will hear the beep sound.

9.2 POWER ON TEST:


This test is performed to check whether the voltage at different terminals is according to the
requirement or not. We take a multi meter and put it in voltage mode. Remember that this test is
performed without microcontroller. Firstly, we check the output of the transformer, whether we
get the required 12 v AC voltage.

Then we apply this voltage to the power supply circuit. Note that we do this test without
microcontroller because if there is any excessive voltage, this may lead to damaging the
controller. We check for the input to the voltage regulator i.e., are we getting an input of 12v and
an output of 5v. This 5v output is given to the microcontrollers 40 th pin. Hence we check for the
voltage level at 40th pin. Similarly, we check for the other terminals for the required voltage. In
this way we can assure that the voltage at all the terminals is as per the requirement.
C PROGRAM FILE
#include<reg51.h>
sfr lcd_data_pin=0xA0; // data port P2
sbit rs=P1^0; // Register select pin
sbit rw=P1^1; // Read write pin
sbit en=P1^2; // Enable pin
sbit in=P1^3;
sbit relay=P1^4;

void delay(unsigned int msec) //delay function


{
int i,j;
for(i=0;i<msec;i++)
for(j=0;j<1275;j++);
}
void lcd_command(unsigned char comm) // function to send command to LCD
{
lcd_data_pin=comm;
en=1;
rs=0;
rw=0;
delay(1);
en=0;
}
void lcd_data(unsigned char disp) // function to send data on LCD
{
lcd_data_pin=disp;
en=1;
rs=1;
rw=0;
delay(1);
en=0;
}

lcd_dataa(unsigned char *disp) // function to send string to LCD


{
int x;
for(x=0;disp[x]!=0;x++)
{
lcd_data(disp[x]);

}
}

void lcd_ini() //Function to inisialize the LCD


{
lcd_command(0x38);
delay(5);
lcd_command(0x0F);
delay(5);
lcd_command(0x0C);
delay(5);
lcd_command(0x01);
delay(5);

}
void main()
{
lcd_ini();
lcd_command(0x83);
delay(5);
lcd_dataa("AUTOMATIC");
lcd_command(0xC3);
delay(5);
lcd_dataa("IRRIGATION");
delay(500);
lcd_command(0x01);
delay(5);

while(1)
{
if(in==1)
{
relay=1;
lcd_command(0x80);
delay(5);
lcd_dataa("low moisture");
lcd_command(0xc0);
delay(5);
lcd_dataa("MOTOR on");
}
else
{
relay=0;
lcd_command(0x80);
delay(5);
lcd_dataa("good moisture");
lcd_command(0xc0);
delay(5);
lcd_dataa("MOTOR off");
}
}}
APPLICATIONS

1.IRRIGATION IN FIELDS.
2.IRRIGATION IN GARDENS,PARKS.
3.VERY EFFICIENT FOR PADDY(RICE) FIELDS.
4.PICSICULTURE.

BIBLIOGRAPHY

TEXT BOOKS REFERED:


1. The 8051 Microcontroller and Embedded systems by Muhammad Ali Mazidi and Janice
Gillispie Mazidi, Pearson Education.
2. ATMEL 89S52 Data Sheets.

WEBSITES
www.atmel.com
www.beyondlogic.org
www.wikipedia.org
www.howstuffworks.com
www.alldatasheets.com

Вам также может понравиться