Professional Documents
Culture Documents
We declare that all the works included in this document are our own work and no copying or
plagiarism is there with our work. We assure that we agree with all written above with our
signature as follows.
Name ID Signature
I certify that this project satisfies all the requirements as a project for the degree of Bachelor of
Science.
------------------------------------------ -------------------------
This is to certify that I have read this project and that in my opinion it is fully adequate, in scope
and quality, as a project for the degree of Bachelor of Science.
------------------------------------- -----------------------------
The system use light dependent resistor sensors to detect the movement of peoples into a room
or out. An automatic door opener system is also used which uses inputs from the sensors to
execute decisions
I
Acknowledgment
Thanks to the Almighty God for being here with us from the very start. We would like to
express our gratitude to Jimma University for giving us the opportunity to do this project on
Visitor Counter and Management System. Our special and heartfelt thanks goes to our advisor
instructorAddishiwotTadesse for his continuous follow up and support in doing this project.
Last but not least a special thanks to our classmates and group members for their continuous
motivation and support in the entire process of the project.
II
Contents
Chapter I.........................................................................................................................................1
Introduction....................................................................................................................................1
1.1 Background...........................................................................................................................1
1.2 Statement of the Problem.....................................................................................................2
1.3 Objectives.............................................................................................................................3
1.3.1 General Objectives.........................................................................................................3
1.3.2 Specific Objectives........................................................................................................3
1.4 Scope of the project..............................................................................................................4
1.5 Methodology.........................................................................................................................4
Chapter II........................................................................................................................................5
Literature Review...........................................................................................................................5
2.1 Tally counter.........................................................................................................................5
2.2 Infrared beams......................................................................................................................5
Chapter III......................................................................................................................................7
System block diagram....................................................................................................................7
3.1 Over view of embedded system............................................................................................7
3.2 System block diagram description........................................................................................7
Chapter IV....................................................................................................................................10
System Design and Implementation.............................................................................................10
4.1 Components used................................................................................................................10
4.1.1 Power Supply...............................................................................................................10
4.1.2 Resistors.......................................................................................................................10
4.1.3 Capacitors....................................................................................................................11
4.1.4 LDR..............................................................................................................................11
4.1.5 PIC 16F877A Microcontroller.....................................................................................12
4.1.6 2x16 LCD.....................................................................................................................15
4.1.7 Simple DC motor.........................................................................................................16
4.1.8 NE555:.........................................................................................................................17
4.1.9 7805 Regulated IC.......................................................................................................19
4.1.10 BC547: NPN Silicon..................................................................................................20
4.1.11 Crystals:.....................................................................................................................20
III
4.1.12 Step-down Transformer.............................................................................................21
4.1.13 Diode Rectifier:..........................................................................................................22
4.1.14 Push Switch:...............................................................................................................23
4.2 Software Requirements and description.............................................................................24
4.2.1 Proteus design suit v 8.0..............................................................................................24
4.2.2 MikroC.........................................................................................................................24
4.2.3 C Language..................................................................................................................25
4.3 Overall working Algorithm................................................................................................26
4.4 General flowchart of the system.........................................................................................28
4.5 Flowchart for sensor operations and decisions...................................................................29
4.6 Simulated circuit description..............................................................................................30
4.6.1 Power Supply...............................................................................................................30
4.6.2 Sensing and signaling section......................................................................................31
4.6.3 Display and Counter Section:......................................................................................32
4.6.4 Door Control section....................................................................................................33
4.7 Visitor Information System................................................................................................34
4.7.1 Graphical user interface...............................................................................................34
Chapter V.....................................................................................................................................39
Conclusion and Recommendation................................................................................................39
5.1 Conclusion..........................................................................................................................39
5.2 Future Recommendations...................................................................................................40
References....................................................................................................................................41
Appendix A-code for mikroC......................................................................................................42
Appendix B Code for C#..............................................................................................................50
Appendix C - Total System..........................................................................................................67
IV
List of figures
Figure 1 System block diagram description...................................................................................8
Figure 2 LDR...............................................................................................................................12
Figure 3 PIC 16F877A.................................................................................................................12
Figure 4 Pin-Diagram Description of PIC16F877A....................................................................15
Figure 5 2x16 LCD......................................................................................................................16
Figure 6 DC motor.......................................................................................................................18
Figure 7 Metal detectors using 555 timer.....................................................................................18
Figure 8 NE555............................................................................................................................19
Figure 9 7805 IC..........................................................................................................................20
Figure 10 BC547: NPN Silicon....................................................................................................21
Figure 11 Crystals........................................................................................................................22
Figure 12 Step down transformer.................................................................................................23
Figure 13 Diode Rectifier.............................................................................................................23
Figure 14 push to make switch.....................................................................................................24
Figure 15 push to break switch....................................................................................................24
Figure 16 Power Supply...............................................................................................................26
Figure 17 Sensing and Signaling section.....................................................................................27
Figure 18 Display and Counter Section.......................................................................................28
Figure 19 Door Control section....................................................................................................29
Figure 20 General flowchart of the system..................................................................................32
Figure 21 Flowchart for sensor operations and decisions............................................................33
Figure 22 Screen shoot for login window....................................................................................35
Figure 23 Screen shoot for admin menu......................................................................................35
Figure 24 Screen shoot for user registration pane........................................................................36
Figure 25 Screen shoot for entry..................................................................................................36
Figure 26 Screen shoot for exit....................................................................................................37
Figure 27 Screen shoot for report generation of visitors..............................................................37
Figure 28 Screen shoot for daily report generation of visitors.....................................................38
V
Acronyms
AC – Alternating Current
C# - C Sharp
DC – Direct Current
GND – Ground
HEX – Hexadecimal
IC – Integrated Circuit
NC – Normally Closed
NO – Normally Open
VI
VII
VCIS
Chapter I
Introduction
1.1 Background
Visitors counter is basically a counting device for measurement of visitor traffic entering and
exiting at specific place like Conference Halls, Libraries, Metro stations, Malls, Sports venues,
Airports, Toll gates, Lift & Car parking.
This study is focused on counting the number of visitors entering and leaving places and
undertaking security checks for like in our case Jimma University Libraries and Conference
Hall. We have decided to conduct this study because of the growing number of students and
staff members,to provide the best and safe services available.
Monitoring the number of visitors visiting some place is greatly needed. This project can be
used to count and display the number of visitors entering inside any conference room, seminar
hall or library. This is a bidirectional counter, which means it works in a two way. That means
counter will be incremented if person enters the room and will be decremented if a person
leaves the room. LCD displays this value which is placed outside the room. An automatic door
opening and closing system also works in parallel with the counting operation.
Microcontroller is a reliable circuit that takes over the task of counting the number of visitors in
the room very accurately. An LDR sensor is used to sense if a person is entering or exiting the
room. The microcontroller receives the signals from the sensors, and this signal is operated
under the control of software which is stored in ROM. Microcontroller PIC16F877A
continuously cheek the LDR sensor output. When any object pass through the LDR receivers
then the LDR rays falling on the receiver are obstructed, this obstruction is sensed by the
Microcontroller.
72
VCIS
1.2 Statement of the Problem
As the students and staff members are the main figures of Jimma University, services that will
meet their need and expectations are required for better functioning and development of the
university. To do this enhancing libraries and conference hall monitoring schemes is the
solution. This places needs to be regularly monitored for how many peoples they can
accompany at once and they should be secured as much as possible.
Right now visitors are admitted in and out without any automated control system of the whole
movement. This is causing problems specially at Libraries, especially during the time of exams
when the number of students who will be studying at libraries is double and when a student
want to check if there is any available seat for him/her they have to check it by getting in and
usually this routine will be repeated every time a student arrives at the library. This is causing
disturbances in one or the other way there by increasing the work load on the librarian in
maintaining silence and order which are the motto of every library. Conference halls do also
have this same problems when conducting a big meetings.
The issue of security is also a greatly important standard to meet. In our age of science and
technology terrorism has evolved and become very highly attached to our day to day fear, in
order for a specific organization to fulfill its intended missions and visions the working
environment should also be made much more safe to work around and be productive.
This problems should be addressed immediately because productivity and creativity can only be
achieved by providing a better and safe working environments. For Jimma University to achieve
it long and future goals in becoming a pioneer in better and quality education provider libraries
and conference halls should be free from any negative constraints.
72
VCIS
1.3 Objectives
1.3.1 General Objectives
To design and implement a bidirectional visitor counter in parallel with metal detector for
security purposes for Jimma University Libraries and Conference hall.
Reducing the noise or disturbance that’s usually exhibited around the libraries
Providing the precise number of attendants that are in a conference hall
Enhancing security check ups
Managing the total number of employee needed
Designing an economically applicable system for the mentioned problems.
To the developer: whenever the developer design or develop a new system, that is important to
the community will give the developer additional knowledge and satisfaction. By developing
the system the developer get the above significance.
To the organization (Jimma university): any organization always plan to incorporate new
system, so when the system is developed it improve the organizational visitor counter that
attend a certain hall or the student entering in to library to get a better service.
To the user:user need safe and better environment for their day to day activity, by developing
and applying this system it will give such a good environment for the library user or conference
attenders though visitor counter system.
Advantages
Provide information to management on the volume and flow of people throughout
location. Human-based data collection comes at great expense.
Counting the visitors helps to maximize the efficiency and effectiveness of employees,
floor area and salespotential of an organization.
Low-cost microprocessor based visitor counter is easy to build.
72
VCIS
1.4 Scope of the project
The main aim of this project is addressing the problems related with persons entering or leaving
a place and also security issues. The system notifies the users how many spots are available
inside and lets the personnel in charge of let’s say a conference room, if any adjustments are to
be made depending on the persons inside a room.
Using LCD display and a buzzer it notifies when a room is full and unauthorized materials are
in the surrounding respectively also closing and opening doors automatically depending on the
sensors state. Besides the system has different essential features like it is reliable, appropriate
and problem solving.
1.5 Methodology
First we have focused on finding problems by observing our surrounding which is Jimma
University. The problems exhibited at libraries became our focus area so we decided to do this
project in the following manner. We developed a problem statement and the significance of the
study. From the observations we have made we decided to make a system which counts the
number of visitors visiting a specific place there by notifying the available space and also
making the entry and exit doors automatic. The Proteus simulation was then developed in
parallel with C code to show how the overall system works.
72
VCIS
Chapter II
Literature Review
Modern people counting systems use many different technologies, each with its own advantages
and disadvantages.
HBC usually require a receiver or a reflector mounted opposite the unit with a typical range up
to 6 meters (20 ft.), although range finding beam counters which do not require a reflector or
receiver usually have a shorter range of around 2.5 meters (8 ft. 2 in).
Vertical beams are somewhat more accurate than horizontal, with accuracies of over 90%
possible if the beams are very carefully placed. Typically they do not give 'in and out'
information, although some directional beams do exist.
Advantages:
Inexpensive
Simple to fit
72
VCIS
Disadvantages:
Observations
72
VCIS
Chapter III
Jimma university visitor counter for library and conference system is designed according to the
concept of embedded system the incorporate sensor to receive data from the environment,
microcontroller for data processing and the LCD with motor to drive the preferred output to the
user. So the system has three main component part
System control part: this part capable of processing data resaved from the sensor to get the
desired output that is reliable visitor counter system. The micro controller do such an important
job in this system.
Output part: output should be seen for the user using LCD display, buzzer, led and door open
and closing by the motor.
72
VCIS
Figure 1
Figure 1......................................................................................................................................................8
Figure 2 System block diagram..............................................................................................................9
Figure 3 LDR..........................................................................................................................................13
Figure 4 PIC 16F877A...........................................................................................................................13
Figure 5 Pin-Diagram of PIC16F877A.................................................................................................15
Figure 6 2x16 LCD.................................................................................................................................16
Figure 7 DC motor.................................................................................................................................18
Figure 8 Metal detectors using 555 timer.............................................................................................18
Figure 9 NE555......................................................................................................................................19
Figure 10 7805 IC...................................................................................................................................20
Figure 11 BC547: NPN Silicon..............................................................................................................21
Figure 12 Crystals..................................................................................................................................22
Figure 13 Step down transformer.........................................................................................................23
Figure 14 Diode Rectifier......................................................................................................................23
Figure 15 push to make switch..............................................................................................................24
JU-JiT June 2014
72
VCIS
Figure 16 push to break switch.............................................................................................................24
Figure 17 General flowchart of the system..........................................................................................29
Figure 18 Flowchart for sensor operations and decisions...................................................................30
Figure 19 Power Supply........................................................................................................................31
Figure 20 Sensing and Signaling section..............................................................................................32
Figure 21 Display and Counter Section................................................................................................33
Figure 22 Door Control section.............................................................................................................34
Figure 23 Screen shoot for login window.............................................................................................36
Figure 24 Screen shoot for admin menu...............................................................................................36
Figure 25 Screen shoot for user registration pane...............................................................................37
Figure 26 Screen shoot for entry...........................................................................................................38
Figure 27 Screen shoot for exit.............................................................................................................38
Figure 28 Screen shoot for report generation of visitors.....................................................................39
Figure 29 Screen shoot for daily report generation of visitors...........................................................39
Sensors: This block is to check the entry or exit of a candidate. Infrared transmitter and
receiver are using here with voltage comparator.
Micro-Controller: To control the whole system. Process input data from sensor unit and
provide output to display.
Power Unit: used to supply +5v DC to all components.
LCD: To display the information from the sensor through the microcontroller and
counter.
Motor: to close and open gates depending on sensor input.
In this circuit, two LDR sensor modules are used each for up and down counting, respectively.
Whenever an interruption is observed by the first LDR sensor, it increments the counter value.
Similarly, when the second sensor detects an obstacle, the count is decremented.
The count value is calculated depending upon the sensors’ input and is displayed on an LCD by
using the concept of multiplexing.
The two LDR sensors detect interruption of the LDR beam and generate clock pulse for the
microcontroller. The microcontroller controlscounting and displays the number of persons
present inside the Libraries or Conference Halls on LCD.
72
VCIS
Chapter IV
72
VCIS
5. PIC16F877A Microcontroller
6. LCD
7. Motor-DC
8. L293D Motor Driver IC
Software tools used
1. Proteus Design Suit Version 8.0
2. Micro C For PIC
4.1.2 Resistors
Resistor is a passive component that resists the flow of direct or alternating electric circuit.The
resistance of the resistor can be estimated by their color codes. There are some nonlinear
resistors whose resistance changes with temperature or light.
4.1.3 Capacitors
A capacitor is a passive two-terminal electrical component used to store energy electrostatically
in an electric field.Contain at least two electrical conductors (plates) separated by a dielectric
(insulator).Capacitors are used for smoothing power supply variations, coupling the various
stages of audio system, tuning in radio circuits, and store energy like in camera flash.
72
VCIS
4.1.4 LDR
LDRs or Light Dependent Resistors are very useful especially in light/dark sensor circuits.
Normally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms, but when
they are illuminated with light resistance drops dramatically.
Electronic opto sensors are the devices that alter their electrical characteristics, in the presences
of visible or invisible light. The best-known devices of this type are the light dependent resistor
(LDR), the photo diode and the phototransistors.
Light dependent resistor as the name suggests depends on light for the variation of resistance.
LDR are made by depositing a film of cadmium sulphide or cadmium selenide on a
substrate of ceramic containing no or very few free electrons when not illuminated. The
film is deposited in a zigzag fashion in the form of a strip. The longer the strip the more
the value of resistance.
When light falls on the strip, the resistance decreases. In the absence of light the
resistance can be in the order of 10K ohm to 15K ohm and is called the dark resistance.
Depending on the exposure of light the resistance can fall down to value of 500 ohms. The
power ratings are usually smaller and are in the range 50mw to .5w. Though very sensitive to
light, the switching time is very high and hence cannot be used for high frequency applications.
They are used in chopper amplifiers.
Light dependent resistors are available as discs 0.5cm to 2.5cm. The resistance rises to several
Mega ohms under dark conditions.
The below figure shoes that when the torch is turned on, the resistance of the LDR falls,
allowing current to pass through it is shown in figure.
72
VCIS
Figure 3 LDR
The basic construction and symbol for LDR are shown in above figures respectively. The
device consists of a pair of metal film contacts. Separated by a snakelike track of cadmium
sulphide film, designed to provide the maximum possible contact area with the two metal films.
The structure is housed in a clear plastic or resin case, to provide free access to external light.
Practical LDRs are available in variety of sizes and packages styles, the most popular size
having a face diameter of roughly 10mm.
72
VCIS
One of the main advantages is that each pin is only shared between two or three functions so it’s
easier to decide what the pin function (other devices have up to 5 functions for a pin).
Note: A disadvantage of the device is that it has no internal oscillator so you will need an
external crystal of other clock source.
Features of PIC16F877A
Peripheral Features
33 I/O pins : 5 I/O ports
Timer0:8-bit timer/counter with 8-bit prescaler
JU-JiT June 2014
72
VCIS
Timer1:16-bit timer/counter with prescaler
Synchronous serial port with two modes
USART/SCI with 9-bit address detection
Parallel slave port
Brown-out detection circuitry for brown-out reset
Analog Features
72
VCIS
4.1.6 2x16 LCD
A 2x16 LCD display is very basic module and is very commonly used in various devices and
circuits. These modules are preferred over seven segments and other multi segment LEDs. The
reasons being: LCDs are economical; easily programmable; have no limitation of displaying
special & even custom characters (unlike in seven segments), animations and so on.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD
each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command
and Data.
The command register stores the command instructions given to the LCD. A command is an
instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting
the cursor position, controlling display etc. The data register stores the data to be displayed on
the LCD. The data is the ASCII value of the character to be displayed on the LCD.
Features
LCD can add a lot to your application in terms of providing a useful interface for the
user, debugging an application. LCD has single line display, two-line display, and four
line display. Every line has 16 characters.
Here we use two line 16 character i.e. 16x2 LCD. The total number of objects is display
on the LCD module.
5 x 8 dots with cursor
72
VCIS
Table 1 PIN DISCRIPTION OF 2x16 LCD
Pin
Function Name
No
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V) Vcc
3 Contrast adjustment; through a variable resistor VEE
4 Selects command register when low; and data register when high Register Select
5 Low to write to the register; High to read from the register Read/write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
4.1.7 Simple DC motor
Motors convert electrical energy (from a battery or voltage source) into mechanical energy
(used to cause rotation). DC motor is an electrical motor that runs on direct current (DC)
electricity.
Brushless DC electric motor also known as electronically commutated motors are synchronous
motors that are powered by a DC electric source via an integrated inverter/switching power
supply, which produces an AC electric signal to drive the motor.
72
VCIS
In this context, AC, alternating current, does not imply a sinusoidal waveform, but rather a bi-
directional current with no restriction on waveform. Additional sensors and electronics control
the inverter output amplitude and waveform and frequency.
Figure 7 DC motor
When a magnet is brought close to the 10mH choke, the output frequency changes. This metal
kind of metal detector can be powered from an output that can provide 6 to 12V DC. If a metal
is close to the L1 col, will produce a change of output oscillation frequency that will generate a
sound in the 8 ohm speakers.
4.1.8 NE555:
The 555 integrated circuit is a highly accurate timing circuit that is capable of producing
both time delays or oscillation. The 556 device has two individual 555 timer circuits
housed in a single package.
72
VCIS
Figure 9 NE555
Pin Descriptions:
V+ - Supply voltage.
GND - GND (0V) connection for supply voltage.
Threshold - Active high input pin that is used to monitor the charging of the
timing capacitor.
Control Voltage - Used to adjust the threshold voltage if required. This should be left
disconnected if the function is not required. A 0.01uF capacitor to GND can be used
in electrically noisy circuits.
Trigger - Active low trigger input that start the timer.
Discharge - Output pin that is used to discharge the timingcapacitor.
Out = Timer output pin.
Reset - Active low reset pin. Normally connected to V+ if the resetfunction is not
required.
Operation:
The 555 timer is a simple circuit. By taking the trigger signal fromhigh to low the flip-flop is
set. This causes the output to go high and the discharge pin to be released from Gnd (0V). The
releasing of the discharge pin from GND causes an external capacitor to begincharging.
72
VCIS
When the capacitor is charges the voltage across itincreases. This results in the voltage on the
threshold pinincreasing. When this is high enough it will result in the threshold Pin to
causing the flip-flop to reset. This causes the output to go low and the discharge pin is also
taken back to Gnd. This dischargesthe external capacitor ready for the next time the device is
triggered.
Figure 10 7805 IC
Description:
The MC78XX/LM78XX/MC78XXA series of three terminal positive regulators are available in
the TO-220/D-PAK package and with several fixed output voltages, making them useful in a
wide range of applications. Each type employs internal current limiting, thermal shut
down and safe operating area protection, making it essentially indestructible. If adequate
heat sinking is provided, they can deliver over 1A output current.
72
VCIS
Although designed primarily as fixed voltage regulators, these devices can be used
with external components to obtain adjustable voltages and currents.
72
VCIS
It provide very high initial accuracy and a moderately low temperature coefficient. Operation is
guaranteed over a range of conditions. Crystal oscillator modules and fully integrated silicon
oscillators are most common. Crystal oscillator modules provide accuracy similar to discrete
component circuits using crystals. Silicon oscillators are more precise than discrete component
RC oscillator circuits, and many provide comparable accuracy to ceramic resonator-based
oscillators.
Figure 12 Crystals
72
VCIS
72
VCIS
When the input connected to the left corner is negative, and the input connected to the right
corner is positive, current flows from the lower supply terminal to the right along the red
(positive) path to the output, and returns to the upper supply terminal via the blue (negative)
path.
4.1.14 Push Switch:
A push switch is a momentary or non-latching switch which causes a temporary change in the
state of an electrical circuit only while the switch is physically actuated. An automatic
mechanism (i.e. a spring) returns the switch to its default position immediately afterwards,
restoring the initial circuit condition. There are two types:
1. A push to make switch allows electricity to flow between its two contacts when held in.
When the button is released, the circuit is broken. This type of switch is also known as a
Normally Open (NO) Switch. (Examples: doorbell, computer case power switch,
calculator buttons, individual keys on a keyboard)
2. A push to break switch does the opposite, i.e. when the button is not pressed, electricity
can flow, but when it is pressed the circuit is broken.
This type of switch is also known as a Normally Closed (NC) Switch. (Examples: Fridge
Light Switch, Alarm Switches in Fail-Safe circuits)
72
VCIS
4.2 Software Requirements and description
4.2.1 Proteus design suit v 8.0
For real design and simulation proteus is used.
Proteus is a Virtual System Modeling (VSM) that combines circuit simulation, animated
components and microprocessor models to co-simulate the complete microcontroller
baseddesigns. This is the perfect tool for engineers to test their microcontroller designs before
constructing a physical prototype in real time.
Features:
A new application framework lets you view modules of Proteus as tabs in a single
window or, via drag and drop, as separate windows for a side-by-side view
A new common parts database enables sharing of information between schematic and
PCB so that changes to data are instantly reflected across the software.
A new live net list means changes to connectivity in the schematic can be instantly
reflected in the PCB, the Bill of Materials and the Design Explorer.
The new integrated VSM Studio IDE binds your firmware project to your schematic
design and Active Popups bring the schematic into your VSM Studio debug session.
4.2.2 MikroC
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.
The software is written in ‘C’ language and compiled using micro ‘C’ compiler. The source
program is converted into hex code by the compiler. 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.
Features:
JU-JiT June 2014
72
VCIS
Write your C source code using the built-in Code Editor (Code and Parameter assistants,
Code Folding, Syntax Highlighting, Auto Correct, Code Templates, band more.)
Monitor your program structure, variables, and functions in the Code Explorer.
Generate commented, human-readable assembly, and standard HEX compatible with all
programmers.
Use the integrated mikroICD (In-Circuit Debugger) Real-Time debugging tool to flow
graph for the Overall working principles of the motor driving Software monitor program
execution on the hardware level.
Inspect program flow and debug executable logic with the integrated Software
simulator.
Get detailed reports and graphs: RAM and ROM map, code statistics, assembly listing,
calling tree, and more.
MicroC PRO for PIC provides plenty of examples to expand, develop, and use as
building bricks in your projects.
Programing language
4.2.3 C Language
C has now become a widely used professional language for various reason:
72
VCIS
decremented during exit. Count remain the same if both sensors detect movement at same time.
The following conditions are considered during the overall operation of this system.
Condition 1:
Switch on
Sensor 1 detects an entry therefore it gets on
Sensor 2 detects no movement therefore its off
Result
Door 1 gets opened
Door 2 remain closed
Count incremented (count ++)
Condition 2:
Switch on
Sensor 1 detects no movement (no entry) therefore it’s off
Sensor 2 detects movement (exit) thus it gets on
Results
Door 1 closed
Door 2 opened
Count decremented from the previously stored count on condition 1 (count --).
Condition 3:
Switch on
Both sensor 1 and sensor 2 doesn’t detect any movement, hence both are off.
Result
Both doors are closed.
Count remains the same like it was before.
Condition 4:
Switch on
Both sensor 1 and Sensor 2 detecting movement at the same time.
Result
Both doors get opened
Condition 5:
JU-JiT June 2014
72
VCIS
When Count is greater than the pre specified maximum count to be accounted by the room
Switch on
Result
Door 1 closed (system doesn’t allow any further entrance to the room.)
Door 2 opened (exiting allowed)
Condition 6:
Switch off
Sensors not detecting
System inactive
Result
Both Door 1 and Door 2 are closed
Count remain the same (only displayed)
72
VCIS
72
VCIS
72
VCIS
Description
In above circuit we have used a regulated power supply, a Step-down transformer TR2 is used
which gives 5 volt ac from 230V ac. Four IN 4007 diodes are used which forms a bridge.
Threecapacitors C1 of 470µf, C2 of 0.01 nf and C3 of 0.01 nf are used for filter
purpose. The regulated IC 7805 is used for voltage regulating purpose.
Working principle:
A bridge rectifier which is made up of from four diodes rectifies the input 5 volt from the step
down transformer. This rectified output is given to C1 & C3 capacitors for filtering purpose.
The output from C3 is given to pin no.1 of 7805 IC. The 7805 is regulated IC which regulates
the voltage from C3 capacitor. +5V DC output is taken from pin no 3 of 7805 IC. The ground is
taken from pin no 2 of 7805 IC.
72
VCIS
Depending on the amount of light illumination on the LDR its possible to know if a person is
passing by or not. Depending on the exposure of light, the resistance can fall down to value of
500 ohms. R1 which is 10K is used to control the amount of current input to the LDR.
72
VCIS
Description
The PIC16f887A controller used for controlling & counting function. LCD (LM16200) is used
for displaying the counts. It 16*2 LCD module. There is a reset act which is combination of
C1, R1 and push button is put for resetting the microcontroller. There is resonating network
which made up from C2, C3 and crystal (11.0592). Microcontroller has an on chip oscillator.
Pull up resistor is placed to drive the LCD. Variable resistor (0-10k) is placed for setting the
brightness of the LCD.
Working
When object sense, a high pulse is generated from the sensor &signal conditioning
section, which is given to controller. Microcontroller is programmed for counting the pulses
& display the counts on the LCD. The microcontroller is continuously check the pulses from
the sensor and count. This counted pulses are in hexadecimal form, which are connected into
decimal & then into ASCII.
72
VCIS
These ASCII values of the counts are given to LCD for displaying max Lm 16200,
16*2LCD is used in which 1 strow used for displaying message. Value of the counts is
displayed in the second raw.
4.6.4 Door Control section
Working
The PIC is used to give input to the motor driver through pin 15, 16, 17, 18. Depending on the
input given from the microcontroller the motor driver IC L293D drives the motor to open or
close the desired door. This is directly proportional to the condition of the LDR sensors as well.
72
VCIS
Is a multi-paradigm programming language encompassing strong typing, imperative,
declarative, functional, generic, object-oriented (class-based), and component-oriented
programming disciplines.
Features:
Boolean Conditions
Automatic Garbage Collection
Standard Library
Assembly Versioning
Easy-to-use Generics
Simple Multithreading
Integration with Windows
This system is intended to handle the flow of visitors by using database created to register users
(students or staffs) by storing the basic information like Name, ID, Sex and Status into a user
registration table which is only to be accessed by the admin. The admin is verified by a
password authentication.
Both the entry and exiting number of visitors with their entry and exit time is stored. A user is
required to give his/her ID number before entering to a room and the same is done while
exiting, the data is entered by the admin of the system. The time of entry and exit is also stored
in a table. This information can be retrieved when needed by using the search feature the system
incorporates, searching by different preferences is possible. Search by user ID, Date and Name.
A result will be displayed containing all the entry and exit information of a registered
individual.
4.7.1 Graphical user interface
The user interface for the desktop application is designed using c#. The system has only one
user and that’s the admin to register users and view every stored information.
72
VCIS
When the admin enters the user name and password the next window (user menu) will appear.
Admin can register new individuals to the database, record their entry and exit time. a report can
be generated about who entered and at what time did they on a daily basis.
72
VCIS
When we say user it represent those individuals who are under the counting system. All the
fields must be filled with the required information. User status in this case is either student or
staff. By clicking the save button a new user is added.
72
VCIS
The admin search for a user by either their Id or Name once they are registered to the system.
Entry date and Exit time will be entered. This information is later used when daily user report
generation is needed.
72
VCIS
Chapter V
Thus the circuit can be used to monitor visitor flow in effective manner, where the visitors have
to counted and controlled.
72
VCIS
72
VCIS
References
Web links:
http://www.electronicshub.org
http://www.scribd.com
http://sjeffroy.free.fr
www.555-timer-circuits.com
http://www.wikipedia.org/
Books:
[1] Handbook of Modern Sensors: Physics, Designs, and Applicationsby Jacob Fraden. 4th
edition
[2] Programming Embedded Systems in C and C++ by Michael Barr January 1999
72
VCIS
sbitLCD_RS_Direction at TRISB4_bit;
sbitLCD_EN_Direction at TRISB5_bit;
unsignedint Count= 0;
unsignedint distance,temp,Countvalue,temp1,distance1 ;
char txt[10];
unsignedint j;
unsignedint k;
unsignedint t;
72
VCIS
unsignedintkk;
unsignedinttt;
char sensor1[6];
char sensor2[6];
voidmotor_forward()
for( j=0;j<5;j++)
PORTC=0x02;
Delay_ms(100);
k=1;
void motor2_forward()
for( j=0;j<5;j++)
PORTC=0x08;
Delay_ms(100);
t=1;
voidmotor_backward()
for( j=0;j<5;j++)
PORTC=0x01;
Delay_ms(100);
72
VCIS
kk=1;
void motor2_backward()
for( j=0;j<5;j++)
PORTC=0x04;
Delay_ms(100);
tt=1;
void main ()
TRISA = 0xFF;
TRISD=0x03;
PORTC=0x00;
PORTB=0x00;
k=0;
t=0;
Lcd_Cmd(_LCD_CLEAR);
72
VCIS
/*IntToStr(distance, sensor1);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1, 1,sensor1 );
Delay_ms(1000);
IntToStr(distance1, sensor2);
Lcd_Cmd(_LCD_CLEAR);*/
//Lcd_Out(2, 1,sensor2 );
// Delay_ms(1000);
while(1){
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
temp= ADC_Read(0);
//distance=temp*0.0048828125;
IntToStr(distance, sensor1);
temp1= ADC_Read(1);
// distance1=temp1*0.0048828125;
IntToStr(distance1, sensor2);
//Lcd_Cmd(_LCD_CLEAR);
//Lcd_Cmd(_LCD_CURSOR_OFF);
//Delay_ms(100);
PORTC.F4=1;
Lcd_Out(1,1,"door1 open");
72
VCIS
if(k!=1)
motor_forward();
Delay_ms(1000);
count++;
Lcd_Out(2,4,txt);
PORTC=0x00;
Delay_ms(10000);
else if(temp<=512 && temp1>512 && Count<=9 && Count>=0) // Exit but no Entrance
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_ms(100);
Lcd_Out(1,1,"Door2 open");
Delay_ms(100);
IntToStr(Count,txt);
if(t!=1)
motor2_forward();
Delay_ms(10000);
72
VCIS
/*if(Count==0)
Lcd_Out(2,1,"txt");
continue;
}*/
Count--;
IntToStr(Count, txt);
Lcd_Out(2, 1, txt);
PORTC=0x00;
Delay_ms(10000);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_ms(100);
Lcd_Out(1,1,"no visitor");
Delay_ms(100);
if(kk!=1){
motor_backward();
if(tt!=1 )
motor2_backward();
72
VCIS
Lcd_Out(2, 1, txt);
Delay_ms(10000);
PORTC=0x00;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_ms(100);
Delay_ms(100);
if(k!=1)
motor_forward();
if(t!=1 )
motor2_forward();
Delay_ms(10000);
PORTC=0x00;
Lcd_Out(2, 8, txt);
Delay_ms(10000);
72
VCIS
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Delay_ms(1000);
if(t!=1 )
motor2_forward();
Delay_ms(10000);
PORTC=0x00;
else
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
PORTB.B6=1;
Delay_ms(1000);
72
VCIS
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.SQLite;
namespacemainwndw
public Form1()
InitializeComponent();
72
VCIS
private void button2_Click(object sender, EventArgs e)
try
sqliteCon.Open();
string Query = "select * from login where username = '" + this.textBox1.Text + "'
and password = '" + this.textBox2.Text + "' ";
createCommand.ExecuteNonQuery();
//MessageBox.Show("data saved");
SQLiteDataReaderdr = createCommand.ExecuteReader();
int count = 0;
while (dr.Read())
count++;
if (count == 1)
textBox1.Text = "";
textBox2.Text = "";
us.Show();
this.Hide();
if (count > 1)
72
VCIS
MessageBox.Show("duplicate Username and Password");
if (count < 1)
MessageBox.Show(ex.Message);
//main menu
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
namespacemainwndw
72
VCIS
public partial class userMenu : Form
publicuserMenu()
InitializeComponent();
ur.Show();
this.Hide();
f1.Show();
this.Hide();
en.Show();
this.Hide();
72
VCIS
Exit ex = new Exit();
ex.Show();
this.Hide();
rep.Show();
this.Hide();
dre.Show();
this.Hide();
//visitor register
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
72
VCIS
usingSystem.Windows.Forms;
usingSystem.Data.SQLite;
namespacemainwndw
publicuserReg()
InitializeComponent();
try
sqliteCon.Open();
createCommand.ExecuteNonQuery();
textBox1.Text = "";
textBox2.Text = "";
comboBox1.Text = "";
comboBox2.Text = "";
MessageBox.Show("data saved");
72
VCIS
}
MessageBox.Show(ex.Message);
us.Show();
this.Hide();
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.SQLite;
namespacemainwndw
72
VCIS
public entry()
InitializeComponent();
textBox6.Text = DateTime.Now.ToShortDateString();
textBox7.Text = DateTime.Now.ToShortTimeString();
try
sqliteCon.Open();
string Query = "select * from usertbl where user_id = '" + this.textBox1.Text + "'
OR user_name ='" + this.textBox1.Text + "' ";
createCommand.ExecuteNonQuery();
SQLiteDataReaderdr = createCommand.ExecuteReader();
if (dr.Read())
textBox2.Text = dr.GetValue(0).ToString();
textBox3.Text = dr.GetValue(1).ToString();
textBox4.Text = dr.GetValue(2).ToString();
textBox5.Text = dr.GetValue(3).ToString();
textBox1.Text = "";
72
VCIS
{
MessageBox.Show(ex.Message);
try
sqliteCon.Open();
createCommand.ExecuteNonQuery();
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
MessageBox.Show("data saved");
MessageBox.Show(ex.Message);
72
VCIS
}
us.Show();
this.Hide();
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.SQLite;
namespacemainwndw
72
VCIS
public Exit()
InitializeComponent();
textBox6.Text = DateTime.Now.ToShortDateString();
textBox7.Text = DateTime.Now.ToShortTimeString();
try
sqliteCon.Open();
createCommand.ExecuteNonQuery();
SQLiteDataReaderdr = createCommand.ExecuteReader();
if (dr.Read())
textBox2.Text = dr.GetValue(0).ToString();
textBox3.Text = dr.GetValue(1).ToString();
textBox4.Text = dr.GetValue(2).ToString();
textBox5.Text = dr.GetValue(3).ToString();
textBox1.Text = "";
72
VCIS
}
MessageBox.Show(ex.Message);
try
sqliteCon.Open();
createCommand.ExecuteNonQuery();
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
72
VCIS
MessageBox.Show("data saved");
MessageBox.Show(ex.Message);
us.Show();
this.Hide();
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.SQLite;
namespacemainwndw
72
VCIS
public partial class dailyRep : Form
publicdailyRep()
InitializeComponent();
try
sqliteCon.Open();
string Query = "select * from entryTime where user_id = '" + this.textBox1.Text + "'
OR user_name ='" + this.textBox1.Text + "' OR entryDate ='" + this.textBox1.Text +
"' ";
createCommand.ExecuteNonQuery();
ad.SelectCommand = createCommand;
ad.Fill(t);
bs.DataSource = t;
dataGridView1.DataSource = bs;
ad.Update(t);
72
VCIS
string Query1 = "select exitDate, exitTime from exitTime where user_id = '" +
this.textBox1.Text + "' OR user_name ='" + this.textBox1.Text + "'OR exitDate ='" +
this.textBox1.Text + "' ";
createCommand1.ExecuteNonQuery();
ad1.SelectCommand = createCommand1;
ad1.Fill(t1);
bs1.DataSource = t1;
dataGridView2.DataSource = bs1;
ad1.Update(t1);
textBox1.Text = "";
MessageBox.Show(ex.Message);
us.Show();
this.Hide();
72
VCIS
//registerd visitor report generation
using System;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
usingSystem.Data.SQLite;
namespacemainwndw
publicrepGenera()
InitializeComponent();
try
sqliteCon.Open();
72
VCIS
// where user_id = '" + this.textBox1.Text + "' OR user_name ='"
+ this.textBox1.Text + "' ";
createCommand.ExecuteNonQuery();
ad.SelectCommand=createCommand;
ad.Fill(t);
bs.DataSource = t;
dataGridView1.DataSource = bs;
ad.Update(t);
MessageBox.Show(ex.Message);
us.Show();
this.Hide();
72
VCIS
72