Final Report
Final Report
visitor counter
A Report
Submitted in partial fulfillment of the requirement for the
Design Project
By
SUGANDHA GUPTA
Roll No. 1120815
ANOOP YADAV
Roll No. 1120816
SANJANA JAIN
Roll No. 1120903
ACKNOWLEDGEMENT
We are grateful and express our sincere thanks to our project guide Prof.
Atma Ram Gupta Electrical Engineering department, for helping in
understanding the concept and for his time to time valuable constant guidance,
advice and invaluable suggestions. Without the full support and cheerful
encouragement of our teacher, this project would be a dream.
Last but not the least, we would like to thank the Teaching & NonTeaching Staff Electrical Engineering department, we would like to thank one and
all who have helped us during the course of this Project.
CONTENTS
INTRODUCTION......................................................................................................................... 4
COMPONENTS DESCRIPTION ............................................................................................... 5
1.
PROCEDURE ........................................................................................................................ 13
FLOW CHART ...................................................................................................................... 14
APPLICATIONS ........................................................................................................................ 17
ADVANTAGES........................................................................................................................... 17
CONCLUSION ........................................................................................................................... 18
FUTURE SCOPE ........................................................................................................................ 18
REFERENCES ............................................................................................................................ 19
APPENDIX A .............................................................................................................................. 20
INTRODUCTION
In todays world with the increasing demand of energy and the continuous depletion of resources
there is a need to adopt possible measures to save power wherever possible. With advent of
automation technologies, several methods can be applied to avoid wastage of energy. This report
proposes an idea to prevent unnecessary consumption of energy in the form of internal
electrification of an enclosed space by closing switches of all appliances in the room which are
not required to be used when people are not present inside the room. This will be a big step
towards the energy efficient lighting systems by optimization of the use of appliances in a room.
This will also lead to reduced electricity bills for the consumers and in the long run will become
a keystone in modern home automation systems. Often we see visitor counters at stadium, mall,
offices, class rooms etc. How they count the people and turn on or off the light when nobody is
inside. This report explains the design of a digital visitor counter which uses two Infrared sensor
transmitter and receiver pairs to detect the entrance and exit of person in a room. The controlling
of the circuit is done using Arduino UNO microcontroller. The outputs of comparators are
connected to digital pins of the arduino. Display section will display the counted number of
people inside the room. A relay driver circuit is added to get enough voltage and current for
relay. Arduino sends commands to this relay driver transistor and then light bulb will turn on and
off accordingly. By using digital LCD display the total count of people in the room can be
known and this information may be useful for many purposes.
The objective of this project is to make a controller based model to count number of persons
visiting particular room and accordingly light up the room. Here we can use sensor and can know
present number of persons. In todays world, there is a continuous need for automatic appliances.
With the increase in standard of living, there is a sense of urgency for developing circuits that
would ease the complexity of life. Also if at all one wants to know the number of people present
in room so as not to have congestion, this circuit proves to be helpful. Automatic Room Light
Controller with Bidirectional Visitor Counter is a reliable circuit that takes over the task of
controlling the room lights as well us counting number of persons/ visitors 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 segment displays.
COMPONENTS DESCRIPTION
The various components used in the Hardware design[3-4] of the automatic room light controller
using bidirectional digital visitor counter are as discussed below
Power Supply - Here we have used +5V dc power supply. The main function of this
block is to provide the required amount of voltage to essential circuits. +5V is given to
relay driver. To get the +5V dc power supply arduino is used as the source and no
separate dc supply will be required.
Enter and Exit Sensor Circuit - This is one of the main parts of our project. The main
intention of this block is to sense the person. For sensing the person we are using a
TSOP1738 sensor. By using this sensor and its related circuit diagram we can count the
number of persons.
Arduino UNO microcontroller - The Arduino Uno is a microcontroller board based on
the ATmega328 . It has 14 digital input/output pins of which 6 can be used as PWM
outputs, 6 analog inputs, a 16 MHz crystal oscillator, a USB connection, a power jack, an
ICSP header, and a reset button[1]. It contains everything needed to support the
microcontroller.
Alphanumeric LCD display - In this section we have used LCD displays to display
number of persons in the room. We have used transistor for display drive circuit. This
display should be placed outside the room. It displays various messages like Person
Counter Incremented, Person Counter Decremented, No of Person in Room = XYZ
here XYZ is the actual person count.
Relay Driver Circuit - In this section we have used the transistor and the relays. Output
signal from microcontroller is given to the base of the transistor, which energizes the
particular relay, because of this, appropriate device is selected and which performs its
allotted function.
1. Infrared Sensors
A passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR) light
radiating from all objects with a temperature above absolute zero emit heat energy in the form of
radiation[2]. Usually this radiation is invisible to the human eye because it radiates at infrared
wavelengths, but it can be detected by electronic devices designed for such a purpose.
The term passive in this instance refers to the fact that PIR devices do not generate or radiate any
energy for detection purposes. They work entirely by detecting the energy given off by other
objects.PIR sensors don't detect or measure "heat"; instead they detect the infrared radiation
emitted or reflected from an object in its field of view. They are most often used in PIR-based
motion detectors. The wavelengths of these regions and their applications are shown below.
Near infrared region 700 nm to 1400 nm IR sensors, fiber optic
Mid infrared region 1400 nm to 3000 nm Heat sensing
Far infrared region 3000 nm to 1 mm Thermal imaging
The frequency range of infrared is higher than microwave and lesser than visible light. They are
of two types: quantum and thermal.
6
IR Transmitter
Infrared Transmitter is a light emitting diode (LED) which emits infrared radiations. Hence, they
are called IR LEDs. Even though an IR LED looks like a normal LED, the radiation emitted by
it is invisible to the human eye. There are different types of infrared transmitters depending on
their wavelengths, output power and response time[2]. A simple infrared transmitter can be
constructed using an infrared LED, a current limiting resistor and a power supply. The schematic
of a typical IR transmitter is shown below
When operated at a supply of 5V, the IR transmitter consumes about 3 to 5 mA of current.
Infrared transmitters can be modulated to produce a particular frequency of infrared light. The
most commonly used modulation is OOK (ON OFF KEYING) modulation. IR transmitters
can be found in several applications. Some applications require infrared heat and the best
infrared source is infrared transmitter. When infrared emitters are used with Quartz, solar cells
can be made.
IR Receiver
Infrared receivers[2] are also called as infrared sensors as they detect the radiation from an IR
transmitter. IR receivers come in the form of photodiodes and phototransistors. Infrared
Photodiodes are different from normal photo diodes as they detect only infrared radiation.
Different types of IR receivers exist based on the wavelength, voltage, package, etc. When used
in an infrared transmitter receiver combination, the wavelength of the receiver should match
with that of the transmitter. A typical infrared receiver circuit using a phototransistor is shown
below. It consists of an IR phototransistor, a diode, a MOSFET, a potentiometer and an LED.
When the phototransistor receives any infrared radiation, current flows through it and MOSFET
turns on. This in turn lights up the LED which acts as a load. The potentiometer is used to
control the sensitivity of the phototransistor.
The sketch is saved with in extension. Any operations like verifying, opening a sketch, saving a
sketch can be done using the buttons on the toolbar or using the tool menu.
The sketch should be stored in the sketchbook directory.
Chose the proper board from the tools menu and the serial port numbers.
Click on the upload button or chose upload from the tools menu. Thus the code is uploaded by
the boot loader onto the microcontroller [4-5].
Arduino is widely preferred now a days the reason being its the various advantages. It comes
with an open source hardware feature which enables users to develop their own kit using already
available one as a reference source. The Arduino software is compatible with all types of
operating systems like Windows, Linux, and Macintosh etc. It also comes with an open source
software feature which enables experienced software developers to use the Arduino code to
merge with the existing programming language libraries and can be extended and modified.
10
Fig. 5. Relay
11
WORKING ALGORITHM
The whole working of the automatic room light controller[3][4] with digital visitor counter is
based upon the action of sensors with signal processed by the arduino UNO controller[1] which
in turn drives the relay to control switching of the equipments inside the room.
The basic block diagram of the bidirectional digital visitor counter[5] is shown above. Two pairs
of Infrared transmitter and receivers are placed at the entry of the closed room in such a manner
that sensor pair 1 falls before the sensor pair 2 in the arrangement. IR sensors are being used
because they cannot be detected by human eyes. Also IR sensors possess another advantage that
they are not triggered by any other source in the environment. If the sensor 1 is interrupted first
then the controller will look for sensor 2 and if it is interrupted then the arduino will increment
the count and will switch the relay. If the sensor 2 is interrupted first then the controller will look
for sensor 1 and if it is interrupted then the arduino will decrement the count and will switch the
relay.
Figure7 represents the interfacing of various circuit components along with the pin connections.
Here in this circuit we have used two comparators for two IR sensors. LM358 is used as
comparator. LM358 has inbuilt two low noise Op-amp. The output pins of the sensor are
connected to the digital pin no. 14(A0) and 19(A5) of the Arduino UNO R3 which are the input
pins as shown. Arduino read these signals and send commands to relay driver circuit to drive the
relay for light bulb controlling. Relay driver section consist a BC547 transistor and a 5 volt relay
for controlling the light bulb. The relay driver transistor is connected to digital pin 2 of the
Arduino. LCD is connected in 4 bit mode. RS and EN pin of LCD is directly connected at 13
and 12. Data pin of LCD D4-D7 is also directly connected to arduino at D11-D8 respectively.
12
SOFTWARE DESIGN
1. Procedure
Automatic room light controller follows the following steps:
1. There are two sensing device which are located at the exit and enter of the entrance of the
room[7-9] .IR transmitter transmit the signal to the receiver by generating the modulated
IR signal.
2. As shown the figure[8] if the sensor 1 is interrupted first that means a person is entering
from the door then Arduino UNO microcontroller is look for sensor 2 and if it is
interrupted then the microcontroller increment the count and displayed it in the LCD
display.
3. The count which is being displayed in the LCD display is equal to the number of people
in the room and accordingly the lights of the room will turn on by using relay.
4. If the sensor 2 is interrupted first the microcontroller look for the sensor 1. And if sensor
1 will interrupt after sensor 2 then microcontroller decrement the count and displayed it
on LCD display.
5. When the last person leaves the room the counter goes to zero that time the relay will turn
off and all the light will turn off.
13
2. Flow Chart
The flow chart below explains the block wise working of the whole process of the test set-up.
Infrared transmitter and receivers are placed at the entry of the closed room in such a manner
that sensor pair 1 falls before the sensor pair 2 in the arrangement. IR sensors are being used
because they cannot be detected by human eyes. Also IR sensors possess another advantage
that they are not triggered by any other source in the environment. If the sensor 1 is
interrupted first then the controller will look for sensor 2 and if it is interrupted then the
arduino will increment the count and will switch the relay. If the sensor 2 is interrupted first
then the controller will look for sensor 1 and if it is interrupted then the arduino will
decrement the count and will switch the relay.
14
Code Explanation
The coding for the arduino microcontroller is the major play master of the whole project.
Arduino programming is basically a physical computing process. Physical computing is
concerned with developing software that interacts with the world beyond the host computer
through a combination of hardware and software. The Arduino interacts with the world
through actuators and sensors. One common way sensors work is that their electrical
properties change as an effect of the changes in the conditions in which it is operating.
Actuators, on the other hand, are electronic components that are used to react to an external
event. Sensors and actuators, thus, are used to achieve complementary objectives: one senses,
and the other reacts. The Arduino is an open-source electronics prototyping platform
composed of two major parts: the Arduino board which is the hardware interface and the
Arduino IDE which is the software. The Arduino IDE is used to write the program that will
interact with Arduino board and the devices connected to it. In the Arduino world, such a
program is called a sketch, which has its origin in its mother language.
First the library for LCD is included and pins are defined for the same. And also
input output pins are defined for sensors and relay. The pins for LCD are from 9 to
13. Input pin is at 6 output pin is at 7 and relay is connected at pin 2.
#include<LiquidCrystal.h>
#define in1 6
#define in2 7
#define relay 2
#define in 1
#define out 2
Next a loop is created which is used for initialization of the LCD setup. At the
beginning of the program the LCD will display a message of Visitor Counter.
Using the pinmode function the pins in and out are defined as input pins and
relay is defined as output pin.
void setup()
{
lcd.begin(16,2);
lcd.print("Visitor Counter");
delay(2000);
pinMode(in, INPUT);
15
pinMode(out, INPUT);
pinMode(relay, OUTPUT);
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
}
In loop function we read sensors input and increment or decrement the counting
depending upon enter or exit operation. And also check for zero condition. Zero
condition means no one in the room. If zero condition is true then arduino turn off
the bulb by deactivating the relay through transistor.
void loop()
{
switch(humanDirection)
{
case in:
countPlus();
break;
case out:
countMinus();
break;
case 0:
break;
}
if(count<=0)
{
count = 0;
lcd.clear();
digitalWrite(relay, LOW);
lcd.clear();
lcd.print("Nobody In Room");
lcd.setCursor(0,1);
lcd.print("Light Is Off");
delay(200);
}
And if zero condition is false then arduino turns on the light. Here is two functions
for enter and exit.
16
void countPlus()
{
count++;
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
delay(1000);
}
void countMinus()
{
count--;
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
delay(1000);
}
The code is given in appendix A
APPLICATIONS
It can be used in various rooms like seminar halls , where the capacity of the room is
limited and should not be exceeded[10]
It can be used in our homes because we often forget to switch off our room lights
It helps in energy conservation
In future , we can send this data to remote areas using mobile or internet
Voice alarm system can be used to indicate that room is full & person cant enter inside
ADVANTAGES
Main advantage of this project is that it helps in energy conservation. Because when there is
nobody inside the room then lights are automatically turned off. Human efforts to count the
number of person are eliminated[11]. Since this project does the automatic person counting with
the help of two sensors installed on door frame.
17
CONCLUSION
The following project has been developed as the part of home automation system that aims at
reducing the wastage of energy at work places and at home. Also the set up enables the person to
know the number of people present in an enclosed space. Such a knowledge is useful when there
is a need to reduce congestion in the room or to know the exact number of people present at a
social gathering like a sports complex or a conference room etc. Such a project can prove to be
very useful in terms of increasing concerns for security issues in todays world. Also it would
prevent any unnecessary wastage of energy which may be caused due to human negligence. Digital Visitor Counter can be used in various rooms like seminar hall, conference hall where the
capacity of room is limited and should not be exceeded. Project will display actual number of
persons inside the room. This project can be used in Cinema halls, multiplex, malls as well as in
temples to count the number of person entering inside. So that these places should not get over
crowded to avoid congestion. It can also be used in classrooms and study rooms in schools and
colleges.
FUTURE SCOPE
To make further enhancements in our project a very good addition will be that of a LDR[4]
which is Light Dependent Resistor[4]. It controls the amount of lighting in a room by constantly
monitoring the level of luminance in a room .LDR is a variable resistor whose resistance is
inversely proportional to the intensity of the incident light. As it is a passive transducer, a
potential divider circuit is used to obtain the corresponding voltage value from the LDRs. The
higher the intensity of light, lower the LDR resistance and hence lower the output voltage and
vice versa. Lights are then controlled such that required illumination is available in the room. It
can be applied effectively in commercial buildings, homes, colleges etc. On a normal day when
there is a bright sun the lights will be OFF. And on a cloudy day the illumination levels will be
low the controller calculates the required lighting by checking the illumination level and turns
ON the lights. Thus we can reduce the unnecessary wastage of energy. We can automatically
monitor the light availability in a room.
Light intensity in the range of 90 to 100 percent is optimum for normal sight. If intensity is
greater than 90 percent, no lighting is required. Subsequently for every 20 percent drop in
intensity a 10 Watts lamp is turned ON to maintain optimum lighting.
18
REFERENCES
[1] G. Smith, Introduction to Arduino, September 30, 2011
[2] T. S. Jayadev, Infrared sensors: detectors, electronics, and signal processing, Society of
Photo-optical Instrumentation Engineers 24th july 1999
[3] http://circuitdigest.com/microcontroller-projects/automatic-room-light-controller-withbidirectional-visitor-counter-using-arduino
[4]
hTTps://en.wikipedia.org/wiki/Integrated_development_environment
[5] http://www.engineersgarage.com/tutorials/555-timer-ic-introduction-basics-workingdifferent-operating-modes
[6]
http://www.ti.com/product/LM358
[7]
http://www.slideshare.net/SINGHNIKHIL/automaticroomlightcontrollerwithbidirectional
[8]
http://www.electrical4u.com/light-dependent-resistor-ldr-working-principle-of-ldr
[9] http://www.academia.edu/1409805/Automatic_Room_Light_Controller_with_Bidirectio
nal_Visitor_Counter
[10] https://www.elprocus.com/know-about-working-of-automatic-room-light-controller-andapplications/
[11] http://seminarprojects.org/c/advantages-and-disadvantages-of-automatic-room-lightcontroller-with-bidirectional-visitor-counter
19
APPENDIX A
Code
#include<LiquidCrystal.h>
#define in1 6
#define in2 7
#define relay 2
#define in 1
#define out 2
int count = 0;
LiquidCrystal lcd(13,12,11,10,9,8);
int timeDiff = 0;
int humanDirection = 0;
int time1 = 0;
int time2 = 0;
void directionDetect()
{
while((digitalRead(in1) || digitalRead(in2)) != 1);
if(digitalRead(in1))
{
time1 = millis();
while(digitalRead(in2) != 1);
time2 = millis();
timeDiff = time2 - time1;
humanDirection = in;
}
else if(digitalRead(in2))
{
time2 = millis();
while(digitalRead(in1) != 1);
time1 = millis();
timeDiff = time1 - time2;
humanDirection = out;
}
}
void countPlus()
{
count++;
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
delay(1000);
}
20
void countMinus()
{
count--;
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
delay(1000);
}
void setup()
{
lcd.begin(16,2);
lcd.print("Visitor Counter");
delay(2000);
pinMode(in, INPUT);
pinMode(out, INPUT);
pinMode(relay, OUTPUT);
lcd.clear();
lcd.print("Person In Room:");
lcd.setCursor(0,1);
lcd.print(count);
}
void loop()
{
switch(humanDirection)
{
case in:
countPlus();
break;
case out:
countMinus();
break;
case 0:
break;
}
if(count<=0)
{
count = 0;
lcd.clear();
digitalWrite(relay, LOW);
lcd.clear();
lcd.print("Nobody In Room");
lcd.setCursor(0,1);
lcd.print("Light Is Off");
delay(200);
}
21
else
digitalWrite(relay, HIGH);
directionDetect();
if(timeDiff > 3000)
{
timeDiff = 0;
humanDirection = 0;
}
}
END
22