PROJECT Water Level

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 61

Automatic Water Level Controller using AT89C51 Micro

Controller

Submitted to Jawaharlal Nehru Technological University, Kakinada in partial fulfillment of


requirement for the degree of
Bachelor of Technology
in
ELECTRONICS AND COMMUNICATION ENGINEERING

Submitted by
Munnaluri Leela Bharathi Likhitha
(18KN1A0435)
Bondili Anvitha Nallamopu Deepthi Shaik Baba Khan
(18KN1A0407) (18KN1A0437) (18KN1A0451)

Under the guidance of


Mr. S.V. Rama Rao
Associate Professor, M.Tech.

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING


NRI INSTITUTE OF TECHNOLOGY
(Autonomous)
(Approved by A.I.C.T.E & Affiliated to Jawaharlal Nehru Technological University
Kakinada)
(Accredited by NAAC with ‘A’ Grade, ISO 9001: 2015 Certified)
Agiripalli (M), Pothavarapadu (V), Krishna (DT)-521212.
2021-2022
Automatic Water Level Controller using AT89S52 Micro
Controller

ABSTRACT:
In this project, we are going to design a water level sensor device that is able to detect
and control the level of water in a certain water tank or a similar water storage system. The
system firstly senses the amount of water available in the tank by the level detector sensor
and then adjusts the state of the water pump in accordance to the water level information.
This electronic design achieves automation through a relay-based motor pump driving circuit
are part of this integrated design. The water pump automatically turns on and starts filling the
tank when the water level is empty or level one and turned-off and stop filling the tank when
water level reaches maximum-level five; furthermore, the water pump will remain in its
standstill state from level four down to two when the level is decreasing due to water
consumption.
CHAPTER-1

INTRODUCTION

INTRODUCTION

Existing System:

A water level detector tells the control panel to take necessary actions. This work is to be
done manually. Even though we use buzzer that is just useful for indication. Using of buzzer
does not reduce electric power instead physical work is required to OFF the switch. Whereas
in water level controller just sensors are enough to fulfill all the requirements.
CHAPTER-2

PROPOSED SYSTEM

Block Diagram:

LED-1
Power supply LED-2
LED-3
LED-4
AT89C51 LED-5
AT89C51

Micro Controller

full Relay

3/4

1/2 Overhead
tank Motor
1/4

Sump Tank

Fig. Block Diagram of Automatic Water Level Controller

Procedure to go about the logic : The level sensor probes for the overhead tank are interfaced
to the port 2 of the microcontroller through transistors. Have a look at the sensor probe
arrangement for the overhead tank in Fig1. A positive voltage supply probe goes to the down bottom
of the tank. The probes for sensing 1/4, 1/2, 3/4 and FULL levels are placed with equal spacing one
by one above the bottom positive probe. Consider the topmost (full level) probe, its other end is
connected to the base of transistor Q4 through resistor R16. Whenever water rises to the full level
current flows into the base of transistor Q4 which makes it ON and so its collector voltage goes low.
The collector of Q4 is connected to P2.4 and a low voltage at P2.4 means the overhead tank is not
FULL. When water level goes below the full level probe, the base of Q2 becomes open making it OFF.
Now its collector voltage goes high and high at P2.4 means the tank is not full. The same applies to
other sensor probes (3/4, 1/2, 1/4) and the microprocessor understands the current level by
scanning the port pins P2.4 ,P2.5, P2.6 and P2.7. All these port pin are high (all sensor probes are
open) means the tank is empty. Port pin P0.5 is used to control the pump. Whenever it is required
start pumping, the controller makes P0.5 low which makes transistor Q6 ON which in turn activates
the relay K1 that switches the pump. Also the LED d6 glows indicating the motor is ON. LED D7 is the
low sump indicator. When the water level in the sump tank goes low, the controller makes P0.7 low
which makes LED D7 to glow. The circuit diagram of the water level controller is shown in the figure
below
Hardware Required:

 Power Supply(+5V)
 Relay(Dual Pole Double Throw)
 Motor(DC)
 AT89S52 Micro Controller

Software Required:

 Keil Software( μVision’5)

Advantages:

 It is an Economical System that requires very less Maintenance.


 To avoid wastage of water.
 Human effort is reduced as the system controls the motor automatically based on the
water level.

Limitation:

 Water level controls need to be replaced every 3 years due to formation of rust.

Applications:

 This system is very beneficial in rural as well as urban areas.


 It helps in the efficient utilization of available water sources.
 If it is used on a large scale, it can provide a major contribution in the conservation of
water for us and the future generations.
CHAPTER-3
HARDWARE DESCRIPTION

MICRO CONTROLLERS

Microprocessors vs. Microcontrollers:

• Microprocessors are single-chip CPUs used in microcomputers.

• Microcontrollers and microprocessors are different in three main aspects: hardware


architecture, applications, and instruction set features.

• Hardware architecture: A microprocessor is a single chip CPU while a microcontroller is a single IC


contains a CPU and much of remaining circuitry of a complete computer (e.g., RAM, ROM, serial
interface, parallel interface, timer, interrupt handling circuit).

• Applications: Microprocessors are commonly used as a CPU in computers while microcontrollers


are found in small, minimum component designs performing control oriented activities.

• Microprocessor instruction sets are processing Intensive.

• Their instructions operate on nibbles, bytes, words, or even double words.


• Addressing modes provide access to large arrays of data using pointers and offsets.

• They have instructions to set and clear individual bits and perform bit operations.

• They have instructions for input/output operations, event timing, enabling and setting priority
levels for interrupts caused by external stimuli.

• Processing power of a microcontroller is much less than a microprocessor.

Difference between 8051 and 8052:

The 8052 microcontroller is the 8051's "big brother." It is a


slightly more powerful microcontroller, sporting a number of
additional features which the developer may make use of:

 256 bytes of Internal RAM (compared to 128 in the standard 8051).


 A third 16-bit timer, capable of a number of new operation modes and 16-bit reloads.
 Additional SFRs to support the functionality offered by the third timer.

AT89S52:

Features:

• Compatible with MCS-51 Products

• 8K Bytes of In-System Programmable (ISP) Flash Memory

– Endurance: 1000 Write/Erase Cycles

• 4.0V to 5.5V Operating Range

• Fully Static Operation: 0 Hz to 33 MHz

• Three-level Program Memory Lock


• 256K Internal RAM

• 32 Programmable I/O Lines

• 3 16-bit Timer/Counters

• Eight Interrupt Sources

• Full Duplex UART Serial Channel

• Low-power Idle and Power-down Modes

• Interrupt Recovery from Power-down Mode

• Watchdog Timer

• Dual Data Pointer

• Power-off Flag

DESCRIPTION OF MICROCONTROLLER 89S52:

The AT89S52 is a low-power, high-performance CMOS 8-bit micro controller


with 8Kbytes of in-system programmable Flash memory. The device is manufactured

Using Atmel’s high-density nonvolatile memory technology and is compatible


with the industry-standard 80C51 micro controller. The on-chip Flash allows the
program memory to be reprogrammed in-system or by a conventional nonvolatile
memory programmer. By combining a versatile 8-bit CPU with in-system programmable
flash one monolithic chip; the Atmel AT89S52 is a powerful micro controller, which
provides a highly flexible and cost-effective solution to many embedded control
applications.
The AT89S52 provides the following standard features: 8K bytes of Flash, 256
bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit
timer/counters, full duplex serial port, on-chip oscillator, and clock circuitry. In addition,
the AT89S52 is designed with static logic for perationdown to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU
while allowing the RAM timer/counters, serial port, and interrupt system to continue
functioning. The Power-down mode saves the RAM contents but freezes the oscillator,
disabling all other chip functions until the next interrupt

Or hardware reset.

PIN DESCRIPTION OF MICROCONTROLLER 89S52

VCC

Supply voltage.

GND

Ground.

Port 0

Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1sare 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 program and 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. External pull-ups are required
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. 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, as shown in


the following table. Port 1 also receives the low-order address bytes during Flash
programming and verification.
Port 2

Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pull-ups and can be used as inputs. Port 2 emits the high-
order address byte during fetches from external program memory and during accesses
to external data memory that use 16-bit addresses (MOVX @DPTR). In this application,
Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data
memory that use 8-bit addresses (MOVX @ RI), Port 2emits the contents of the P2
Special Function Register. Port 2 also receives the high-order address bits and some
control signals during Flash programming and verification.

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 writt 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 AT89S52, as shown in the following table.

Port 3 also receives some control signals for Flash programming

And 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 (ALE) is an output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during Flash
programming. In normal operation, ALE is emitted at a constant rate of1/6 the oscillator frequency
and may be used for external timing or clocking purposes. Note, however, that 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 micro
controller is in external execution mode.

PSEN

Program Store Enable (PSEN) is the read strobe to external program memory.
When the AT89S52 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. EA must be strapped to GND in order to enable the device
to fetch code from external program memory locations starting at 0000H up to
FFFFH.Note, however, that if lock bit 1 is programmed, EA will be internally latched on
reset. A should be strapped to VCC for internal program executions. This pin also
receives the 12-voltProgramming enables voltage (VPP) during Flash programming.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating
circuit.

XTAL2

Output from the inverting oscillator amplifier.

Oscillator Characteristics

XTAL1 and XTAL2 are the input and output, respectively, of an inverting
amplifier that can be configured for use as an on-chip oscillator, as shown in Figure 1.
Either a quartz crystal or ceramic resonator may be used. To drive the device from an
External clock source, XTAL2 should be left unconnected while XTAL1 is driven, as
shown in Figure 2.
Figure 1. Oscillator Connections

Special Function Register (SFR) Memory: -

Special Function Registers (SFR s) are areas of memory that control specific
functionality of the 8051 processor. For example, four SFRs permit access to the 8051’s
32 input/output lines. Another SFR allows the user to set the serial baud rate, control
and access timers, and configure the 8051’s interrupt system.

The Accumulator: The Accumulator, as its name suggests is used as a general


register to accumulate the results of a large number of instructions. It can hold 8-bit (1-
byte) value and is the most versatile register.

The “R” registers: The “R” registers are a set of eight registers that are named R0, R1.
Etc up to R7. These registers are used as auxiliary registers in many operations.

The “B” registers: The “B” register is very similar to the accumulator in the sense that
it may hold an 8-bit (1-byte) value. Two only uses the “B” register 8051 instructions:
MUL AB and DIV AB.

The Data Pointer: The Data pointer (DPTR) is the 8051’s only user accessible 16-bit
(2Bytes) register. The accumulator, “R” registers are all 1-Byte values. DPTR, as the
name suggests, is used to point to data. It is used by a number of commands, which
allow the 8051 to access external memory.

THE PROGRAM COUNTER AND STACK POINTER:

The program counter (PC) is a 2-byte address, which tells the 8051 where the next
instruction to execute is found in memory. The stack pointer like all registers except DPTR and PC
may hold an 8-bit (1-Byte) value

ADDRESSING MODES:

An “addressing mode” refers that you are addressing a given memory location. In
summary, the addressing modes are as follows, with an example of each:

Each of these addressing modes provides important flexibility.

Immediate Addressing MOV A, #20 H

Direct Addressing MOV A, 30 H

Indirect Addressing MOV A, @R0

Indexed Addressing

a. External Direct MOVX A, @DPTR

b. Code In direct MOVC A, @A+DPTR

Immediate Addressing:

Immediate addressing is so named because the value to be stored in


memory immediately follows the operation code in memory. That is to say, the
instruction itself dictates what value will be stored in memory. For example, the
instruction:

MOV A, #20H:

This instruction uses immediate Addressing because the accumulator will be


loaded with the value that immediately follows in this case 20(hexadecimal). Immediate
addressing is very fast since the value to be loaded is included in the instruction.
However, since the value to be loaded is fixed at compile-time it is not very flexible.

Direct Addressing:

Direct addressing is so named because the value to be stored in memory is


obtained by directly retrieving it from another memory location.

For example:

MOV A, 30h

This instruction will read the data out of internal RAM address 30(hexadecimal)
and store it in the Accumulator. Direct addressing is generally fast since, although the
value to be loaded isn’t included in the instruction, it is quickly accessible since it is
stored in the 8051’s internal RAM. It is also much more flexible than Immediate
Addressing since the value to be loaded is whatever is found at the given address
which may variable.

Also it is important to note that when using direct addressing any instruction
that refers to an address between 00h and 7Fh is referring to the SFR control registers
that control the 8051 micro controller itself.

Indirect Addressing:

Indirect addressing is a very powerful addressing mode, which in many cases


provides an exceptional level of flexibility. Indirect addressing is also the only way to
access the extra 128 bytes of internal RAM found on the 8052. Indirect addressing
appears as follows:

MOV A, @R0:

This instruction causes the 8051 to analyze Special Function Register (SFR)
Memory:
Special Function Registers (SFRs) are areas of memory that control specific
functionality of the 8051 processor. For example, four SFRs permit access to the 8051’s
32 input/output lines. Another SFR allows the user to set the serial baud rate, control
and access timers, and configure the 8051’s interrupt system.

Timer 2 Registers:
Control and status bits are contained in registers T2CON and T2MOD for Timer
2 . The register pair (RCAP2H , RCAP2L) are the Capture / Reload registers for Timer
2 in 16-bit capture mode or 16-bit auto-reload mode .
Interrupt Registers:
The individual interrupt enable bits are in the IE registe . Two priorities can be set
for each of the six interrupt sources in the IP register.

Timer 2
Timer 2 is a 16-bit Timer / Counter that can operate as either a timer or an event
counter. The type of operation is selected by bit C/T2 in
the SFR T2CON . Timer 2 has three operating Modes : capture , auto-reload ( up or
down Counting ) , and baud rate generator . The modes are selected by bits in
T2CON . Timer 2 consists of two 8-bit registers , TH2 and TL2 . In the Timer
function , the TL2 register is incremented every machine cycle . Since a machine
cycle consists
of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency.In the
Counter function , the register is incremented in response to a 1-to-0 transition at its
corresponding external input pin , T2 .When the samples show a high in one cycle
and a low in the next cycle, the count is incremented . Since two machine cycles (24
Oscillator periods ) are required to recognize 1-to-0 transition , the maximum count
rate is 1 / 24 of the oscillator frequency . To ensure that a given level is sampled
at least once before it changes , the level should be held for atleast one full
machine cycle .
Capture Mode
In the capture mode , two options are selected by bit EXEN2 in T2CON . If EXEN2 =
0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON
. This bit can then be used to generate an interrupt . If EXEN2 = 1 , Timer 2 performs
the same operation , but a 1-to-0 transition at external input T2EX also causes the
current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L ,
respectively
Auto-reload (Up or Down Counter)
Timer 2 can be programmed to count up or down when configured in its 16-bit auto-
reload mode. This feature is invoked by the DCEN
(Down Counter Enable) bit located in the SFR T2MOD . Upon reset , the DCEN bit is set to 0
so that timer 2 will default to count up. When DCEN is set , Timer 2
can count up or down , depending on the value of the T2EX pin . In this mode , two options
are selected by bit EXEN2 in T2CON . If EXEN2 = 0 , Timer 2 counts up to 0FFFFH and then
sets the TF2 bit upon overflow . If EXEN2 = 1 , a 16-bit
reload can be triggered either by an overflow or by a 1-to-0 transition at external
input T2EX.
Baud Rate Generator
Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in
T2CON . Note that the baud rates for transmit and receive can be different if Timer
2 is used for the receiver or transmitter and Timer 1 is used for the other function
.The baud rates in Modes 1 and 3 aredetermined by Timer 2’s overflow rate according
to the following equation .
Modes 1 and 3 Baud Rates =Timer 2 Overflow Rate
16

The timer operation is different for Timer 2 when it is used as a baud rate generator
.Normally ,as a timer , it increments every machine cycle (at 1/12 the oscillator
frequency).As a baud rate generator , however, it increments every state time ( at 1/2 the
oscillator frequency ) .
Timer 0
Timer 0 functions as either a timer or event counter in four modes of operation . Timer 0 is
controlled by the four lower bits of the TMOD register and bits 0, 1, 4 and 5 of the TCON
register
Mode 0 ( 13-bit Timer)
Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit
timer (TH0 register) with a modulo 32 prescaler implemented with the lower five
bits of the TL0 register . The upper three bits of TL0 register are indeterminate and
should be ignored . Prescaler overflow increments the TH0 register.
Mode 1 ( 16-bit Timer )
Mode 1 is the same as Mode 0, except that the Timer register is being run
with all 16 bits . Mode 1 configures timer 0 as a 16-bit timer with the TH0
and TL0 registers connected in cascade . The selected input increments the TL0
register .
Mode 2 (8-bit Timer with Auto-Reload)
Mode 2 configures timer 0 as an 8-bit timer ( TL0 register ) that automatically
reloads from the TH0 register . TL0 overflow sets TF0 flag in the TCON
register and reloads TL0 with the contents of TH0 , which is preset by software
.
Mode 3 ( Two 8-bit Timers )Mode 3 configures timer 0 so that registers TL0 and
TH0 operate as separate 8-bit timers. This mode is provided for applications
requiring an additional 8-bit timer or counter .

Timer 1
Timer 1 is identical to timer 0 , except for mode 3 , which is a hold-count
mode .
Mode 3 ( Halt )
Placing Timer 1 in mode 3 causes it to halt and hold its count . This can be
used to halt Timer 1 when TR1 run control bit is not available i.e. , when Timer 0
is in mode 3 .
Baud Rates :
The baud rate in Mode 0 is fixed. The baud rate in Mode 2 depends on
the value of bit SMOD in Special Functio Register PCON. If SMOD = 0 (which is
its value on reset), the baud rate is 1/64 the oscillator frequency . If SMOD = 1, the
baud rate is 1/32 the oscillator frequency. In the 89S52 , the baud rates in Modes
1 and 3 are determined by the Timer 1 overflow rate. In case of Timer 2 , these
baud rates can be determined by Timer 1 , or by Timer 2 , or by both (one for
transmit and the other for receive ).
TCON REGISTER :Timer/counter Control Register
TMOD REGISTER: Timer/Counter 0 and 1 Modes
Mini Water Pump

This is a low cost mini submersible type water pump that works on 3-6V DC. It is extremely
simple and easy to use. Just immerse the pump in water, connect a suitable pipe to the outlet
and power the motor with 3-6V to start pumping water. Great for building science projects, fire-
extinguishers, fire fighting robots, fountains, waterfalls, plant watering systems etc.

This motor is small, compact and light. It can be controlled from a micro controller/Arduino using
our DC Motor Drivers or one of our Relay Boards. You may use our 5V SMPS Power Supply
Adapter to run this pump. You may also use our 6V Solar Panel to run the pump with
appropriate a 6V voltage regulator.

Note: Do not run the pump dry (without putting it in water) and do not use it to pump flamable
liquids.

Features

 Operating DC Voltage: 2.5-6V


 Maximum Water lift height: 40-110cm / 15.75"-43.4"

 Flow rate: 80-120L/H

 Outer Diameter of Water Outlet: 7.5mm / 0.3"

 Inside Diameter of Water Outlet: 5mm / 0.2"

 Pump Diameter: Approx. 24mm / 0.95"

 Pump Length: Approx. 45mm / 1.8"

 Pump Height: Approx. 30mm / 1.2"

 Wire Length: ~13mm cm


Applications

 Great for building science projects, fire-extinguishers, fire fighting robots, fountains,

waterfalls, plant watering systems etc.

 Controlled fountain water flow

 Controlled Garden watering systems

 Hydroponic Systems

 Fresh water intake or exhaust systems for fish aquqriums

RELAYS

Introduction:
A relay is an electrical switch that opens and
closes under the control of another electrical circuit. In the
original form, the switch is operated by an electromagnet to
open or close one or many sets of contacts. A relay is able to
control an output circuit of higher power than the input
circuit, it can be considered to be, in a broad sense, a form
of an electrical amplifier.
Relays are usuallly SPDT (single pole double through switch)or DPDT (double pole double
through switch) but they can have many more sets of switch contacts, for example relays with 4 sets
of changeover contacts are readily available.

Basic operation of a relay:


An electric current through a conductor will produce a
magnetic field at right angles to the direction of electron
flow. If that conductor is wrapped into a coil shape, the
magnetic field produced will be oriented along the length of
the coil. The greater the current, the greater the strength of
the magnetic field, all other factors being equal.
Inductors react against changes in current because of the
energy stored in this magnetic field. When we construct a
transformer from two inductor coils around a common iron core,
we use this field to transfer energy from one coil to the
other. However, there are simpler and more direct uses for
electromagnetic fields than the applications we've seen with
inductors and transformers. The magnetic field produced by a
coil of current-carrying wire can be used to exert a
mechanical force on any magnetic object, just as we can use a
permanent magnet to attract magnetic objects, except that this
magnet (formed by the coil) can be turned on or off by
switching the current on or off through the coil.
If we place a magnetic object near such a coil for the
purpose of making that object move when we energize the coil
with electric current, we have what is called a solenoid. The
movable magnetic object is called an armature, and most
armatures can be moved with either direct current (DC) or
alternating current (AC) energizing the coil. The polarity of
the magnetic field is irrelevant for the purpose of attracting
an iron armature. Solenoids can be used to electrically open
door latches, open or shut valves, move robotic limbs, and
even actuate electric switch mechanisms and is used to
actuate a set of switch contacts
Relays can be categorized according to the magnetic
system and operation:
Neutral Relays:
This is the most elementary type of relay. The neutral
relays have a magnetic coil, which operates the relay at a
specified current, regardless of the polarity of the voltage
applied.
Biased Relays:
Biased relays have a permanent magnet above the armature.
The relay operates if the current through the coil winding
establishes a magneto-motive force that opposes the flux by
the permanent magnet. If the fluxes are in the same direction,
the relay will not operate, even for a greater current through
the coil.
Polarized Relays:
Like the biased relays, the polarized relays operate only
when the current through the coil in one direction. But there
the principle is different. The relay coil has a diode
connected in series with it. This blocks the current in the
reverse direction.
The major difference between biased relays and polarized
relays is that the former allows the current to pass through
in the reverse direction, but does the not operate the relay
and the later blocks the current in reverse direction.  You
can imagine how critical these properties when relays are
connected in series to form logic circuits.
Magnetic Stick Relays or Perm polarized Relays:
These relays have a magnetic circuit with high
permanence.  Two coils, one to operate (pick up) and one to
release (drop) are present.  The relay is activated by a
current in the operate coil. On the interruption of the
current the armature remains in picked up position by the
residual magnetism. The relay is released by a current through
the release coil.
Slow Release Relays:
These relays have a capacitor connected in parallel to
their coil. When the operating current is interrupted the
release of relay is delayed by the stored charge in the
capacitor. The relay releases as the capacitor discharges
through the coil.
Relays for AC:
These are neutral relays and picked up for a.c. current
through their coil. These are very fast in action and used on
power circuits of the point motors, where high current flows
through the contacts. A normal relay would be slow and make
sparks which in turn may weld the contacts together.
All relays have two operating values (voltages), one
pick-up and the other other drop away. The pick-up value is
higher than the drop away value.
Applications:

 To control a high-voltage circuit with a low-voltage signal, as in some types of modems or


audio amplifiers,
 To control a high-current circuit with a low-current signal, as in the starter solenoid of an
automobile,
 To detect and isolate faults on transmission and distribution lines by opening and closing
circuit breakers (protection relays),
 To isolate the controlling circuit from the controlled circuit when the two are at different
potentials, for example when controlling a mains-powered device from a low-voltage switch.
The latter is often applied to control office lighting as the low voltage wires are easily
installed in partitions, which may be often moved as needs change. They may also be
controlled by room occupancy detectors in an effort to conserve energy,

 To perform logic functions. For example, the boolean AND function is realised by connecting
NO relay contacts in series, the OR function by connecting NO contacts in parallel. The
change-over or Form C contacts perform the XOR (exclusive or) function. Similar functions
for NAND and NOR are accomplished using NC contacts. The Ladder programming language
is often used for designing relay logic networks.
o Early computing. Before vacuum tubes and transistors, relays were used as logical
elements in digital computers. See ARRA (computer), Harvard Mark II, Zuse Z2, and
Zuse Z3.
o Safety-critical logic. Because relays are much more resistant than semiconductors to
nuclear radiation, they are widely used in safety-critical logic, such as the control
panels of radioactive waste-handling machinery.
 To perform time delay functions. Relays can be modified to delay opening or delay closing a
set of contacts. A very short (a fraction of a second) delay would use a copper disk between
the armature and moving blade assembly. Current flowing in the disk maintains magnetic
field for a short time, lengthening release time. For a slightly longer (up to a minute) delay, a
dashpot is used. A dashpot is a piston filled with fluid that is allowed to escape slowly. The
time period can be varied by increasing or decreasing the flow rate. For longer time periods,
a mechanical clockwork timer is installed

LED(LIGHT EMITTING DIODE)

Introduction:

A light-emitting diode (LED) is a semiconductor diode that


emits light when an electrical current is applied in the
forward direction of the device, as in the simple LED circuit.
The effect is a form of electroluminescence. where incoherent
and narrow-spectrum light is emitted from the p-n junction..
LEDs are widely used as indicator lights on electronic devices
and increasingly in higher power applications such as
flashlights and area lighting. An LED is usually a small area
(less than 1 mm2) light source, often with optics added to the
.
chip to shape its radiation pattern and assist in reflection
The color of the emitted light depends on the composition and
condition of the semi conducting material used, and can be
infrared, visible, or ultraviolet. Besides lighting,
interesting applications include using UV-LEDs for
sterilization of water and disinfection of devices , and as a
grow light to enhance photosynthesis in plants.

Basic principle:
Like a normal diode, the LED consists of a chip of semi
conducting material impregnated, or doped, with impurities to
create a p-n junction. As in other diodes, current flows
easily from the p-side, or anode, to the n-side, or cathode,
but not in the reverse direction. Charge-carriers electrons
and holes flow into the junction from electrodes with
different voltages. When an electron meets a hole, it falls
into a lower energy level, and releases energy in the form of
a photon.
The wavelength of the light emitted, and therefore its color,
depends on the band gap energy of the materials forming the p-
n junction. In silicon or germanium diodes, the electrons and
holes recombine by a non-radiative transition which produces
no optical emission, because these are indirect band gap
materials. The materials used for the LED have a direct band
gap with energies corresponding to near-infrared, visible or
near-ultraviolet light. LED development began with infrared
and red devices made with gallium arsenide. Advances in
materials science have made possible the production of devices
with ever-shorter wavelengths, producing light in a variety of
colors. LEDs are usually built on an n-type substrate, with
an electrode attached to the p-type layer deposited on its
surface. P-type substrates, while less common, occur as well.
Many commercial LEDs, especially GaN/InGaN, also use sapphire
substrate.
LED Display types:

 Bar graph
 Seven segment
 Star burst
 Dot matrix

Basic LED types:

Miniature LEDs
Different sized LEDs. 8 mm, 5mm and 3 mm
These are mostly single-die LEDs used as indicators, and they
come in various-size packages:

 surface mount
 2 mm
 3 mm (T1)
 5 mm (T1³⁄₄)
 10 mm
 Other sizes are also available, but less common.

Common package shapes:

 Round, dome top


 Round, flat top
 Rectangular, flat top (often seen in LED bar-graph displays)
 Triangular or square, flat top

The encapsulation may also be clear or semi opaque to improve


contrast and viewing angle.
There are three main categories of miniature single die LEDs:

 Low current — typically rated for 2 mA at around 2 V (approximately 4 mW consumption).


 Standard — 20 mA LEDs at around 2 V (approximately 40 mW) for red, orange, yellow &
green, and 20 mA at 4–5 V (approximately 100 mW) for blue, violet and white.
 Ultra-high output — 20 mA at approximately 2 V or 4–5 V, designed for viewing in direct
sunlight.

Five- and twelve-volt LEDs


These are miniature LEDs incorporating a series resistor, and
may be connected directly to a 5 V or 12 V supply.
Flashing LEDs
Flashing LEDs are used as attention seeking indicators where
it is desired to avoid the complexity of external electronics.
Flashing LEDs resemble standard LEDs but they contain an
integrated multivibrator circuit inside which causes the LED
to flash with a typical period of one second. In diffused lens
LEDs this is visible as a small black dot. Most flashing LEDs
emit light of a single color, but more sophisticated devices
can flash between multiple colors and even fade through a
color sequence using RGB color mixing.
High power LEDs

High power LEDs from lumileds mounted on a star shaped heat sink High power LEDs (HPLED) can be
driven at more than one ampere of current and give out large amounts of light. Since overheating
destroys any LED the HPLEDs must be highly efficient to minimize excess heat, furthermore they are
often mounted on a heat sink to allow for heat dissipation. If the heat from a HPLED is not removed
the device will burn out in seconds.

A single HPLED can often replace an incandescent bulb in a


flashlight or be set in an array to form a powerful LED lamp.
LEDs have been developed that can run directly from mains
power without the need for a DC converter. For each half cycle
part of the LED diode emits light and part is dark, and this
is reversed during the next half cycle. Current efficiency is
80 lm/W..
Multi-color LEDs
A “bi-color LED” is actually two different LEDs in one case.
It consists of two dies connected to the same two leads but in
opposite directions. Current flow in one direction produces
one color, and current in the opposite direction produces the
other color. Alternating the two colors with sufficient
frequency causes the appearance of a third color. A “tri-
color LED” is also two LEDs in one case, but the two LEDs are
connected to separate leads so that the two LEDs can be
controlled independently and lit simultaneously.
RGB LEDs contain red, green and blue emitters, generally using
a four-wire connection with one common (anode or cathode).
The Taiwanese LED manufacturer Everlight has introduced a 3
watt RGB package capable of driving each die at 1 watt.
Alphanumeric LEDs
LED displays are available in seven-segment and starburst
format. Seven-segment displays handle all numbers and a
limited set of letters. Starburst displays can display all
letters. Seven-segment LED displays were in widespread use in
the 1970s and 1980s, but increasing use of liquid crystal
displays, with their lower power consumption and greater
display flexibility, has reduced the popularity of numeric and
alphanumeric LED displays.
Applications:

Automotive applications with LEDS


Instrument Panels & Switches, Courtesy Lighting, CHMSL, Rear
Stop/Turn/Tai, Retrofits, New Turn/Tail/Marker Lights.
Consumer electronics & general indication
Household appliances, VCR/ DVD/ Stereo/Audio/Video devices,
Toys/Games Instrumentation, Security Equipment, Switches.
Illumination with LEDs
Architectural Lighting, Signage (Channel Letters), Machine
Vision, Retail Displays, Emergency Lighting (Exit Signs), Neon
and bulb Replacement, Flashlights, Accent Lighting - Pathways,
Marker Lights.
Sign applications with LEDs
Full Color Video, Monochrome Message Boards, Traffic/VMS,
Transportation – Passenger Information.
Signal application with LEDs
Traffic, Rail, Aviation, Tower Lights, Runway Lights,
Emergency/Police Vehicle Lighting.
Mobile applications with LEDs
Mobile Phone, PDA's, Digital Cameras, Lap Tops, General
Backlighting.
Photo sensor applications with LEDs
Medical Instrumentation, Bar Code Readers, Color & Money
Sensors, Encoders, Optical Switches, Fiber Optic
Communication.
2N2222A NPN Transistor
2N2222A Pinout Configuration

Pin Number Pin Name Description

1 Emitter Current Drains out through emitter

2 Base Controls the biasing of transistor


3 Collector Current flows in through collector

Features

 Bi-Polar high current NPN Transistor


 DC Current Gain (hFE) is 100
 Continuous Collector current (IC) is 800mA
 Emitter Base Voltage (VBE) is 6V
 Collector Emitter Voltage (VCE) is 30V
 Base Current(IB) is 5mA maximum
 Available in To-92 Package

2N2222A Brief Description

2N2222A is a NPN transistor hence the collector and emitter will be left open
(Reverse biased) when the base pin is held at ground and will be closed (Forward
biased) when a signal is provided to base pin. 2N2222A has a gain value of 110 to
800, this value determines the amplification capacity of the transistor. The maximum
amount of current that could flow through the Collector pin is 800mA, hence we
cannot connect loads that consume more than 800mA using this transistor. To bias a
transistor we have to supply current to base pin, this current (I B) should be limited to
5mA.

When this transistor is fully biased, then it can allow a maximum of 800mA to flow
across the collector and emitter. This stage is called Saturation Region and the typical
voltage allowed across the Collector-Emitter (V CE) or Base-Emitter (VBE) could be 200
and 900 mV respectively. When base current is removed the transistor becomes fully
off, this stage is called as the Cut-off Region and the Base Emitter voltage could be
around 660 mV.

 
Where to use 2N2222A

The 2N2222A transistor is very much similar to the commonly used NPN transistor
BC547. But there are two important features that distinguish both. 2N2222A can
allow collector current upto 800mA and also has power dissipation of 652mW which
can be used to drive larger loads than compared with BC547.

So if you looking for an NPN transistor that could switch loads of higher current,
then 2N2222A might the right choice for your project.

How to use 2N2222A

This transistor like all can be used either as a switch or as an amplifier. The Base-
Emitter voltage of this transistor is 6V so you just have to supply this voltage across
the base and emitter of the transistor to induce a base current into the transistor.
This transistor will make it forward biased and thus closes the connection between
collector and emitter. However one important thing to notice is the Base resistor a.k.a
current limiting resistor. As the name suggests this resistor will limit the current
flowing through the transistor to prevent it from damaging. The value for this resistor
can be calculated using the formula

RB = VBE / IB

To make things simple, I have shown a simplified circuit to make a transistor as


switch. In actual circuit modifications might be required. I have used a base voltage
of 5V and a value of 1K as current limiting resistor.
Note that the motor here draws about 500mA from the 12V power source, since the
2N2222 has collector current rating upto 800mA this circuit is possible had it been a
BC547 the transistor should have been burnt.

Applications

 Can be used to switch high current (upto 800mA) loads


 It can also be used in the various switching applications.
 Speed control of Motors
 Inverter and other rectifier circuits
 Can be used in Darlington Pair.
CHAPTER-4
SOFTWARE DESCRIPTION

Keil Software

Installing the Keil software on a Windows PC

 Insert the CD-ROM in your computer’s CD drive


 On most computers, the CD will “auto run”, and you will see the Keil installation
menu. If the menu does not appear, manually double click on the Setup icon, in the
root directory: you will then see the Keil menu.
 On the Keil menu, please select “Install Evaluation Software”. (You will not require a
license number to install this software).
 Follow the installation instructions as they appear.

Loading the Projects

The example projects for this book are NOT loaded automatically when you install the Keil
compiler.
These files are stored on the CD in a directory “/Pont”. The files are arranged by chapter: for
example, the project discussed in Chapter 3 is in the directory “/Pont/Ch03_00-Hello”.
Rather than using the projects on the CD (where changes cannot be saved), please copy the
files from CD onto an appropriate directory on your hard disk.
Note: you will need to change the file properties after copying: file transferred from the CD
will be ‘read only’.
Configuring the Simulator

Open the Keil Vision2

Go to Project – Open Project and browse for Hello in Ch03_00 in Pont and open it.

Go to Project – Select Device for Target ‘Target1’


Select 8052(all variants) and click OK
Now we need to check the oscillator frequency:
Go to project – Options for Target ‘Target1’

Make sure that the oscillator frequency is 12MHz.


Building the Target

Build the target as illustrated in the figure below

Running the Simulation

Having successfully built the target, we are now ready to start the debug session and run the
simulator.
First start a debug session
The flashing LED we will view will be connected to Port 1. We therefore want to observe the
activity on this port
To ensure that the port activity is visible, we need to start the ‘periodic window update’ flag
Go to Debug - Go

While the simulation is running, view the performance analyzer to check the delay
durations.
Go to Debug – Performance Analyzer and click on it
Double click on DELAY_LOOP_Wait in Function Symbols: and click Define button

PROTEUS:

Generally we are listening the words PCB’s, PCB layout, PCB designing, ect.


But what is PCB? Why we are using this PCB? We want to know about all these things as a
electronic engineer. PCB means Printed Circuit Board. This is a circuit board with printed
copper layout connections. These PCB’s are two types. One is dotted PCB and another one is
layout PCB. The two examples are shown in below.
What is the main difference between the dotted PCB and layout PCB? In dotted PCB
board only dots are available. According to our requirement we can place or insert the
components in those holes and attach the components with wires and soldering lid. In this
dotted PCB we can make the circuit as out wish but it is very hard to design. There are so
many difficulties are there. Those are connecting the proper pins, avoiding shot connections
and etc. Coming to the layout PCB this is simple to design. First we select the our circuit and
by using different PCB designing software’s, design the layout of the circuit and by itching
process preparing the copper layout of our circuit and solder the components in the correct
places. It is simple to design, take less time to design, no shortages, looking nice and perfect.

Up to now we have discussed about types of PCB’s and difference between the types. Now
we can discuss about PCB designing software. There are so many PCB designing softwares
available. Some are Express PCB, eagle PCB, PCB Elegance, free PCB, open circuit
design, zenith PCB andProteus etc. Apart from remaining Proteus is different. Proteus is
design suit and PCB layout designing software. In Proteus we can design any circuit and
simulate the circuit and make PCB layout for that circuit.

Introduction to Proteus:

Proteus professional is a software combination of ISIS schematic capture program and ARES
PCB layout program. This is a powerful and integrated development environment. Tools in
this suit are very easy to use and these tools are very useful in education and professional
PCB designing. As professional PCB designing software with integrated space based auto
router, it provides features such as fully featured schematic capture, highly configurable
design rules, interactive SPICE circuit simulator, extensive support for power planes, industry
standard CADCAM & ODB++ output and integrated 3D viewer.

Up to know we have discussed about the basics and software description. Now we are
entering into the designing section. Run the ISIS professional program by clicking the icon
on the desktop, then this splash screen will appear.

Next, a work space with interface buttons for designing circuit will appear as shown in figure
below. Note that there is a blue rectangular line in the workspace; make sure that whole
circuit is designed inside the rectangular space.
Next step is selecting the components to our required circuit. Let us take one example is
designing of 38 kHz frequency generator by using 555 timer IC. The circuit diagram is shown
in below image.

In the above circuit the required components are 555 timer IC, 470? and 22K? resisters, 10K?
variable resister, 0.001µf capacitor and one IR LED. So select the components from library. In
menu bar library > pick device/ symbol. Then one window will open that shown in below.

There is another way to select the components. In work space left side there is a tool bar. In
that tool bar click the component mode button or pick from library.
Select the all components from library, that components are added to devices list. Click on
the device and change the angle of the device by using rotate buttons. Then click in the work
space then the selected component is placed in work space. Place all the devices in work
space and put the curser at the component pin end then draw the connections with that pen
symbol. Connect all the components according to circuit then that designed circuit is show in
below image.
 

If any modifications want to do to the component place the mouse point and click on right
button then option window will open. That is shown in below figure.

 
After completion of designing save with some mane and debug it. This is virtual simulation
means without making circuit we can see the result in virtually through this software and we
can design the PCB layout to our required circuit with this software.
CHAPTER-5
RESULT
CHAPTER-6
CONCLUSION

Water is most important basic needs for all the living beings. But unfortunately, a large amount of
water is wasted due to uncontrolled use. Some other automatic water level monitoring systems are
also offered till now but there is some lack of practice in most of the method. We tried to overcome
these problems and implemented an efficient automatic water level monitoring and control system.
Our intention of this research work was to establish a flexible, economical and easy configurable
system that could solve the problem of losing our water. We are using a low cost 8051
microcontroller in this system which is the main point of the ost. We have successfully used the
system in the laboratory and therefore have proposed to control the water level which offers the
flexibility to control this system .
REFFERENCES:

[1] Microcontroller chip Technology, 2001, PIC16F84A Datasheet www.microchip.com

[2] P. Dietz, W. Yerazunis, D. Leigh, Very Low-Cost Sensing and Communication Using Bidirectional
LEDs, UbiComp 2003:Proceedings, vol. 2864, pp. 175-191, 2003.

[3] M. Javanmard, K.A. Abbas and F. Arvin, “A Microcontroller-Based Monitoring System for Batch
Tea Dryer”, CCSE Journal of Agricultural Science, Vol. 1, No. 2, December 2009

[4] Roderick L. Shepherd, William S. Yerazunis and Senior Member, “Low-Cost Surface Mount LED
Gas Sensor”, IEEE King Tong Lau and Dermot Diamond, Sensors-00997, 2005

[5] T. S. Aye, and Z M. Lwin, “Microcontroller Based Electric Expansion Valve Controller for Air
Conditioning System”, World Academy of Science, Engineering and Technology, 2008

[6] L. Byrne, K.T. Lau, and D. Diamond, Monitoring of headspace total volatile basic nitrogen from
selected fish species using reflectance spectroscopic measurements of pH sensitive filmsî, The
Analyst, vol. 127, pp. 1338-1341, 2002.

[7] Milenkovic, A., Milenkovic, M., Jovanov, E., Hite, D., and Raskovic, D.: An environment for
runtime power monitoring of wireless sensor network platforms, Proc. of SSST’ 05, 406–410, 2005.

[8] E.J. Cho and F.V. Bright, Integrated chemical sensor array platform based on light emitting diode,
xerogel-derived sensor elements, and high-speed pin printing, Analytica Chimica Acta, vol. 470, pp.
101-110, 2002.

[9] R.E. Shaffer, S.L. Rose-Pehrsson, R.A. McGill, A comparison study of chemical sensor array pattern
recognition algorithms, Anal. Chim. Acta 384 (1999) 305–317

You might also like