Water Level Controller and Traffic Light Controler Using 8051
Water Level Controller and Traffic Light Controler Using 8051
A water level controller using 8051 is shown here. Water level controller monitors the level of
the over head tank and automatically switches on the water pump whenever the level goes below
a preset limit. The level of the over head tank is indicated using 5 LED’s and the pump is
switched OFF when the over head tank is full. The pump is not allowed to start if the water level
in the sump tank is low and also the pump is switched OFF when the level inside the sump tank
goes low during a pumping cycle.
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 over head 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 ports 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.
Circuit diagram.
Program.
The main objective of this traffic light controller is to provide sophisticated control and
coordination to confirm that traffic moves as smoothly and safely as possible. This project makes
use of LED lights for indication purpose and a microcontroller is used for auto changing of
signal at specified range of time interval. LED lights gets automatically turns on and off by
making corresponding port pin of the microcontroller “HIGH”.
Traffic lights alternate the right of way of road users by displaying lights of a standard color (red,
yellow/amber, and green), using a universal color code. In the typical sequence of colored lights:
Illumination of the green light allows traffic to proceed in the direction denoted, Illumination of
the yellow/amber light denoting, if safe to do so, prepare to stop short of the intersection, and
Illumination of the red signal prohibits any traffic from proceeding.
In the above circuit diagram of traffic light controller,a seven-segment display is used as a
counter display, and three LEDs are used for the purpose of traffic light control. An 8051
Microcontroller is the brain of this whole project and is used to initiate the traffic signal at the
intersections on road. This circuit diagram makes use of a crystal oscillator for generating
frequency clock pulses. The LEDs are interfaced to the Port zero of the microcontroller and are
powered with 5v power supply. Seven-segment display is connected to the port2 pins of the 8051
microcontroller with a common anode configuration.
The LEDs get automatically switched on and off by making the corresponding port pins of the
microcontroller high, based on the 8051 microcontroller and its programming done by using
KEIL software. At a particular period of time, only the green light holds ON and the other lights
remains OFF, and after sometime, the changeover traffic light control from green to red takes
place by making the succeeding change for glowing of yellow LED. This process continues as a
cycle and the timing for changing the LEDs can be displayed with the use of a seven-segment
LED display in this project.
This traffic light control system can be further enhanced in such a way to control the traffic
signals automatically based on the traffic density on roads with the help of IR sensor modules
with automatic turnoff if there are no vehicles on either side of the road which leads to power
consumption.
The logic table for this project is shown below: (considering the LED will glow when pin
output = 0)
Program:
org 0000h
here:
mov p0,#0d4h
acall delay1
mov p0,#53h
acall delay1
mov p0,#4dh
acall delay1
mov p0,#35h
acall delay1
sjmp here
delay1:
MOV R2,#42d
MOV R1,#00d
MOV R0,#00d
loop: DJNZ R0,loop
DJNZ R1,loop
DJNZ R2,loop
RET