You are on page 1of 37

AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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

ASTU 2016 G.C 1


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

1.3 STATMENT OF PROBLEM

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

ASTU 2016 G.C 2


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

The project is aimed to fit the following objectives:

 To avoid unnecessary wastage of power.


 To give information about status of toilet room.
 To minimize humans burden of switching on and off.
 To reduce maintenance cost.

1.5 FUTURE DEVELOPMENT

 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.

1.6 SCOPE OF THE PROJECT

The following are the scope for the project made:


 
 The display unit interface must always be monitored
 The sensors must be active to count whenever an obstruction of the Infrared light is
blocked
 The user is familiar with numerical counting
 The controlled appliances will have to have an electrical interface in order to be
controlled by microcontroller

1.7 SIGNIFICANCE OF PROJECT

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

ASTU 2016 G.C 3


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

1.8 LIMITATION OF STUDY

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.

ASTU 2016 G.C 4


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

CHAPTER TWO

2.1 LITRATURE REVIEW


2.1.1 PREVOUS RESEARCH ON THE TOPIC

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.

2.1.2 THEORETICAL FRAME WORK

Following are the important modules in this project:

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

ASTU 2016 G.C 5


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

Figure 2.1 pic16f877a microcontroller

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.

ASTU 2016 G.C 6


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

Figure 2.2 Light dependent resistor

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.

Figure 2.3 Infrared sensor

ASTU 2016 G.C 7


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

Figure 2.4 Relay

16X2 LCD DISPLAY

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.

ASTU 2016 G.C 8


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

LCD Pin Diagram:

Figure 2.5 LCD

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

Figure 2.6 Transistor

ASTU 2016 G.C 9


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

Figure 2.7 diode


RESISTOR

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

ASTU 2016 G.C 10


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

Figure 2.8 5v regulated supply

ASTU 2016 G.C 11


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

Figure 2.9 12v regulated supply

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

ASTU 2016 G.C 12


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

Figure 2.10 capacitor

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

ASTU 2016 G.C 13


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

Figure 2.11 7805 regulator

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.

ASTU 2016 G.C 14


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

Figure 2.12 crystal

Software Used

Proteus 8.1 professionalISIS: -


ISIS provides the development environment for PROTEUS VSM. This product combines mixed
mode circuit simulation, micro-processor models and interactive component models to allow the
simulation of complete micro-controller based designs.ISIS provides the means to enter the
design in the first place, the architecture for real time interactive simulation and a system for
managing the source and object code associated witheach project. In addition, a number of graph
objects can be placed on the schematic to enable conventional time, frequency and swept
variable simulation to be performed. Proteus VSM combines a superb mixed mode circuit
simulator based on the industry standardSPICE3F5 with animated component models. And it
provides an architecture in which additionalanimated models may be created by anyone,
including end users. Indeed, many types ofanimated model can be produced without resort to
coding. It created a range of simulatormodels for popular micro-controllers and a set of animated
models for related peripheraldevices such as LED and LCD displays, keypads, an RS232
terminal and more. It is possible tosimulate complete micro-controller systems and thus to
develop the software for them withoutaccess to a physical prototype.

ASTU 2016 G.C 15


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

ASTU 2016 G.C 16


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

CHAPTER THREE

3.1 SYSTEM MODELING AND SIMULATION

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

Figure 3.1 block diagram

3.1.1 B LOCK DIAGRAM DESCRIPTION


Pic16f877a gets signals from receivers of IR sensor and LDR. Those signals are manipulated in
the way to display the number of people inside the room, the status of room if it is full or not, the
present state of lamp on LCD and to close and open the relay in order to control the lamp. At day
time, the resistance of LDR is low as a result high signal is sent to the connected pin of micro

ASTU 2016 G.C 17


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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.

ASTU 2016 G.C 18


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

ASTU 2016 G.C 19


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

specific area of toilet layout diagram

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

ASTU 2016 G.C 20


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

INSTALLATION DESIGN ASPECTS


AREA TO BE ILLUMINATED¿ 30 m 2

ILLUMINATION (E)= 150 lux

TOTAL LUMENS(φ)=A*E = 30*150=4500Lumen

UTLLIZATION FACTOR (CU) =0.6

MANTENANCE FACTOR (MF) =0.8

GROSS (TOTAL) LUMEN (F) = A * E/MF *CU = 30*150/0.8*0.6 =9375LUM

ASSUME
We use florescent lamp

Power for each florescent lamp is 36W

SINCE THE EFFICANCY IS 80 lum/w

TOTAL WATTAGE (POWER) REQUIRED= 9375/80lum/W = 117.19w

NUMBER OF LAMPS= 117.19W/36W =4 lamps

ASTU 2016 G.C 21


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

3.1.2 DESIGN CALCULATION


LDR SENSOR

At day time

=( ) x 5v = 4.99v

10 6
106 +470

At night time

100
=( ) x5v = 0.877v
100+470

figure 3.4 voltage dividing at ldr

ASTU 2016 G.C 22


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

TRANSISTOR

Figure 3.5 transistor base current

For the transistor configuration, since the transistor is biased to saturation


VCE = 0, when the transistor is ON,
This implies that

V+ = IcRc + Vce
Vin = IcRb+ Vbe
Ic
Ib
=hfe

Vin−Vbe 5 v−0.7 v
Rb= Ib = 0.0012 A = 3.6kΩ

ASTU 2016 G.C 23


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

Where
Ic = collector current
Ib = base current, Vin = input voltage,
V+ = Supply voltage, VCE = collector emitter voltage,
hfe = current gain, and

Vbe = Base emitter voltage.

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.

For the r.m.s voltage=11.8v x √ 2 = 16.68v

Hence a transformer of a preferred value of 15V was employed. i.e 220V/15V transformer
Assuming a ripple voltage of 15%

dv =15/100 x16.8v = 2.5v.


dt = 1/2f = 1/100 = 0.01sec
C1 = 0.01sec / 2.5 = 4000mF

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.

ASTU 2016 G.C 24


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

ASTU 2016 G.C 25


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

3.1.3 OVER ALL WORKING PRINCIPLE


From the above calculations and design algorisms we made the system to operate in the
following ways. The room we are going to test has the area to be illuminated 30 m2 and it needs
4 lamps for proper level of illumination calculating it based on EBCstandard. Our system has
three main sections the input section, which is interfaced with external environment, central
controlling section and output section consisting of lamp and count display system. There are 2
IR transmitters and 2 IR receivers placed at the gate in front of each other fitted at a specified
height so as not to be interrupted by animals like cats and dogs and at the proper height
considering the shortest and tallest person. When the T1 and R1 are interrupted first and then T2
and R2 the number of persons entered is incremented by one at any time it may be day time or
night this count is displayed on LCD. But for the lamp to be turned on takes input from LDR in
to consideration. When T2 and R2 are interrupted first and T1 and R2 next number of counts is
decremented by one each time.

CHAPTER FOUR
4.1 SYSTEM DESIGN AND IMPLEMENTATION

ASTU 2016 G.C 26


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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

ASTU 2016 G.C 27


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

Figure 4.2 off state lamps at day time and persons inside

 When it is at night time but there is no person inside the room

ASTU 2016 G.C 28


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

Figure 4.3 off state lamps at dark and no one inside

 when there is at least oneperson inside at dark.

ASTU 2016 G.C 29


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

Figure 4.4 on state of lamps at dark when there is some one inside

CHAPTER FIVE

ASTU 2016 G.C 30


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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

ASTU 2016 G.C 32


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

APPEDEX 1 CIRCUIT DIAGRAM

Fig 4.5 schematic of automatic room light switching with counter


The above diagram is the schematic of “automatic room light switching with counter”. It consists
of an LDR and IR sensors with, pic16f877a micro controller with corresponding power
required.in the circuit we replaced IR sensors by push buttons for simulation purpose.

APPEDEX 2 MIKROC CODE


This is section of the program which initializes LCD pin connections and define and declare the
variables we have used.

ASTU 2016 G.C 33


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

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 ()’.

And this is main body of our program.

ASTU 2016 G.C 34


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

ASTU 2016 G.C 35


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

ASTU 2016 G.C 36


AUTOMATIC ROOM LIGHT SWITCHING WITH COUNTER REPORT

ASTU 2016 G.C 37

You might also like