You are on page 1of 75

DECLARATION

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

1. Elias Dendir ---------------------- 00298/02 -----------------

2. NaodMulu ----------------------- 00640/02 -----------------

3. TemesgenTesfaye ---------------- 00782/02 ------------------

4. AwoluAbdurahim ----------------- 00170/02 -----------------

5. KedemeSeboka --------------------- 00491/02 ------------------

College: JIT, Electrical and Computer Engineering

Program: BSC Degree

Project tittle: Visitor Counter and Information System

I certify that this project satisfies all the requirements as a project for the degree of Bachelor of
Science.

------------------------------------------ -------------------------

Name of program coordinator Signature

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.

------------------------------------- -----------------------------

Name of Advisor Signature


Abstract
Visitor counter and information system is a system to control the flow of visitor’s traffic of
specific place. The system address problem of overflow in a room and resource utilization by
providing the necessary information which can be used for future decision making for an
organization

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

Visitor Information System incorporates a graphical user interface to register visitors of a


specific place, in our case Jimma University (Staffs or Students) and monitor their movement in
a timely frame and store this information.

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

AC/DC – Alternating Current to Direct Current

C# - C Sharp

DC – Direct Current

GND – Ground

HBR – Horizontal Beam Counter

HEX – Hexadecimal

IC – Integrated Circuit

LDR – Light Dependent Resistor

LED – Light Emitting Diode

NC – Normally Closed

NO – Normally Open

PIC - Peripheral Interfacing Controller

VCIS – Visitor Counter and Information System

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.

JU-JiT June 2014

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.

JU-JiT June 2014

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.

1.3.2 Specific Objectives


The specific objectives of this project

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

Significance of the system

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.

JU-JiT June 2014

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.

JU-JiT June 2014

72
VCIS
Chapter II

Literature Review
Modern people counting systems use many different technologies, each with its own advantages
and disadvantages.

2.1 Tally counter


A hand-held tally-counter, sometimes called a clicker-counter, would be used; one press per
person. To reset the counter, one would have to turn a knob, resetting most counters' display to
"0000".

2.2 Infrared beams


The simplest form of counter was a single, horizontal infrared beam across an entrance which is
typically linked to a small LCD display unit at the side of the doorway or can also be linked to a
PC or send data via wireless links and GPRS. Such a beam counts a 'tick' when the beam is
broken; therefore it is normal to divide the 'ticks' by two to get visitor numbers. Dual beam units
are also available from some suppliers and can provide low cost directional flow 'in' and 'out'
data. Accuracy depends highly on the width of the entrance monitored and the volume of traffic.

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

JU-JiT June 2014

72
VCIS
Disadvantages:

 Most basic beam sensors are limited to non-directional counts


 Can't discern people walking side-by-side
 Cannot count high volume, uninterrupted traffic
 High potential to become blocked by people standing in an entrance or by merchandise
or displays
 Infra-red bean counters may be negatively affected when subject to direct sunlight.

Observations

 No visitor counter system here in Jimma University


 Security Checks are made manually.
 Gates are operated manually.

JU-JiT June 2014

72
VCIS
Chapter III

System block diagram


3.1 Over view of embedded system
Embedded systems are electronic devices that in corporate microprocessors with in their
implementations. The main purposes of the microprocessors are to simplify the system design
and provide flexibility. Having a microprocessor in the device means that removing the bugs,
making modifications, or adding new features are only matters of rewriting the software that
controls the device. Or in other words embedded computer systems are electronic systems that
include a microcomputer to perform a specific dedicated application. The computer is hidden
inside these products. Embedded systems are ubiquitous. Every week millions of tiny computer
chips come pouring out of factories finding their way into our everyday products.

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

3.2 System block diagram description


Sensor part:They are used to measure and/or detect a huge variety of conditions including:
temperature, pressure, level, humidity, speed, motion, distance, light or the presence/absence of
an object and many other types. So the sensor part is used to determine the motion of the visitor.

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.

The general block diagram is show bellow:

JU-JiT June 2014

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

Figure 2 System block diagram

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

JU-JiT June 2014

72
VCIS

Chapter IV

System Design and Implementation


4.1 Components used
1. Power Supply
2. Resistors
3. Capacitors
4. LDR (Light Dependent Resistor)

JU-JiT June 2014

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.1 Power Supply


A power supply is an electronic device that supplies electric power to an electrical load. The
primary function of a power supply is to convert one form of electrical energy to another and, as
a result, power supplies are sometimes referred to as electric power converters. In the AC/DC
power conversion a rectifier is used to convert the transformer output voltage (AC) to a varying
DC voltage, which in turn is passed through an electronic filter to convert it to an unregulated
DC voltage. The filter removes most, but not all of the AC voltage variations; the remaining
voltage variations are known as ripple to get +5V DC input for the Microcontroller.

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.

JU-JiT June 2014

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.

JU-JiT June 2014

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.

4.1.5 PIC 16F877A Microcontroller

Figure 4 PIC 16F877A


This device has 40 pins which make it easier to use the peripherals as the functions are spread
out over the pins and to decide what external devices to attach without worrying too much if
there enough pins to do the job.

JU-JiT June 2014

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

 High-performance RISC CPU


 Lead-free: RoHS-compliant
 Operating speed:20Mhz, 200ns instruction cycle
 Operating voltage:4.0-5.5volts
 Industrial temperature range(-40 to +85 degrees)
 15 Interrupt source
 35 single word instructions
 All single-cycle instructions except for program branches

 Special Microcontroller Features

 Flash memory:14.3KB(8192 words)


 Data SRAM:368 bytes
 Data EEPROM:256 bytes
 Self-reprogrammable under software control
 In-circuit serial programming via two pins
 Watchdog timer with on-chip RC oscillator
 Programmable code protection
 Power-saving code protection
 Selectable oscillator option

 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

 10-bit, 8-channel A/D converter


 Brown-out reset
 Analog comparable module

Figure 5 Pin-Diagram of PIC16F877A

JU-JiT June 2014

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

 Built-in controller (KS 0066 or Equivalent)

 + 5V power supply (Also available for + 3V)

Figure 6 2x16 LCD

JU-JiT June 2014

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.

JU-JiT June 2014

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

Metal detectors using 555 timer

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.

Figure 8 Metal detectors using 555 timer

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.

JU-JiT June 2014

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.

JU-JiT June 2014

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.

4.1.9 7805 Regulated IC


Features:
 Output Current up to 1A
 Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
 Thermal Overload Protection
 Short Circuit Protection
 Output Transistor Safe Operating Area Protection

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.

JU-JiT June 2014

72
VCIS
Although designed primarily as fixed voltage regulators, these devices can be used
with external components to obtain adjustable voltages and currents.

4.1.10 BC547: NPN Silicon


BC547 is an NPN bi-polar junction transistor. A transistor, stands for transfer of resistance, is
commonly used to amplify current. A small current at its base controls a larger current at
collector & emitter terminals.
BC547 is mainly used for amplification and switching purposes. It has a maximum current gain
of 800. Its equivalent transistors are BC548 and BC549.
The transistor terminals require a fixed DC voltage to operate in the desired region of its
characteristic curves. This is known as the biasing. For amplification applications, the transistor
is biased such that it is partly on for all input conditions. The input signal at base is amplified
and taken at the emitter. BC547 is used in common emitter configuration for amplifiers. The
voltage divider is the commonly used biasing mode.

Figure 11 BC547: NPN Silicon


4.1.11 Crystals:
The majority of clock sources for microcontrollers is mechanical resonant devices, such as
crystals and ceramic resonators.

JU-JiT June 2014

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

4.1.12 Step-down Transformer


A transformer is an electrical device that transfers energy between two or more circuits through
electromagnetic induction.
Step up transformer:On a step-up transformer there are more turns on the secondary coil than
the primary coil. The induced voltage across the secondary coil is greater than the applied
voltage across the primary coil or in other words the voltage has been “stepped-up”.
Step down transformer: A step down transformer has less turns on the secondary coil that the
primary coil. The induced voltage across the secondary coil is less the applied voltage across the
primary coil or in other words the voltage is “stepped-down”.
The input 230v AC is given to the primary winding of the transformer and we get output from
the secondary winding.

JU-JiT June 2014

72
VCIS

Figure 13 Step down transformer

4.1.13 Diode Rectifier:


Rectifier diodes are used in power supplies to convert alternating current (AC) to direct current
(DC), a process called rectification. They are also used elsewhere in circuits where a large
current must pass through the diode.
All rectifier diodes are made from silicon and therefore have a forward voltage drop of 0.7V.
The table shows maximum current and maximum reverse voltage for some popular rectifier
diodes. The 1N4001 is suitable for most low voltage circuits with a current of less than 1A.

Figure 14 Diode Rectifier


In the diagrams above, when the input connected to the left corner of the diamond is positive,
and the input connected to the right corner is negative, current flows from the upper supply
terminal to the right along the red (positive) path to the output, and returns to the lower supply
terminal via the blue (negative) path.

JU-JiT June 2014

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)

Figure 15 push to make switch

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)

Figure 16 push to break switch

JU-JiT June 2014

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:

 It has high level constructs


 It has handle low level activities
 It produces efficient programs

4.3 Overall working Algorithm


Sensor 1 represent Entry sensor and Sensor 2 represent an exit sensor. Door 1 stands for entry
door, Door 2 is for exit door. Count is incremented when an entry is detected, count to be
JU-JiT June 2014

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)

4.4General flowchart of the system

JU-JiT June 2014

72
VCIS

Figure 17 General flowchart of the system

4.5Flowchart for sensor operations and decisions

JU-JiT June 2014

72
VCIS

Figure 18 Flowchart for sensor operations and decisions

4.6Simulated circuit description


We have seen the major components of our system, now let’s take a look at the different sections
of the circuit one by one
JU-JiT June 2014

72
VCIS

4.6.1 Power Supply


This is the power supply unit we have used for the generation of +5v input for all components.

Figure 19 Power Supply

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.

4.6.2 Sensing and signaling section

JU-JiT June 2014

72
VCIS

Figure 20 Sensing and Signaling section

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.

4.6.3 Display and Counter Section:

JU-JiT June 2014

72
VCIS

Figure 21 Display and Counter Section

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.

JU-JiT June 2014

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

Figure 22 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.

4.7 Visitor Information System


C# Language

JU-JiT June 2014

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.

JU-JiT June 2014

72
VCIS

Figure 23 Screen shoot for login window

When the admin enters the user name and password the next window (user menu) will appear.

Figure 24 Screen shoot for admin menu

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.

JU-JiT June 2014

72
VCIS

Figure 25 Screen shoot for user registration pane

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.

Figure 26 Screen shoot for entry

JU-JiT June 2014

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.

Figure 27 Screen shoot for exit


To check the exiting of a visitor at a specific time and date. The data entered here can only be
stored for a previously registered visitor at the exit.

Figure 28 Screen shoot for report generation of visitors


This section lets the admin view the registered visitors of the system with all the details of an
individual.
JU-JiT June 2014

72
VCIS

Figure 29 Screen shoot for daily report generation of visitors


Admin can search for user by their Id/Name/Date to load the daily report of visitors. The user
status, entry date and exit time are the attributes of the report.

Chapter V

Conclusion and Recommendation


5.1 Conclusion
This the project isintended for counting visitors entering and exiting a particular passage or
way. The circuit counts both entering and exiting visitors and displays the number of visitors
present inside a room. Visitor counting is not limited to the entry/exit point of a company but
has a wide range of applications that provide information to management on the volume and
flow of people throughout a location. The visitor helps to maximize the efficiency and
effectiveness of employees, floor area and sales potential of an organization.

Thus the circuit can be used to monitor visitor flow in effective manner, where the visitors have
to counted and controlled.

JU-JiT June 2014

72
VCIS

5.2 Future Recommendations


The system can be deployed anywhere where it’s necessary to count the number of visitors, in
order to make effective business decision and to maximize resource utilization. The system can
also be upgraded with the use of camera’s and fingerprint scanners in order to enhance the
security features. We can interface GSM modem to send this data through SMS. It’s also very
feasible to integrate this system with the current Jimma University student database for the
availability of timely and precise information whenit’s deployed.

JU-JiT June 2014

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

JU-JiT June 2014

72
VCIS

Appendix A-code for mikroC


sbit LCD_RS at RB4_bit;

sbit LCD_EN at RB5_bit;

sbit LCD_D7 at RB3_bit;

sbit LCD_D6 at RB2_bit;

sbit LCD_D5 at RB1_bit;

sbit LCD_D4 at RB0_bit;

sbitLCD_RS_Direction at TRISB4_bit;

sbitLCD_EN_Direction at TRISB5_bit;

sbit LCD_D7_Direction at TRISB3_bit;

sbit LCD_D6_Direction at TRISB2_bit;

sbit LCD_D5_Direction at TRISB1_bit;

sbit LCD_D4_Direction at TRISB0_bit;

unsignedint Count= 0;

unsignedint distance,temp,Countvalue,temp1,distance1 ;

char txt[10];

unsignedint j;

unsignedint k;

unsignedint t;

JU-JiT June 2014

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);

JU-JiT June 2014

72
VCIS
kk=1;

void motor2_backward()

for( j=0;j<5;j++)

PORTC=0x04;

Delay_ms(100);

tt=1;

void main ()

TRISA = 0xFF;

TRISC=0x00; //set direction to be output

TRISD=0x03;

PORTC=0x00;

PORTB=0x00;

k=0;

t=0;

Lcd_Init(); // Initialize LCD

// make PORTD0 pin input -> up/down input

Lcd_Cmd(_LCD_CLEAR);

Lcd_Cmd(_LCD_CURSOR_OFF); //clear LCD screen

Lcd_Out(1,2,"starting..."); //write message on LCD

Delay_ms(1000); //some delay

JU-JiT June 2014

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);

if(PORTD.B0==1 && Count<=9 )

if(temp>512 && temp1<=512 && Count<=9 ) //entrance, no exit

//Lcd_Cmd(_LCD_CLEAR);

//Lcd_Cmd(_LCD_CURSOR_OFF);

//Delay_ms(100);

PORTC.F4=1;

Lcd_Out(1,1,"door1 open");

JU-JiT June 2014

72
VCIS

if(k!=1)

motor_forward();

Delay_ms(1000);

count++;

IntToStr(Count, txt); // Transform counter value to string

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);

JU-JiT June 2014

72
VCIS
/*if(Count==0)

Lcd_Out(2,1,"txt");

continue;

}*/

Count--;

// Transform counter value to string

IntToStr(Count, txt);

Lcd_Out(2, 1, txt);

PORTC=0x00;

Delay_ms(10000);

else if ( temp<=512 && temp1<=512 && Count<=9 && Count>=0)

Lcd_Cmd(_LCD_CLEAR);

Lcd_Cmd(_LCD_CURSOR_OFF);

Delay_ms(100);

Lcd_Out(1,1,"no visitor");

Delay_ms(100);

//motor status should be checked

if(kk!=1){

motor_backward();

if(tt!=1 )

motor2_backward();

JU-JiT June 2014

72
VCIS

IntToStr(Count, txt); // Transform counter value to string

Lcd_Out(2, 1, txt);

Delay_ms(10000);

PORTC=0x00;

else//there is person entering or leaving continouslly

Lcd_Cmd(_LCD_CLEAR);

Lcd_Cmd(_LCD_CURSOR_OFF);

Delay_ms(100);

Lcd_Out(1,1,"equal exit and entery");

Delay_ms(100);

if(k!=1)

motor_forward();

if(t!=1 )

motor2_forward();

Delay_ms(10000);

PORTC=0x00;

IntToStr(Count, txt); // Transform counter value to string

Lcd_Out(2, 8, txt);

Delay_ms(10000);

JU-JiT June 2014

72
VCIS

else if(PORTD.B0==1 && Count==10)

Lcd_Cmd(_LCD_CLEAR);

Lcd_Cmd(_LCD_CURSOR_OFF);

Lcd_Out(2, 10, "full");

Delay_ms(1000);

if(t!=1 )

motor2_forward();

Delay_ms(10000);

PORTC=0x00;

else

Lcd_Cmd(_LCD_CLEAR);

Lcd_Cmd(_LCD_CURSOR_OFF);

Lcd_Out(1, 1, "system not active");

PORTB.B6=1;

Delay_ms(1000);

JU-JiT June 2014

72
VCIS

Appendix B Code for C#


// admin login

using System;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SQLite;

namespacemainwndw

public partial class Form1 : Form

stringdbConnectionString = @"Data Source = elia.sqlite;version=3;";

public Form1()

InitializeComponent();

JU-JiT June 2014

72
VCIS
private void button2_Click(object sender, EventArgs e)

SQLiteConnectionsqliteCon = new SQLiteConnection(dbConnectionString);

try

sqliteCon.Open();

//string Query = "insert into employee(username, password) values('"


+ this.textBox1.Text + "','" + this.passwordBox1.Password + "' )";

string Query = "select * from login where username = '" + this.textBox1.Text + "'
and password = '" + this.textBox2.Text + "' ";

SQLiteCommandcreateCommand = new SQLiteCommand(Query, sqliteCon);

createCommand.ExecuteNonQuery();

//MessageBox.Show("data saved");

SQLiteDataReaderdr = createCommand.ExecuteReader();

int count = 0;

while (dr.Read())

count++;

if (count == 1)

textBox1.Text = "";

textBox2.Text = "";

userMenu us = new userMenu();

us.Show();

this.Hide();

if (count > 1)

JU-JiT June 2014

72
VCIS
MessageBox.Show("duplicate Username and Password");

if (count < 1)

MessageBox.Show("not correct Username and Password");

catch (Exception ex)

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

JU-JiT June 2014

72
VCIS
public partial class userMenu : Form

publicuserMenu()

InitializeComponent();

private void button1_Click(object sender, EventArgs e)

userRegur = new userReg();

ur.Show();

this.Hide();

private void button5_Click(object sender, EventArgs e)

Form1 f1 = new Form1();

f1.Show();

this.Hide();

private void button4_Click(object sender, EventArgs e)

entry en = new entry();

en.Show();

this.Hide();

private void button3_Click(object sender, EventArgs e)

JU-JiT June 2014

72
VCIS
Exit ex = new Exit();

ex.Show();

this.Hide();

private void button2_Click(object sender, EventArgs e)

repGenera rep = new repGenera();

rep.Show();

this.Hide();

private void button6_Click(object sender, EventArgs e)

dailyRepdre = new dailyRep();

dre.Show();

this.Hide();

//visitor register

using System;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

JU-JiT June 2014

72
VCIS
usingSystem.Windows.Forms;

usingSystem.Data.SQLite;

namespacemainwndw

public partial class userReg : Form

stringdbConnectionString = @"Data Source = elia.sqlite;version=3;";

publicuserReg()

InitializeComponent();

private void button1_Click(object sender, EventArgs e)

SQLiteConnectionsqliteCon = new SQLiteConnection(dbConnectionString);

try

sqliteCon.Open();

string Query = "insert into usertbl(user_id, user_name, user_sex, user_status)


values('" + this.textBox1.Text + "','" + this.textBox2.Text + "','" +
this.comboBox1.Text + "','" + this.comboBox2.Text + "' )";

SQLiteCommandcreateCommand = new SQLiteCommand(Query, sqliteCon);

createCommand.ExecuteNonQuery();

textBox1.Text = "";

textBox2.Text = "";

comboBox1.Text = "";

comboBox2.Text = "";

MessageBox.Show("data saved");

JU-JiT June 2014

72
VCIS
}

catch (Exception ex)

MessageBox.Show(ex.Message);

private void button2_Click(object sender, EventArgs e)

userMenu us = new userMenu();

us.Show();

this.Hide();

//visitor entry information saving

using System;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SQLite;

namespacemainwndw

public partial class entry : Form

stringdbConnectionString = @"Data Source = elia.sqlite;version=3;";

JU-JiT June 2014

72
VCIS
public entry()

InitializeComponent();

textBox6.Text = DateTime.Now.ToShortDateString();

textBox7.Text = DateTime.Now.ToShortTimeString();

private void label1_Click(object sender, EventArgs e)

private void button1_Click(object sender, EventArgs e)

SQLiteConnectionsqliteCon = new SQLiteConnection(dbConnectionString);

try

sqliteCon.Open();

string Query = "select * from usertbl where user_id = '" + this.textBox1.Text + "'
OR user_name ='" + this.textBox1.Text + "' ";

SQLiteCommandcreateCommand = new SQLiteCommand(Query, sqliteCon);

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 = "";

catch (Exception ex)


JU-JiT June 2014

72
VCIS
{

MessageBox.Show(ex.Message);

private void button2_Click(object sender, EventArgs e)

SQLiteConnectionsqliteCon = new SQLiteConnection(dbConnectionString);

try

sqliteCon.Open();

string Query = "insert into entryTime(user_id, user_name, user_sex, user_status,


entryDate, entryTime) values('" + this.textBox2.Text + "','" + this.textBox3.Text +
"','" + this.textBox4.Text + "','" + this.textBox5.Text + "','" + this.textBox6.Text
+ "','" + this.textBox7.Text + "' )";

SQLiteCommandcreateCommand = new SQLiteCommand(Query, sqliteCon);

createCommand.ExecuteNonQuery();

textBox2.Text = "";

textBox3.Text = "";

textBox4.Text = "";

textBox5.Text = "";

textBox6.Text = "";

textBox7.Text = "";

MessageBox.Show("data saved");

catch (Exception ex)

MessageBox.Show(ex.Message);

JU-JiT June 2014

72
VCIS
}

private void button3_Click(object sender, EventArgs e)

userMenu us = new userMenu();

us.Show();

this.Hide();

//visitor exit information saving

using System;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.Data.SQLite;

namespacemainwndw

public partial class Exit : Form

stringdbConnectionString = @"Data Source = elia.sqlite;version=3;";

JU-JiT June 2014

72
VCIS
public Exit()

InitializeComponent();

textBox6.Text = DateTime.Now.ToShortDateString();

textBox7.Text = DateTime.Now.ToShortTimeString();

private void button1_Click_1(object sender, EventArgs e)

SQLiteConnectionsqliteCon = new SQLiteConnection(dbConnectionString);

try

sqliteCon.Open();

//string Query = "CREATE TABLE Employee (empIdInt,


firstnameVARCHAR(100),lastname VARCHAR(100),sex VARCHAR(10), age Int(3),phone
VARCHAR(20), PRIMARY KEY(empId ASC))";

string Query = "select * from entryTime where user_id = '" +


this.textBox1.Text + "' OR user_name ='" + this.textBox1.Text + "'";

SQLiteCommandcreateCommand = new SQLiteCommand(Query, sqliteCon);

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 = "";

JU-JiT June 2014

72
VCIS
}

catch (Exception ex)

MessageBox.Show(ex.Message);

private void button2_Click(object sender, EventArgs e)

SQLiteConnectionsqliteCon = new SQLiteConnection(dbConnectionString);

try

sqliteCon.Open();

//string Query = "CREATE TABLE Employee (emploIdint IDENTITY (100,1)


PRIMARY KEY, firstname VARCHAR(100),lastname VARCHAR(100),sex VARCHAR(10), age
Int(3),phone VARCHAR(20))";

string Query = "insert into exitTime(user_id, user_name, user_sex, user_status,


exitDate, exitTime) values('" + this.textBox2.Text + "','" + this.textBox3.Text +
"','" + this.textBox4.Text + "','" + this.textBox5.Text + "','" + this.textBox6.Text
+ "','" + this.textBox7.Text + "' )";

SQLiteCommandcreateCommand = new SQLiteCommand(Query, sqliteCon);

createCommand.ExecuteNonQuery();

textBox2.Text = "";

textBox3.Text = "";

textBox4.Text = "";

textBox5.Text = "";

textBox6.Text = "";

textBox7.Text = "";

JU-JiT June 2014

72
VCIS
MessageBox.Show("data saved");

catch (Exception ex)

MessageBox.Show(ex.Message);

private void button3_Click(object sender, EventArgs e)

userMenu us = new userMenu();

us.Show();

this.Hide();

// daily 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

JU-JiT June 2014

72
VCIS
public partial class dailyRep : Form

stringdbConnectionString = @"Data Source = elia.sqlite;version=3;";

publicdailyRep()

InitializeComponent();

private void button2_Click(object sender, EventArgs e)

SQLiteConnectionsqliteCon = new SQLiteConnection(dbConnectionString);

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 +
"' ";

SQLiteCommandcreateCommand = new SQLiteCommand(Query, sqliteCon);

createCommand.ExecuteNonQuery();

SQLiteDataAdapter ad = new SQLiteDataAdapter();

ad.SelectCommand = createCommand;

DataTable t = new DataTable();

ad.Fill(t);

BindingSourcebs = new BindingSource();

bs.DataSource = t;

dataGridView1.DataSource = bs;

ad.Update(t);

JU-JiT June 2014

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 + "' ";

SQLiteCommand createCommand1 = new SQLiteCommand(Query1, sqliteCon);

createCommand1.ExecuteNonQuery();

SQLiteDataAdapter ad1 = new SQLiteDataAdapter();

ad1.SelectCommand = createCommand1;

DataTable t1 = new DataTable();

ad1.Fill(t1);

BindingSource bs1 = new BindingSource();

bs1.DataSource = t1;

dataGridView2.DataSource = bs1;

ad1.Update(t1);

textBox1.Text = "";

catch (Exception ex)

MessageBox.Show(ex.Message);

private void button1_Click(object sender, EventArgs e)

userMenu us = new userMenu();

us.Show();

this.Hide();

JU-JiT June 2014

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

public partial class repGenera : Form

stringdbConnectionString = @"Data Source = elia.sqlite;version=3;";

publicrepGenera()

InitializeComponent();

private void button2_Click(object sender, EventArgs e)

SQLiteConnectionsqliteCon = new SQLiteConnection(dbConnectionString);

try

sqliteCon.Open();

string Query = "select * from usertbl";

JU-JiT June 2014

72
VCIS
// where user_id = '" + this.textBox1.Text + "' OR user_name ='"
+ this.textBox1.Text + "' ";

SQLiteCommandcreateCommand = new SQLiteCommand(Query, sqliteCon);

createCommand.ExecuteNonQuery();

SQLiteDataAdapter ad = new SQLiteDataAdapter();

ad.SelectCommand=createCommand;

DataTable t = new DataTable();

ad.Fill(t);

BindingSourcebs = new BindingSource();

bs.DataSource = t;

dataGridView1.DataSource = bs;

ad.Update(t);

catch (Exception ex)

MessageBox.Show(ex.Message);

private void button1_Click(object sender, EventArgs e)

userMenu us = new userMenu();

us.Show();

this.Hide();

JU-JiT June 2014

72
VCIS

Appendix C - Total System

JU-JiT June 2014

72

You might also like