Professional Documents
Culture Documents
4 - 5796185814811542421 (1) - 1
4 - 5796185814811542421 (1) - 1
CHAPTER ONE
BACKGROUND
As the need for electricity increase progressively its wastage is also going worse .in public areas
there is great amount of water and electrical power wastage. The best way to save our resource is
our responsiveness. We always look and hear many mottoes to create this understanding. But
still we didn't see the problem minimized. One of the major causes is being negligence to public
properties that is not considering them as our properties.
1.2INTRODUCTION
This Project Automatic Room Light Controller with person Counter using Microcontroller is a reliable circuit that
takes over the task of controlling the room lights as well as counting number of persons in the room very accurately.
When somebody enters into the room then the counter is incremented by one and the light in the room will be
switched ON and when any one leaves the room then the counter is decremented by one. The light will be only
switched OFF until all the persons in the room go out. The total number of persons inside the room is also displayed
on the seven LCD displays. The microcontroller does the above job. It receives the signals from the sensors, and this
signal is operated under the control of software which is stored in ROM. Microcontroller PIC16F877A continuously
monitor the Infrared Receivers, when any object pass through the IR Receiver's then the IR Rays falling on the
receivers are obstructed, this obstruction is sensed by the Microcontroller.
In our country switching on or off electrical lights is still commonly made by manual switches.
Nowadays, people are becoming so busy that they forgot to turn off switches after leaving the
room. The need for automatic system is also the major concern of today’s technology. ASTU,
being a pioneer science and Technology University in Ethiopia, seriously needs such an
automated system on the way to create wise and attractive environment for its students.
The objective of this project is to make a controller based model to sense the light intensity of the
room and to count the number of persons visiting a particular room like public toilets. Here we
can use LDR sensors to detect the light intensity, IR sensors to sense persons visiting the room
and LCD to display the number of counts and status of the room.Our project “automatic switched
toilet lamp with counter” is a reliable circuit that takes over the task of controlling lights as well
as counting number of persons entering and leaving the room with status indication whether the
room is full or not. When somebody enters the room the counter is incremented by one but the
system checks darkness of the room to turn on lights. When is not dark our circuit functions for
counting and status indication. Status indicator is always working.
Pic16f877a micro controller, the brain of our system, does the above job. It receives signals from
LDR and IR sensors, and the signals are operated under the control of software which is stored in
ROM.
In most rooms especially constructed for public purpose, you may usually get lamps left turned
on with nobody inside or even at day time. You may also leave it unless you are a responsible
patriot or not busy to remember it. This has significant impact adding the institutions expense
and the country as a whole.
1.4OBJECTIVE OF PROJECT
Wastage of electricity is one of the main problems which we are facing now a day. In our home,
school, colleges or industry we see that fan and lighting point are kept on even if there are
nobody in the room or area and passage. This happens due to negligence or because we forgot to
turn lights off or we are in a hurry. To avoid all such situations this project called Automatic
room light controller with visitor counter‖ is designed. This project has two modules, first one is
known as Digital Visitor counter‖ and second module is known as automatic room light
controller‖. Main concept behind this project is known as counter‖ which measures the number of
persons entering in any room like seminar hall, conference room, hotel rooms. This function is
implemented using a pair of Infrared sensors. The microcontroller does the above job. It receives
the signals from the sensors, and this signal is operated under the control of software which is
stored in the ROM. LCD display placed outside the room displays this value of person count.
This person count will be incremented if somebody enters inside the room and at that time lights
are turned on. And in reverse way, person count will be decremented if somebody leaves the
room. When number of persons inside the room is zero, inside the room is turned off using a
relay interface. In this way Relay does the operation of ―Automatic room light controller‖. Since
this project uses two infrared sensors, it can be used as Bidirectional person counter as well.
Voice alarm system can be added to indicate that room is full & persons can‘t enter
inside.
We can increase the maximum number of persons that can be counted by implementing
the external EEPROM IC.
We can send this data to a remote location using mobile or internet.
By fulfilling the above mentioned objectives we are certain our project will bring highly
recognized importance to the society. This system has more noticeable significance by saving
great amount of power especially for public areas for example, for toilets and bathrooms in our
university. One indicator for the society's advancement is the kind of apparatus it utilizes so
along with saving power our system very nice for sophisticating societies way living.
Implementation of this system also reduces maintenance cost of switches. With our system there
is no need of knocking the door since all the information is displayed on LCD.
If there is no time delay between two persons entering or leaving the room
microcontroller will sense as one person. At least half a second delay is required.
CHAPTER TWO
The existing system makes use of manual controllers, like switches, manual changeovers. This
system can only work as ON/OFF and cannot accertain the number of people in a particular
room. This section provides the theory behind the design of our digital lightning system control
along with counter with some work related to this our work. It will also be notice in this section
that several efforts have One would not truly appreciate the electronic means of counting that is
all around us today, if there is noknowledge of how counting evolved.
Counting system is applicable in our university at female library and engineering library. This is
appreciable system which adds the fruits of technology to our campus. But most rooms are with
one gate, exit and entrance gates are not available. Our project is applicable for rooms with one
gate and it functions lighting control along with counting. During performing of this project we
have reviewed many sources for its accomplishment.
MICRCONTROLLER
A microcontroller is a computer control system on a single chip. It has many electronic circuits
built intoit, which can decode written instructions and convert them to electrical signals. The
microcontroller will then step through these instructions and execute them one by one. As an
example of this a microcontroller we can use it to controller the lighting of a street by using the
exact procedures. Microcontrollers are now changing electronic designs. Instead of hard wiring a
number of logic gates together to perform some function we now use instructions to wire the
gates electronically. The list of these instructions given to this microcontroller is called a
program. There are different types of microcontroller, this project focus only on the
PIC16F877A Microcontroller where it's pins as shown in the figure.
LDR
The theoretical concept of the light sensor lies behind, which is used in this circuit as a
darknessdetector. The LDR is a resistor as shown in Fig. and its resistance varies according to
the amount of light falling on its surface. When the LDR detectlight its resistance will get
decreased, thus if it detects darkness its resistance will increase.
IR Transmitter:We have implemented the Person counter module using 2 transmitters and 2
receivers. We have used Infra-Red transmitters. Reason behind choosing IR LED is, infrared
beams are not visible to human eyes and they are not easily triggered by other sources in the
environment. Transmitters used are IR LEDs.
IR Receiver:We have used IR sensor as an Infrared receiver. It is an active low device, which
means it gives low output when it receives the Infrared rays. So when the IR rays are interrupted
by any person then microcontroller will receive a high pulse from the IR receiver.
RELAYS
A relay is an electrically operated switch. Current flowing through the coil of therelay creates a
magnetic field which attracts a lever and changes the switch contacts. The coil current can be on
or off so relays have two switch positions and they are double throw (changeover) switches.
Relays allow one circuit to switch a second circuit which can be completely separate from the
first. For example, a low voltage battery circuit can use a relay to switch a 220V AC mains
circuit. There is no electrical connection inside the relay between the two circuits, the link is
magnetic and mechanical.
LCD is used in our proposed scheme to display the values of in-circuit current. For simulation
purpose, we can use LCD in a 4-bit Mode. For that, we require only four data lines to be
connected to the four port pins of PIC and three control signals to control the data flow and
display.
TRANSISTOR
Transistors are active components used basically as amplifiers and switches. The two main types
oftransistors are; the bipolar transistors whose operation depends on the flow of both minority
and majoritycarriers and the unipolar of field effect transistors (called FETs) in which current is
due to majority carriersonly (either electrons or holes). In this mode of bias, the circuit is
designed such that current flows without any signal present. The value of bias current
eitherincreased or decreased about its mean value by input signals (if operated as an amplifier),
or ON and OFF
DIODE
The most common function of a diode is to allow an electric current to pass in one direction (i.e.
the forward direction being that it is forward biased) while blocking current in the opposite
direction (i.e. the reverse direction). Thus, a diode is a two- terminal electronic component that
conducts electric current in only one direction. The term usually refers to a semiconductor diode,
the most common type today. This is a crystalline piece of semiconductor material connected to
two electrical terminals. This unidirectional behavior is called rectification and is used in
converting an alternating current to a direct current.
A resistor is a device that restricts the flow of electricity. It opposes the flow of current. Resistors
can limit or divide the current, reduce the voltage, protect an electric circuit, or provide large
amount of heat or light. Its unit is ohm. Alternatively, ohm can be defined as the resistance of a
circuit in which a current of 1 ampere generates heat at a rate of 1 watt. If V represents the
potential difference in volts across the circuit having resistance R ohm, carrying a current in
amperes, the relationship is thus;
V = IR
Hence, R = V/I
Where; R is resistance
V is voltage I is current (amperes)
POWER SUPPLY
There are many types of power supply. Most are designed to convert high voltage AC mains
electricity to a suitable low voltage supply for electronic circuits and other devices. A power
supply can by broken down into a series of blocks, each of which performs a particular function.
Forexample, a 5V regulated supply:
In this project we are going to use 12v for relay energizing circuit and 5v for microcontroller ldr
and IR sensor circuits. The Rectifier circuit is used to convert the AC voltage into its
corresponding DC voltage. There are Half-Wave, Full-Wave and bridge Rectifiers available for
this specific function.
The efficient circuit used is the Full Wave Bridge rectifier circuit. The output voltage of the
rectifier is in rippled form, the ripples from the obtained DC voltage are removed using other
circuits available. The circuit used for removing the ripples is called Filter circuit. From the
above graph pure type of regulated smooth DC signal can be achieved.
Transformer
A transformer is a device that transfers electrical energy from one circuit to another through
inductively coupled conductors (the transformer’s coils). A varying current in the first or primary
winding creates a varying magnetic field through the secondary winding. This varying magnetic
field induces a varying electromotive force (EMF) or voltage in the secondary winding. This
effect is called mutual induction.
If a load is connected to the secondary, an electric current will flow in the secondary winding and
electrical energy will be transferred from the primary circuit through the transformer to the
load .in an ideal transformer, the induced voltage in the secondary winding (V s) is in proportion
with to the primary voltage (Vp), and is giving by the ratio of the number of turns in the
secondary (Ns) to the number of turns in the primary (Np) as follow
Vs/Vp=Ns/ Np
Filter
Capacitors are used as filter. The ripples from the DC voltage are removed and pure DC voltage
is obtained. And also these capacitors are used to reduce the harmonics of the input voltage. The
primary action performed by capacitor is charging and discharging. It charges in positive half
cycle of the AC voltage and itwill discharge in negative half cycle. So it allows only AC voltage
and does not allow the DC voltage. This filter is fixed before the regulator. Thus theoutput is free
from ripples.
Voltage Regulator
It is a device, which maintains the output voltage of an ordinary power supply constant
inirrespective of load variation (or) changes in input AC voltage is known as voltage regulator.
In this we have series voltage regulator that is IC 7805.
Features:
Output Current up to 1A
Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
Thermal Overload Protection
CRYSTAL
A crystal oscillator is an electronic circuit that uses the mechanical resonance of avibrating
crystal of piezoelectric material to create an electrical signal with a very precisefrequency. This
frequency is commonly used to keep track of time (as in quartz wristwatches), toprovide a stable
clock signal for digital integrated circuits, and to stabilize frequencies for radiotransmitters and
receivers. The most common type of piezoelectric resonator used is the quartzcrystal, so
oscillator circuits designed around them were called "crystal oscillators".Quartz crystals are
manufactured for frequencies from a few tens of kilohertz to tens ofmegahertz. More than two
billion (2×109) crystals are manufactured annually. Most are smalldevices for consumer devices
such as wristwatches, clocks, radios, computers, and cell phones.Quartz crystals are also found
inside test and measurement equipment, such as counters, signalquartz crystal can be modeled as
an electrical network with a low impedance (series) and ahigh impedance (parallel) resonance
point spaced closely together. Crystals can be manufactured for oscillation over a wide range of
frequencies, from a fewkilohertz up to several hundred megahertz. Many applications call for a
crystal oscillatorfrequency conveniently related to some other desired frequency, so hundreds of
standard crystalfrequencies are made in large quantities and stocked by electronics distributors.
In this project weused 11.095MHZ crystal oscillator.
Software Used
MikroC professional.
The mikroC PRO for PIC is a powerful, feature-rich development tool for PIC microcontrollers.
It is designed to provide the programmer with the easiest possible solution to developing
applications for embedded systems, without compromising performance or control. PIC and C fit
together well: PIC is the most popular 8-bit chip in the world, used in a wide variety of
applications, and C, prized for its efficiency, is the natural choice for developing embedded
systems. mikroC PRO for PIC provides a successful match featuring highly advanced IDE,
ANSI compliant compiler, broad set of hardware libraries, comprehensive documentation, and
plenty of ready-to-run examples.
CHAPTER THREE
The necessary groundwork for understanding what this project is all about is completed in this
chapter. Details of the procedure working principles of the various stages are briefly described.
In the course to accomplish this project we have followed the following methods: -
BLOCK DIAGRAM
controller which is intern programmed to perform the required task. For this case when people
enter or leave the room nothing happen to the lamp, it is off. So LCD displays off state of
thelamp, status of the room and the number of people inside decrementing and incrementing
persons leaving and entering the room respectively. When it gets dark LDR sends low signal to
the micro controller now when at least one person enters the room the relay is closed. Now LCD
is displaying the above conditions but the lamp is on.
TOILET
L1 1 TOILET 6
WASHING
TOILET 2 L1 L 2TOILET 7
LLL2LL
TOILET 3 TOILET 8
TOILET 4 TOILET 9
LL
L4
TOILET 5 L3 EXIT
TOILET 10
&
ENTR
ASSUME
We use florescent lamp
At day time
=( ) x 5v = 4.99v
10 6
106 +470
At night time
100
=( ) x5v = 0.877v
100+470
TRANSISTOR
V+ = IcRc + Vce
Vin = IcRb+ Vbe
Ic
Ib
=hfe
Vin−Vbe 5 v−0.7 v
Rb= Ib = 0.0012 A = 3.6kΩ
Where
Ic = collector current
Ib = base current, Vin = input voltage,
V+ = Supply voltage, VCE = collector emitter voltage,
hfe = current gain, and
SUPPLAY VOLTAGE
If the unregulated input of the 7805 is greater than 9v while the required output is 5v the
voltage regulator IC, starts getting hot and will be damaged. Hence we will need an input into the
7805 to be approximately 9V for 5v output. Since, the diode drops 0.7V and we have 4 rectifying
diodes forming the full wave bridge, the voltage drop will then be: -
0.7 ×4 = 2.8V
For a peak voltage of 9+2.8=11.8V peak.
Hence a transformer of a preferred value of 15V was employed. i.e 220V/15V transformer
Assuming a ripple voltage of 15%
A preferred value of 4000μF was however employed. To reduce the ripple left, a compensating
capacitor C2was used and a 4065μF was employed.
CHAPTER FOUR
4.1 SYSTEM DESIGN AND IMPLEMENTATION
We have simulated the project using Portus isis 8.1 and load its code written in Mikroc and tried
to implement it in hardware and we got the following results.
The following are the results that we obtained from the simulation.
1) lamp is off
when there is no one inside the room
Figure 4.1 off state of lamps at day time and no person inside
When there is person at day time but the display counts the status of the
person
Figure 4.2 off state lamps at day time and persons inside
Figure 4.4 on state of lamps at dark when there is some one inside
CHAPTER FIVE
5.1 CONCLUSION
The concept of an automatic room light controller with counter can be built upon not just for
only toilets usage but it can also be implemented for other rooms such as hotels, schools,
hospitals, industrial purpose or businesses. The automated state of the system gives it certain
sophistication and gives it a potential to be safe for humans. Eventually, one simple system like
this has the capability to control air conditioners, lighten system, sockets, washing machine, and
other home appliances. Eventually this designed product can be built using less expensive
components thus making it an affordable alternative for consumers. It is a simple upgrade to an
existing standard product and it has endless expansion possibilities.
5.2 RECOMMENDATION
This project is a viable one in the sense that it will go a long way in making it more convenient
easier for users to easily control their appliances, lighting points in their homes, hotel, conference
rooms, and classrooms. Because of its importance as a household need, efforts must be geared
towards designing a viable project like this one. We tried a lot to implement this project in
hardware. But, we faced a big challenge in obtaining the required materials for our system. we
strongly recommend the department enrich materials required for student’s project work. If this
is so more projects will be shown with their real life application beyond simulation.
REFERRENCE
[1] www.elprocus.com/infrared-ir-sensor-circuit-and-working
ASTU 2016 G.C 31
AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT
[2]www.best-microcontroller-projects.com
[3] Mikroc user manual
[4]
[5]
APPENDEX
Next we wrote code to calculate the number of persons entering and leaving the room based on
interruption of IR sensors declaring function called ‘void interrupt ()’.