Professional Documents
Culture Documents
CHAPTER ONE
1.0 INTRODUCTION
Many times we need to monitor the person/people visiting some place like Seminar hall,
conference room or Shopping mall or temple. This project can be used to count and display
the number of visitors entering inside any conference room or seminar hall. This is
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 a person leaves the room.
LCD displays this value which is placed outside the room. This system is helpful for counting
the number of people in an auditorium or halls for seminar to avoid congestion. Moreover it
can also be used to check the number of people who have come to an event or a museum to
watch a certain exhibit. Microcontroller is a reliable circuit that takes over the task of
counting the number of persons/ visitors in the room very accurately. We will be showing
both the in count i.e. number of people entering the room and out count i.e. number of people
exiting the room on a16x2 Alphanumeric LCD. An IR sensor isused to monitor the person
entering and exiting the room. The microcontroller does the above job. I receives the signals
from the sensors and this signal is operated under the control software which is stored in
ROM. Microcontroller 89s52 continuously monitor the Infrared Receivers. When any object
pass through the IR Receiver’s then the IR Rays falling on the receiver are obstructed, this
obstruction is sensed by the Microcontroller.
In recent times, the number of visitors to protected and recreational areas has almost doubled
during the past ten years throughout the whole world (Horne et al., 1998). Now it is estimated
that about five hundred million visits are made annually to national parks and other
recreational areas. This assumptions based on different ways of estimating the number of
visits. Earlier, the estimates were based on trail logs, examination of footprints and
deterioration of the trails, various permits and best estimates made by personnel working in
the areas. However, the lack of uniformity in the world countries development and
consequently the lack of uniformity in data keeping practices have made it difficult to
estimate correctly the number of visitors to places designated as public in the individual
countries and the world at large. This makes reliable visitor counting not only difficult, but at
2
the same time extremely challenging. During the past two years, appreciable efforts have
begun to count visitors to public areas more systematically and consistently. Some counters
were already in use in the mid-1990s, but insufficient use was made of them. More accurate
estimation of the number of visitors was made considerably easier by the publication of a
manual on visitor counting in Finnish (Horne et al., 1998), which has been widely applied in
practice. Other good manuals on visitor counting have been published, for example, in
Scotland and the United States (e.g. Dales et al., 1993 and Yuan et al., 1995).The problem
has been and still is to some extent the lack of systematic and sufficiently reliable visitor
statistics.
Reliable estimates of the number of visitors are extremely important for planning and
managing the use of the areas in question. On the basis of such estimates, it is possible to gain
clearer picture of the use of the area and the sites where visitor traffic is heaviest. Information
on visitor numbers help the people responsible for managing the areas to control the flow of
visitors, for example, by directing them to routes that causeless deterioration to vegetation
and landscape. In addition, visitor counts also help to maintain and develop services so that
they better correspond to the real number of visitors to the area (e.g. firewood supply and
waste disposal). Furthermore, reliable visitor statistics are needed, together with other
information gathered from visitor surveys, for evaluating the effectiveness of the area’s own
activities and for monitoring changes.
Visitor counting thus provides statistics on the number of actual visits that have been made to
an area. When this information is combined within formation gained from visitor surveys, it
is possible to estimate the number of visitors, i.e. how many people visit the area.
In a public place such as shopping malls, religious centers and cinemas, data on the number
of visitor is frequently needed for marketing research or statistic purposes. Usually the
3
counting process is done manually by the officers who guard the entrance. If this process is
done for a long period of time, it will be prone to human errors. Same goes to a room such as
laboratory, main hall, mosque or bedroom. With the advent of industrial and business era in
Nigeria and the subsequent establishment of many public areas such as churches, shopping
malls, recreational centers and so on, there is a need to make adequate preparation and plans
for visitor control and management. This will help to keep accurate information on
population density per time, identify potential structural and social risks and effective
decision making on issues related to population.
Background reading revealed that the technology of visitor counting had dated back to the
1990s. However, there are some shortcomings present in the existing system. Visitor
counting is simply a measurement of the visitor traffic entering and exiting offices, malls,
sports venues, etc. Counting the visitors helps to maximize the efficiency and effectiveness of
employees, floor area and sales potential of an organization. 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.
However, a primary method for counting the visitors involves hiring human auditors to stand
and manually tally the number of visitors who pass by a certain location. But human-based
data collection comes at great expense. With human handling the manual counting of visitors,
there are tendencies of inefficiencies, misrepresentation, time wastage and unnecessary
financial implications. With this in mind, it is imperative to develop and promote a digital
visitor counter which will be bidirectional in nature and utilise the microcontroller. This will
limit all human interferences to the barest and ensure that the task of keeping data on visitors’
visit is less time-consuming, efficient and almost error free.
Here is a low-cost microcontroller based visitor counter that can be used to know the number
of persons at a place. All the components required are readily available in the market and the
circuit is easy to build. Two IR transmitter-receiver pairs are used at the passage: one pair
comprising IR transmitter IR TX1 and receiver phototransistor T1 is installed at the entry
point of the passage, while the other pair comprising IR transmitter IR TX2 and
phototransistor T2 is installed at the exit of the passage. The IR signals from the IR LEDs
4
A counter system can be design in many ways such as combination of gate logic and
microcontroller. Gate logic is simple and easy but this feature is difficult to vary and becomes
complex if the system needs more improvement in requirements. But, by the using of a
microcontroller, a system can be more complex but easy to design. This system will be
designed on a smaller scale to model the actual system. The model will function exactly as
the actual system will. A sensor will be used to detect a person enter and out from the door
and send signal to microcontroller. This microcontroller will count up and down based on the
programming that been embedded on the PIC. A LCD display will inform the total occupant
inside the laboratory and at the same time will display the counting data when a person enter
or leave the room.
1.3 SCOPE
Count visitor which enter and leave the room and display total occupant inside the
room
Implement two IR proximity sensors
Identify the counter process (count up or countdown)
Work in a single entrance and single exit room
1.4 OBJECTIVES
Shopping malls, marketing professionals and recently, religious and academic gatherings rely
on visitor statistic to measure their organizational progress in terms of population
(patronization), make effective managerial and operational decisions and optimization of
opportunities e.g. applying for financial aids etc. Over time, different counting procedures
and counters have been employed, among which are beam counters, thermal counter, video
counting etc. However, most of this counting systems are archaic, cannot meet up with the
current demand for faster and more accurate statistics on visitors. Majorly, most counting
procedures depends on human for over 70% operations thus introducing a sizable amount of
errors arising from different procedural inefficiencies.
In view of these and many more, the need for a digital visitor counter which is bi-directional
is imperative as this will alleviate the challenges of human unnecessary interferences with
visitors statistics, save time and money and at the same time giving an efficient output which
can be relied upon in any circumstances except for system malfunctions. The challenge of
erratic power supply to the system has been well considered, hence a coupling of a 9V PP3
battery with the system.
6
CHAPTER TWO
LITERATURE REVIEW
In 1907, a Russian scientist, Marko Ivanovo successfully designed and constructed an alarm
circuit which he nicknamed, “Ivanovo’s Bells”. In his design, he made use of a photodiode as
source of infrared radiation and a phototransistor to dictate the incoming radiation. He also
incorporated a relay in his design. Once there was an obstruction in the path of infrared rays,
a bell which was connected electrically to the relay would sound. This work to a large
extends, represent a quantum leap in area of semiconductor use and application but still had a
drawback in that, the bell used wore out with time [W.H Dennis 1982].
The transistor to battery powered infrared alarms occurred in early 1940s. In 1945, an
infrared security system was design and constructed by a group of 4 th year electronic
engineering student at the Department of Electrical and Electronic Engineering Laboratory of
the prestigious Princeton institute of technology. In this historical experiment, use was made
of purely discrete components including transistors, resistors and capacitors and a 9V dc
battery as power supply source [Paul Horowitz and Winfield Hill, 1995]
7
The first infrared system which made use of an integrated circuit in its operation was
designed and constructed by Prof. Winfield of the department of Electrical Engineering at
Cambridge University in the late 1930s. In his design, he made use of the 555 timer, which
was one of the earliest integrated circuits. This project was by far superior work to previous
works done in the past in that it was very efficient, portable and use of lesser number of
discrete components [Bluestein I, 1995].
The advent of the microcontroller and software programing in late 1970s further brought
advancement to the area of electronics engineering and was widely used for various
applications [McKenzie I. Smith, 1995].
In 1995, Ayuba I.S of the department of electrical engineering, Ahmadu Bello University,
designed an electro industrial counter using a light dependent resistor and infrared emitter
which generate signals whenever a product cut across the infrared radiation.
In 2001, Vaachi T.B Designed and constructed a photosensitive up- down counter using
infrared emitter and photodiode which a clock pulse whenever there is interruption of light
beam from the object sensor and the output of the counter is displayed using the common-
anode seven-segment display.
In 2008, Abdulrahmam Kamal. Kof the department of electrical engineering, Ahmadu Bello
University, Designed and construct a remote monitoring system to operate upon an
interruption of light beam object sensor.
In 2010, Umar Y.EKof the department of electrical engineering, Ahmadu Bello Universit,y
Designed and constructed a 4 digit decimal counter using a CMOS dual-BCD counter to
generate pulses.
This project is different from the above literatures with the use of microcontroller and the
inclusion of voice alarm.
2.1 INTRODUCTION
8
In this chapter, a theoretical background of the project is presented and a summary discussion
is outlined on each of the main components and associated software packages used in the
design and construction of the system.
The following components were used in the design and construction of this project.
i. Diode
ii. Light emitting diode (LED)
iii. Infrared sensor
iv. Switch
v. Transistors
vi. Capacitors
vii. 555 timers (integrated circuit)
viii. Transformer
ix. Voltage regulator
x. Rectifier
xi. Speaker
xii. Voice alarm chip
xiii. ATMEGA8 microcontroller
xiv. Seven segment display
2.2.1 DIODE
Diode is a device that allows current to flow in only one direction. It can therefore be used as
a simple solid state switch in AC circuits when it is conducting.
The LED is a device that emits visible and/or invisible wavelength of light spectrum when a
forward biasing current is passed through it. Most LEDS are constructed of gallium arsenide
phosphide [M.D Abdullah, 2005].
For the purpose of this project a power LED was used. While a suitable efficiency of a LED
can be obtain for as low as a current of 2mA passing through it, the usual design goal is in
vicinity of 10-20mA. During conduction there is a voltage drop of 2V across the LEDs.
The infrared emits a narrow band of radiation peaking at a wavelength of about 940nm. It is a
super high output power device and emits an infrared wavelength of suitable intensity.
Summarily the infrared diode has the following properties.
The type of infrared diode used in designing this project is the IE-05030HP, because of it
availability and reliability. [W .F John 1994]
10
The circuit symbol for the infrared diode is shown in fig 2.4
The sensor is a device that receives or senses signals coming from the infrared diode and
converts these signals into a form suitable for interpretation by the ATMEGA8
microcontroller.
An infrared sensor, 042-BVI is used in the construction of this project. The sensor is a 3 pin
device and each pin is connected to a separate part of the circuit [Bluestein I, 1999]
2.2.5 SWITCH
A switch is a device used to power a circuit, “ON” or “OFF”. When the switch is closed
(“ON”), current will flow from power supply to the parts of the circuit. This is because the
resistance between the switch contacts is very small. However, when the switch is opened
11
(“OFF”), current does not flow through it due to the very high resistance between the switch
contacts. [A. Wilson, 2001].
A single throw (SPST) switch is used in this project which when closed permits the flow of
current from the power source (PHCN AC mains), through the transformer, rectifier and
voltage regulator and into the ATMEGA8 microcontroller via it input pin.
2.2.6 TRANSISTOR
A BJT (bipolar junction transistor) has three terminals namely; Collector terminal(C), Base
terminal (B), Emitter terminal(E) and two junctions namely Emitter- Base and Collector-Base
junctions. The I-V characteristics of BJT is shown in Fig 2.7 indicating the saturation and
cut-off regions of operation of operations of the transistor
2.2.7 CAPACITOR
A capacitor is a device that stores electrical energy in the form electrostatic field. It consists
essentially of two conducting surface separated by layer of insulating material (or medium)
called dielectric. The conducting surface may be in the form of either circular or rectangular
plates or may be spherical or cylindrical in shape.
Capacitors are widely used as filters to remove AC signals from variety of circuits, AC
ripples in DC power supplies, AC noise etc. they can also be used as timing components
(together with resistors) in ICs and amplifier circuits.
12
Parallel plate capacitors are used for the construction of this project. The circuit symbol is
shown in Fig 2.9 below.
2.2.9 TRANSFOMER
A transfomer is a static (or stationary) piece of apparatus by means of which electrical power
is one circuit is transform into electrical power of the same frequency in another circuit. It
can raise or lower the voltage in a circuit but with a corresponding decrease in or increase in
current. It operates based on the principle of electromagnetic induction whereby two circuits
are linked together by a common magnetic flux and therefore are in mutual inductive
influence of each other.
In its simplest form, it consist of two coils; the first coil called the primary winding in which
electrical energy is fed from AC mains supply and the second coil is called the secondary
winding from which electrical energy is drawn out.
A step down transformer is used in this project to step down the 220/240V AC mains voltage
at its input to a 12V AC output voltage. The circuit symbol of the transformer is shown in Fig
2.11
2.2.10 RECTIFIER
The rectifier is a circuit that employs one or more diodes to convert AC voltage into a
pulsating unidirectional DC voltage.
A full wave bridge rectifier is used in this project and is made up of four diodes with a
transformer that is not centre tapped and the diodes are arranged in such a way that they form
a bridge.
The circuit symbol of a full wave bridge rectifier is as shown in fig 2.12.
During the positive half cycle, diodes D 2 and D 3 become forward bias (ON) whereas D1 and
D 4 becomes reverse biased. Hence diodes D2 and D3 begin to conduct and D1 and D 4 are
open circuits.
During the negative half cycle, diodes D 1 and D 4 are forward biased (ON) where as D2 and D3
becomes reverse biased. This way, a unidirectional DC voltage is produced at its output. The
figure 2.13a and 2.13b show the input and output waveforms of the rectifier diodes;
2.2.11 REGULATOR
Regulation is the provision of a required voltage at the load despite changes in input voltage.
Integrated circuit technology has simplified the design of a wide variety of power circuits. A
7805 regulator is used in this project.
The 7805 regulator is one of a series of 3 terminal voltage regulators (78xx series) and is
available with a fixed output voltage making it useful in a wide range of applications. These
include local card regulation, instrumentation, HIFI and other solid state electronic
equipment.
14
The 7805 regulator has some features which are listed below:
A common ground is required between the input and the output voltages. The input voltage
must remain typically 2.0V above the output voltage even during the low point on the input
ripple voltage.
2.2.12 SPEAKER
A speaker is a device that produces sound energy at its output. It falls into a class of devices
known as transducer. A transducer is a device that converts energy from one form to another.
A speaker is a transducer that converts electrical energy into sound energy. In this project, the
output stage is a speaker connected to a sound driver from voice alarm.
The 555 timer/oscillator IC is an analogue integrated circuit that is used for timing and
oscillator applications. To fully understand the operation of the IC we look at its internal
basic component and the major building blocks as shown on fig 2.16 below.
15
As we can see it has two analogue comparator, S-R flip flop, inverter and discharge
transistor. It also has three identical resistors each of 5KΩ resistance and this is the reason
why it is called 555 timer. These resistors are used as voltage divider network between the
two comparators in the IC. The comp. 1 has a reference voltage of 2/3V cc while the comp. 2
has a reference voltage of 1/3V cc . The comp. 1 is configured in non-inverting mode where it
will be triggered to produce a high output only when the variable input from the threshold (6)
input is above the reference voltage (2/3V cc ). The comp.2 is configured in inverting mode
where it will be triggered to produce a high output only when the variable input from the
trigger (2) input is below the reference voltage (2/3V cc ).
Output of the 555 timer is controlled by threshold (pin 6) and trigger (pin 2). When voltage at
pin 6 is above2/3V cc comp. 1 is high which trigger thee reset (R) input of the flip flop and
hence the out Q of the flip flop is low but since we are using the inverse output Q′ is going to
be high. This input is connected to the inverter which gives low output finally at pin 3 and at
the same time this high input triggers the discharge transistor and sets it to saturation
condition so that any voltage at pin 7 is (discharge) is now allowed to pass from the collector
through the emitter of the transistor to the ground. But when voltage at pin 2 is below1/3V cc
16
comp. 2 is high and this trigger the set (s) input of the flip flop and makes the Q′ low which is
inverted by the inverter to give high input at pin 3 while the discharge transistor is cut-off
since low voltage is at the base, therefore nothing can pass from discharge pin (7) to the
ground. When pin 4 (reset) is not in use, we tie it to pin 8 (supply) of the 555 timer.
2.2.14 MICROCONTROLLER
A seven segment display is the most basic electronic display device that can display digits
from 0-9. They find wide application in devices that display numeric information like digital
clocks, radio, microwave ovens, electronic meters etc. The most common configuration has
an array of eight LEDs arranged in a special pattern to display these digits. They are laid out
as a squared-off figure ‘8’. Every LED is assigned a name from 'a' to 'h' and is identified by
its name. Seven LEDs 'a' to 'g' are used to display the numerals while eighth LED 'h' is used
to display the dot/decimal.
A seven segment is generally available in ten pin package. While eight pins correspond to the
eight LEDs, the remaining two pins (at middle) are common and internally shorted. These
19
segments come in two configurations, namely, Common cathode (CC) and Common anode
(CA). In CC configuration, the negative terminals of all LEDs are connected to the common
pins. The common is connected to ground and a particular LED glows when its
corresponding pin is given high. In CA arrangement, the common pin is given a high logic
and the LED pins are given low to display a number.
CHAPTER THREE
3.1 INTRODUCTION
This chapter describes in details the selection criteria of component used and the calculations
made to arrive at their respective values. The design can be categorized into hardware and
software design, the hardware design covers the circuitry up to the point where transmission
of digital data begins. Also, the software design is discussed which covers the algorithm, flow
chart development and writing of assembly language program using the ATmega8 instruction
set.
The selection of transformer used is dependent on the total maximum current and voltage
rating of component used. The current and voltage rating of basic component used in the
project from their manufacturer’s data sheets are given in table 3.1
IN4148(DIODE) 20 -
IN4001(DIODE) 20 -
INFRARED DIODE 50 -
TOTAL 317.6mA
Based on the data, a transformer rating of 240/12V 500mA 50Hz was chosen. By making
reference to the elementary theory of the voltage transformer, the following equation can be
derived for a transformer.
22
N 2 E2
K= =
N1 E1
(3.1)
N 1 240
K= = = 20
N 2 12
The power rating of the transformer can be evaluated using the formula.
In selecting the diodes used in the bridge rectifiers, the Peak Inverse voltage (PIV) and
maximum secondary voltage (Vsm) of the diode were taken into consideration.
PIV=Vsm (3.3)
PIV=√ 2 ×12=17V
This is the maximum reverse voltage above which breakdown of diode occurs in the reverse
direction. Hence, diodes IN4001 are used as rectifier diodes
23
C
1=¿
I dc
¿ (3.4)
4 f (V ¿¿ SM −V dc )¿
V SM =√ 2V rms = 16.97V
2V SM
V dc = (3.5)
π
16.97
V dc = 2 × =10.8V
3.14
Similarly,
2 I SM
I dc = (3.6)
π
2 ×√2
I dc = × 500 = 450mA
3.14
C
1=¿
450× 10−3
¿ = 400µF
4 ×50 ×(16.97−10.08)
3
V c = × V dc (3.7)
2
3
Vc = × 10.08 = 15.12V
2
Hence, a capacitor with a rating of 47µF, 16V is suitable as a filter capacitor due to its high
market availability.
Based on the previous analysis, the d.c voltage output of the bridge rectifier diode was
calculated to be 10.08V (i.e. V dc =10.08) and basically all the integrated circuits are powered
by regulated supply voltage of 5V. A 7805 regulator IC which takes a range of +7V to +35V
24
unregulated voltage is chosen. The capacitor C2 connected across the output of regulator IC
as shown in fig 3.2 improve transient response, keeps the impedance low at high frequencies
and it’s very small compared to capacitor filter. A value of 0.1µF is suitable as an output
filter for the voltage regulator. The electrical characteristics which were taken into
consideration when selecting the voltage regulator as obtain from the manufacturer’s data
sheet are shown in the table below.
The circuit diagram of the power supply unit is shown below. Fig. 3.2
U?
TR? 7805
D1 D2
1 3
VI VO
5v
1N4007 1N4007
220V, 50Hz
GND
R?
2.2k C?
C?
2
0.1uF
TRAN-2P3S D3 D4 2200uF
D?
LED
1N4007 1N4007
0v
The LEDs and associated resistors were selected based on performance and electrical
characteristic as discussed. Two LEDs were used both for exit and entry transmitter. A
current of 20mA flows from the power supply through a current limiting resistor (R5) as seen
in fig.3.3 and the LED. The resistor’s function is to limit the current flowing into the diode at
its anode to prevent it from blowing the diode. Based on the data sheet of the diode, it is seen
that a forward voltage of 2.1V occurs at the diode terminals.
Vs VD
ID = − (3.8)
Rm Rm
V s = supply voltage
5−1.7
Rm = −3 = 165Ω
20× 10
Thus the resistor, R5 should not be less than 165Ω i.e. R5 ≥ Rmin
As discussed earlier, a 555 timer is device that oscillates back and forth. A 555 timer is
selected for use in the transmitter unit as oscillator; it is configured in astable mode as seen in
fig3.3. Resistors R3 and R1, together with capacitor U1 form the timing circuit.
The resistors and capacitor were selected based on the following criteria;
1. The value of capacitor (U1) must be less than 500pF to avoid stray capacitance.
2. The resistors R3 and R1 must not be less than 1kΩ to avoid over current.
3. R3 + R1 must not be more than 3.3MΩ.
4. Maximum frequency that can be achieved is 1MHz
5. Maximum output current is 200mA. [Mal. A. Kabiru, EEEN540 lecture note]
Based on this the value of R15, RV1 and C20 were choose to be 1KΩ, 5KΩ and 0.01µF
respectively.
I. Infrared sensor
II. 555 Timers (monostablemultivibrator)
III. NPN BJT Transistor (driver transistor)
Infrared sensors were suitable because the light from the transmitter is infrared which is not
visible to human eye and therefore suitable for this work. Associated resistor and capacitors
were selected based on performance and electrical characteristics as discussed earlier.
This unit consists of two timers each for entry and exit sensor respectively, which were
configured in monostable mode at the same timing operation. A monostable is said to have a
single stable state that is the off state. Whenever it is triggered by an input pulse, the
monostable switches to its temporary state. It remains in that state for a period of time
determined by an RC network. It then returns to its stable state. Fig 3.4 shows the circuit
diagram of 555 timers (monostablemultivibrator).
27
5V 5V
R6 R7
U2
U1 10k 10k
3 3
4 R Q 4 R Q
8
Output to the Input driver
8
DC 7 DC 7
Output to Input driver (E
V CC
V CC
5 CV
(Entry) 5 CV
TR TH
2 6 2 TH 6 C
100uf TR
100uf
GND
GND
Input Trigger from Entry Input Trigger from
Exit Sensor
Sensor
1
1
555 Timer for Entry Sensor 555 Timer for Exit Sensor
Fig. 3.5 Circuit diagram of 555 Timer Unit
In fig. 3.4, the duration of the output pulse in seconds can be calculated using the
formula T =1.1 R 6 C
Where R6 and C are timing resistor and capacitor respectively and T is the period of
the output pulse. For proper implementation T was taking to be 1 second, and the value of
capacitor C was picked to be 100µF
Then, T = 1.1R6C = 1
1
R6¿ = 9.09K𝛀
1.1 x 10 0−6
The commercial value of R6 = R7 = 10K𝛀 was used in the design.
The output from the transducer unit served as the trigger to the pin 2 of 555 timers.
Thus, the output of 555 timers is being controlled by the input trigger. The collector of
2N3904 used was connected to a pin of microcontroller and also through 10K𝛀 to Vcc.
The microcontroller used (ATmega8) can sink a current of about 3.6mA maximum.
Thus, by taking the sinking current to 0.5mA, the pull up resistor can be calculated.
5
Therefore, the value of pull up resistor R is R= =10 K 𝛀
0.5 mA
This comprises of two NPN BJT transistors (BC547) each for the entry and exit doors
respectively. The output from each of the sensor goes to the base of each transistor through a
network of a resistor and two capacitors. The transistor is used as the switching device that
28
drives the signal that goes to the 555 timer. The network of resistor and capacitor provide
necessary timing and switching.The BC547 was selected as a driver transistor for the 555
timers based on the following procedure;
1. The transistor's maximum collector current Ic(max) must be greater than the load
supply voltage Vs
current Ic. load current Ic =
load resistance RL
2. The transistor's minimum current gain hFE(min) must be at least five times the load
current Ic divided by the maximum output current from the IC. hFE(min) > 5×
load current Ic
max . IC curren
Vc ×hFE
3. Calculate an approximate value for the base resistor: RB =
5 × Ic
where Vc = IC supply voltage (in a simple circuit with one supply this is Vs)
More over; any general purpose low power NPN transistor can be used. For general
use RB = 10KΩ, RC = 1KΩ
Basic connecting
5
I Rst = = 0.5mA
10000
29
As seen in the figure above, in order to enable the microcontroller to operate properly it is
necessary to provide:
a. Power supply:
b. Reset signal: and
c. Clock signal.
Power supply
Even though this microcontroller can operate at different power supply voltages, why to test
“Murphy’s low”?! A 5V DC is most commonly used. The circuit, shown in the figure, uses a
cheap integrated three-terminal positive regulator LM7805, and provides high-quality voltage
stability and quite enough current to enable the microcontroller and peripheral electronics to
operate normally (enough current in this case means 1Amp).
Reset signal
In order that the microcontroller can operate properly, a logic 0 (0V) must be applied to the
reset pin RS. The push button connecting the reset pin RS to power supply VCC is not
necessary. However, it is almost always provided because it enables the microcontroller safe
return to normal operating conditions ifsomething goes wrong. 5V is brought to this pin, the
microcontroller is reset and program starts execution from the beginning.
Clock signal
Even though the microcontroller has a built-in oscillator, it cannot operate without two
external capacitors and quartz crystal which stabilize its operation and determines its
frequency (operating speed of the microcontroller).
CHAPTER FOUR
4.1 INTRODUCTION
This chapter describe in details, the construction procedure of system hardware, program
development and execution on the ATmega8 microcontroller, testing of the entire system and
casing of the system hardware.
In the course of designing and constructing this project, the following components with their
respective values and rating were used:
RESISTORS:
RV1 = 5KΩ
R12 = 5.1KΩ
31
R13 = 33Ω
R14 = 100Ω
DIODES:
D5 – LED
D6.
CAPACITOR:
C9 = 470µF
C12 = 4µF
C13 = 220µF
C1, C4 = 2.2µF
C5, C6 = 1.0µF
TRANSISTORS:
INTEGRATED CIRCUITS:
ATmega8 (microcontroller)
TRANSFORMER:
220V/12V, 500mA
OTHERS:
Speaker/Buzzer
Vero boards
Sockets
Connectors
Jumper wires
In the course of the design and construction of this project, the selection of the above
components to reduce bulkiness and complexity was taken into consideration. [Mrs C.O
Alenoghena 2007]
The circuit components were first placed on the bread board taking note of polarities and
numbering of the pins. Tests were conducted at different stages and results were recorded.
This gave room for correction and modifications.
The components were then soldered on a Vero board. For soldering an alloy of 60% tin, 40%
lead was used. The soldering provides two functions; to mechanically bind the components to
the Vero board and to provide electrical continuity between the components on the board.
Vero boards were made use of in the design and construction of this project. The main
components like the ATmega8, 555 timers, IC, resistors, capacitors, and transistors were
soldered on the main Vero board while the other components like the transformer, voltage
regulator and active diode were soldered on separate smaller Vero board and connected by
means of wires to the circuitry on the main Vero board. Also, a separate connection goes
33
from the transformer to the power supply. Jumper wires were used to link points which could
not be linked directly with solder wires on the Vero board. The seven segment displays and
speaker were connected by means of separate to the ATmega8, IC and associated circuit
components on the Vero board. After testing, the whole system was housed in a black plastic
casing with holes bored through it for the speaker, the indicator LEDS and nuts.
The program development, implementation and execution were done using MPLAB IDE
(Integrated Development Environment) and interface with Atmel STK500 programmer. This
software allows for code editing, compilation, debugging/simulation and program loading
through an appropriate programming interface. Program development was done using
MPLAB IDE due to ease of use and efficiency, as the microcontrollerworks well with the
integrated environment. For the ATmega8, the compiler used to generate machine codes for it
is called Atmel STK500 compiler. After the codes were written, the compiler was used within
the MPLAB environment to assemble and link the program and after error checking and
debugging, to produce a HEX file containing the machine code instructions for the particular
AVR microcontroller, in this case the ATmega8.
Atmel's AVRs have a two stage, single level pipeline design. This means the next machine
instruction is fetched as the current one is executing. Most instructions take just one or two
clock cycles, making AVRs relatively fast among the eight-bit microcontrollers.
The AVR processors were designed with the efficient execution of compiled C code in mind
and have several built-in pointers for the task.
In-system programing (ISP) was used which basically programs the microcontroller via its
SPI pins. The Atmel STK500 programmer was connected from the PC to its USB serial port
via a USB cable making it possible to interface with the MPLAB IDE software. Thereafter
the program was ran and debugged for error-checking.
The various components were tested using a multimeter to verify that right connections were
made and ensure that there were no short circuits in the design. The diodes and LEDs were
tested to ensure that they conducted in forward direction and they did not in reverse direction.
Also the forward and reverse currents flowing through them were measured using a
multimeter to ensure that they did not exceed the maximum values as stated in their
manufacturers’ data sheets. The output voltage of the regulator was also measured and found
to be in the range of the required output voltage needed to power up the ATmega8 and ICs
(i.e. 4.8-5.4V). the input and output current at the pins of the ATmega8 and ICsboth when
high, ON and low, OFF were each measured and compared with the maximum values as
stated in their manufacturers’ datasheets to ensure that they were within safety limits. The
transistor current- voltage characteristic were also determined and found to comply with the
standard characteristics of transistor operating as switches and driver circuits.
4.7 CASING
This is the final appearance given to the system hardware. The system hardware was housed
in a plastic casing with the following factors taken into consideration
i. Spaced occupied
ii. Portability of the project
iii. Allowance for heat dissipation
iv. Ease of insulation
v. Thermal conductivity
35
● Height =
● Length =
● Width =
The Vero board was screwed on the plastic casing. The figure below shows the casing of the
project.
CHAPTER FIVE
5.1 INTRODUCTION
This chapter presents the conclusion that were drawn from this project, some problems
encountered in the course of this work, the precaution taken and some recommendations that
could be useful to prospective designer of this nature.
5.2 CONCLUSION
The person counter with voice alarm has been successfully designed, constructed and tested.
The project has been satisfactorily used to count the number of people entering or leaving a
room and to indicate through voice alarm when the room is empty.
The ATmega8 was successfully programmed to control the operation of the infrared sensor to
receive or sense the reflected infrared radiation from infrared diode due obstruction by person
or object I accordance with the principle of reflection.
The project was found to work efficiently within reasonable limits of experimental accuracy.
The project further gave the opportunity of exploiting the diverse capabilities and possibilities
inherent in ATmega8 microcontroller device in terms of memory, data storage and precise
timing of instructions.
In the course of constructing this project, some components including the integrated circuits
were destroyed due to wrong connections and excessive currents flowing through them.
36
The program on the ATmega8 had to be debugged several times due to errors encountered
during program implementation.
The problem of obtaining genuine and required Integrated Circuits, infrared transmitter,
infrared receiver and other associated components.
The problem of interfacing of interfacing the MLPAB Integrated Environment and associated
software development tools with the Atmel STK500 programmer.
5.4 PREACAUTIONS
i. A dot type Vero board was used in construction for easy soldering.
ii. During soldering, components were well placed on the Vero board to prevent short-
circuits and wrong connections.
iii. Some sensitive wires were glued to the board to prevent unwanted removal.
iv. The circuit was properly checked for short-circuits and open circuits before being
powered.
v. The current flowing through each component as well as the voltages across each
component were measured using a multimeter in order to make sure excessive
currents that will damage the component do not flow through them.
vi. A socket was used to connect the ICs and ATmega8 to the Vero board in order to
avoid complications in the circuit design, to prevent damage to the pin of the ICs and
ATmega8 and to prevent the ICs and Atmega8 from being damaged.
5.5 RECOMMENDATIONS
In the course of designing and constructing this project it was discovered that this project
could be further enhanced and improved upon in future for the project to be of more use and
benefit to the society.
i. Increasing the distance of the infrared beam with the use of more infrared diodes and
concentrating the rays with the use of lenses, this will require more power.
ii. Incorporating a PC interface so that the number of person can be stored and the result
can be sent to a remote server in this way the project can operated even from distant.
iii. Incorporating a backup battery in case of power failure.
37
38
REFERENCES
1. A Wilson: Electronic Designs: Pitman Publishing Ltd., London, U.K.2001, pp. 39-85
2. Berlin Howard M. The 555 Timer Applications with experiments. Howard W. Sam &
Co. Inc. 1982 pp.27-30.
3. Bluestein I. “sensors magazine” Vol. 13 No. 14, U.K 1995, pp. 25
4. D. A Smith: The fundamentals of Semiconductors. Cambridge University, U.K, 2003.
pp.205
5. http://en. Wikipedia.org/wiki/temp:peripheralinterfacecontroller.
6. Mal. Kabiru A. Electronic Engineering (III). Unpublished Lecture Note, Department
of Electrical and Computer Engineering Ahmadu Bello University, Zaria. 2012.
7. Paul Horowitz and Winfield Hill: The Art of Electronics 2nd Ed. Cambridge
University Press U.K pp.992-993
8. W.F John. The chemistry of semiconductors: Pitman publishing Ltd. U.K 1994 pp. 75
9. W.H. Dennis: Electronics components Butter worth and Co. Ltd. U .K., 1982 pg. 153