UNIVERSITY OF NAIROBI DEPARTMENT OF ELECTRICAL AND INFORMATION ENGINEERING PROJECT NO. 16 CUSTOMER VOLUME MONITORING SYSTEM By KAVOI STEPHEN MUTINDA F17/2466/2008 SUPERVISOR: DR. GEORGE N. KAMUCHA EXAMINER: DR. VASANT M. DHARMADHIKARY A final year project report submitted to the University of Nairobi senate in partial fulfillment of the requirements for the award of Bachelor of Science degree in Electrical and Electronic Engineering. Date of Submission: 28 th April, 2014
72
Embed
UNIVERSITY OF NAIROBI DEPARTMENT OF …eie.uonbi.ac.ke/sites/default/files/cae/engineering/eie/CUSTOMER... · DEPARTMENT OF ELECTRICAL AND INFORMATION ENGINEERING ... A final year
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
UNIVERSITY OF NAIROBI
DEPARTMENT OF ELECTRICAL AND INFORMATION ENGINEERING
PROJECT NO. 16
CUSTOMER VOLUME MONITORING SYSTEM
By
KAVOI STEPHEN MUTINDA
F17/2466/2008
SUPERVISOR: DR. GEORGE N. KAMUCHA
EXAMINER: DR. VASANT M. DHARMADHIKARY
A final year project report submitted to the University of Nairobi senate in partial fulfillment of
the requirements for the award of Bachelor of Science degree in Electrical and Electronic
Engineering.
Date of Submission: 28th
April, 2014
i
CERTIFICATION
This final year project has been submitted for examination in the Department of Electrical and
Information Engineering, University of Nairobi, with my approval as the Supervisor.
Project Supervisor: Dr. George N. Kamucha
Signature:
Date:
ii
DECLARATION OF ORIGINALITY
NAME OF STUDENT: Kavoi Stephen Mutinda
REGISTRATION NUMBER: F17/2466/2008
COLLEGE: Architecture and Engineering
FACULTY/SCHOOL/INSTITUTE: Engineering
DEPARTMENT: Electrical and Information Engineering
COURSE NAME: Bachelor of Science in Electrical and Electronic Engineering
TITLE OF WORK: CUSTOMER VOLUME MONITORING SYSTEM
1) I understand what plagiarism is and I am aware of the university policy in this regard.
2) I declare that this final year project report is my original work and has not been submitted
elsewhere for examination, award of a degree or publication. Where other people’s work
or my own work has been used, this has properly been acknowledged and referenced in
accordance with the University of Nairobi’s requirements.
3) I have not sought or used the services of any professional agencies to produce this work.
4) I have not allowed, and shall not allow anyone to copy my work with the intention of
passing it off as his/her own work.
5) I understand that any false claim in respect of this work shall result in disciplinary action,
in accordance with University anti-plagiarism policy.
Signature:
Date:
iii
ACKNOWLEDGEMENT
First and foremost, I thank the Almighty God for bringing me this far, keeping me healthy and
enabling me put in the great effort required to successfully complete this Customer Volume
Monitoring System design and implementation.
My heartfelt gratitude goes to my Project Supervisor, Dr. George N. Kamucha, for his great
encouragement, guidance and support that enabled me ensure this project was a great success.
The numerous research assignments given always kept me on track and helped me gain an
accurate and deep understanding of the CVMS. As a result, I was able to come up with the
required hardware and software system specifications which resulted in successful system
design, implementation, testing and debugging until the system was working appropriately. The
great efforts put in by the Projects’ Coordinator, Prof. Elijah Mwangi, to facilitate the projects’
submission and selection exercise can also not go unnoticed. His thorough briefing on the final
year projects enabled me make a good choice of project based on my personal interests, strengths
and availability of information resources, hardware and software components.
In addition, I am greatly indebted to all my other lecturers, technicians and classmates. The
knowledge acquired through my interaction with you will go a long way in enabling me advance
well professionally and improve the quality of life of all the people I will serve. The studying
environment provided by all departmental staff and students was also conducive and for that I
am greatly thankful.
iv
DEDICATION
To my loving mum, Mrs. Mary Kavoi, Ms. Mindy Winik, Esme Spanier, and Pradeep Kapadia
for your unfailing support and encouragement throughout my undergraduate studies. Even
amidst difficult circumstances in my life, you always had great faith in my ability to overcome
all obstacles on my way and this gave me great hope and strength to move on. May the Almighty
God bless you abundantly.
v
TABLE OF CONTENTS
CERTIFICATION ....................................................................................................................................... i
DECLARATION OF ORIGINALITY ....................................................................................................... ii
ACKNOWLEDGEMENT ......................................................................................................................... iii
DEDICATION ........................................................................................................................................... iv
TABLE OF CONTENTS ............................................................................................................................ v
LIST OF FIGURES .................................................................................................................................. vii
LIST OF ABBREVIATIONS .................................................................................................................. viii
ABSTRACT ............................................................................................................................................... x
High accuracy is achieved for carefully placed infrared transmitter – receiver pairs.
Infrared rays are not visible to human eyes thus enabling customers to be counted without
their knowledge.
Infrared light from transmitters to receivers can be frequency modulated so that the
customer counter is not affected by any other sources of IR light.
Infrared transmitters/receivers are inexpensive.
Counting of customers entering or exiting the business premises at the same passage can
be achieved by use of dual beam IR sensors.
The IR transmitter – receiver systems are simple to install and operate.
Disadvantages
High potential to become blocked by people standing in the entrance or by merchandise
or displays
Cannot count customers standing side by side. However, many of the other counting
systems have the same disadvantage.
Accuracy can be affected by very high traffic of customers.
(ii) Light Dependent Resistor Systems
A Light Dependent Resistor (LDR), photoresistor, photoconductor or cadmium sulfide (CdS)
cell is a resistor whose resistance decreases with increasing incident light intensity. A
photoresistor is made of a high resistance semiconductor. If light falling on the device is of high
enough frequency, photons absorbed by the semiconductor give bound electrons enough energy
to jump into the conduction band. The resulting free electron and its hole partner conduct
electricity, thereby lowering resistance.
A photoelectric device can be either intrinsic or extrinsic. An intrinsic semiconductor has its own charge carriers and is not an efficient semiconductor, e.g. silicon. In intrinsic devices the only
available charge carriers are electrons in the valence band, and hence the photon must have
enough energy to excite the electron across the entire bandgap. Extrinsic devices have dopants
(impurities) added whose ground state energy is closer to the conduction band; since the
electrons do not have as far to jump, lower energy photons (i.e. longer wavelengths and lower
frequencies) are sufficient to trigger the device. If a sample of silicon has some of its atoms
replaced by phosphorus atoms (impurities), there will be extra electrons available for conduction.
Figure 1: Light Dependent Resistor
7
Light Dependent Resistors may be used in place of the IR transmitter – receiver system but
are nowadays not commonly used as they are easily triggered by sunlight or any other sources
of light.
(iii) Computer Vision Systems
Computer Vision Systems typically use either a CCTV camera or IP camera to feed a signal into
a computer or embedded device. Some computer vision systems have been embedded directly
into standard IP network cameras. This allows for distributed, cost efficient and highly scalable
systems where all image processing is done on the camera using the standard built-in CPU. This
also dramatically reduces bandwidth requirements as only the counting data has to be sent over
the Ethernet.
Accuracy varies between systems and installations as background information needs to be
digitally removed from the scene in order to recognize, track and count customers. This means
that CCTV based counters can be vulnerable to light level changes and shadows, which can lead
to inaccurate counting. However, robust and adaptive algorithms have lately been developed that
can compensate for this behaviour and excellent counting accuracy can today be obtained for
both outdoor and indoor counting using computer vision systems.
Advantages
High accuracy(sometimes over 95% in correct conditions)
Directional counting information is acquired
Flexible in customization
Highly scalable when embedded in IP cameras
Integration with other systems
Networkable to cover wide entrances
Possible to anonymize images to avoid people recognition.
Disadvantages
Higher cost than IR transmitter – receiver systems
Lower lifetime and higher power consumption than thermal systems
Some systems require PCs that are not fully embedded
Accuracy can be affected by shadow, floor background and differing light levels.
(iv) Thermal Imaging Systems
These systems use array sensors which detect heat sources, rather than using cameras as in
computer vision systems. The systems are typically implemented using embedded technology
and are mounted overhead for high accuracy. Since thermal imaging systems detect the heat
emitted by people, they can be susceptible to external weather conditions that reduce the amount
of heat emitted from a person walking in from an outdoor environment.
The diagrams below illustrate the physical appearance of the Arduino Uno and components it
consists of:
Figure 4: Arduino Uno Board Components
Figure 5: Arduino Uno Board
15
Specifications of Arduino Uno
(i) Power Supply
The Arduino Uno can be powered via the USB connection or with an external power supply. The
power source is selected automatically. External (non-USB) power can come either from an AC-
to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-
positive plug into the board's power jack. Leads from a battery can be inserted in the GND and
Vin pin headers of the Power connector. The board can operate on an external supply of 6 to
20V. If supplied with less than 7V, however, the 5V pin may supply less than 5V and the board
may be unstable. If using more than 12V, the voltage regulator may overheat and damage the
board. The recommended range is 7 to 12V.
The power pins are as follows:
VIN: The input voltage to the Arduino board when it is using an external power source (as opposed to 5V from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.
5V: The regulated power supply used to power the microcontroller and other components
on the board. This can come either from VIN via an on-board regulator, or be supplied by
USB or another regulated 5V supply.
3.3V: A 3.3V supply generated by the on-board regulator. Maximum current draw is 50 mA.
GND: Ground pins.
(ii) Memory
The Atmega328 has 32 KB of flash memory for storing code (of which 0.5 KB is used for the
bootloader). It also has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written
with the EEPROM library).
(iii)Input and Output
Each of the 14 digital pins on the Arduino Uno can be used as an input or output, using
pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5V. Each pin can provide
or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of
20-50 KΩ. In addition, some pins have specialized functions:
Serial; 0 (RX) and 1 (TX): Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL
Serial chip.
External Interrupts; 2 and 3: These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value. The attachInterrupt() function is
used to achieve this.
PWM; 3, 5, 6, 9, 10, and 11: Provide 8-bit PWM output with the analogWrite() function.
SPI; 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK): These pins support SPI communication, which, although provided by the underlying hardware, is not currently
included in the Arduino language.
16
LED; 13: There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it is off.
The Arduino Uno has 6 analogue inputs, each of which provides 10 bits of resolution (i.e. 1024 different values). By default they measure from ground (0V) to 5V, though is it
possible to change the upper end of their range using the AREF pin and the
analogReference() function.
I2C; 4 (SDA) and 5 (SCL): Support I2C (TWI) communication using the Wire library.
AREF: Reference voltage for the analog inputs. Used with analogReference() function.
Reset: Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.
(iv) Communication
The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial
communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega8U2 on the
board channels this serial communication over USB and appears as a virtual COM port to
software on the computer. The '8U2 firmware uses the standard USB COM drivers, and no
external driver is needed. However, on Windows, an *.inf file is required.
The Arduino software includes a serial monitor which allows simple textual data to be sent to
and from the Arduino board. The RX and TX LEDs on the board will flash when data is being
transmitted via the USB-to-serial chip and USB connection to the computer (but not for serial
communication on pins 0 and 1). A Software Serial library allows for serial communication on
any of the Arduino Uno's digital pins. The ATmega328 also supports I2C (TWI) and SPI
communication. The Arduino software includes a Wire library to simplify use of the I2C bus.
(v) Programming
The Arduino Uno can be programmed with the Arduino software. The ATmega328 on the
Arduino Uno comes pre-burned with a boot-loader that allows you to upload new code to it
without the use of an external hardware programmer. It communicates using the original
STK500 protocol. You can also bypass the boot-loader and program the microcontroller through
the ICSP (In-Circuit Serial Programming) header. The ATmega8U2 firmware source code is
available. The ATmega8U2 is loaded with a DFU boot-loader, which can be activated by
connecting the solder jumper on the back of the board (near the map of Italy) and then resetting
the 8U2. You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS
X and Linux) to load a new firmware. Or you can use the ISP header with an external programmer (overwriting the DFU boot-loader).
(vi) Automatic Software Reset
Rather than requiring a physical press of the reset button before an upload, the Arduino Uno is
designed in a way that allows it to be reset by software running on a connected computer. One of
the hardware flow control lines (DTR) of the ATmega8U2 is connected to the reset line of the
ATmega328 via a 100 nF capacitor. When this line is asserted (taken low), the reset line drops
long enough to reset the chip. The Arduino software uses this capability to allow you to upload
code by simply pressing the upload button in the Arduino environment. This means that the boot-
17
loader can have a shorter timeout, as the lowering of DTR can be well-coordinated with the start
of the upload.
This setup has other implications. When the Arduino Uno is connected to either a computer
running Mac OS X or Linux, it resets each time a connection is made to it from software (via
USB). For the following half-second or so, the boot-loader is running on the Arduino Uno. While
it is programmed to ignore malformed data (i.e. anything besides an upload of new code), it will
intercept the first few bytes of data sent to the board after a connection is opened. If a sketch
running on the board receives one-time configuration or other data when it first starts, make sure
that the software with which it communicates waits a second after opening the connection and
before sending this data. The Arduino Uno contains a trace that can be cut to disable the auto-
reset. The pads on either side of the trace can be soldered together to re-enable it. It's labeled
"RESET-EN". You may also be able to disable the auto-reset by connecting 110Ω resistor from
5V to the reset line.
(vii) USB Overcurrent Protection
The Arduino Uno has a resettable polyfuse that protects your computer's USB ports from shorts
and overcurrent. Although most computers provide their own internal protection, the fuse
provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse
will automatically break the connection until the short or overload is removed.
(viii) Physical Characteristics
The maximum length and width of the Arduino Uno PCB are 2.7 and 2.1 inches respectively,
with the USB connector and power jack extending beyond the former dimension. Three screw
holes allow the board to be attached to a surface or case. Note that the distance between digital
pins 7 and 8 is 160 mil (0.16"), not an even multiple of the 100 mil spacing of the other pins.
Applications of Microcontrollers
Microcontrollers are used in the following areas: Robotics, Aerospace, Automobiles (climate
control, diagnostics, engine control), Automotive applications, Environmental control
(greenhouse, factory), Appliances (television, stereos, microwave oven, and refrigerators) and
rechargeable circuit, reading and writing function, using time: about 1 year (when fully
charged), provides clock signal for microcontroller, cascade other I2C devices, full BCD clock
calendar chip of 56byte non-volatile RAM, address and data transmission via serial cable with
dual-line dual-direction, the chip can provide different time information (i.e. second, minute,
hour etc), AM/PM mark (for working 24-hour or 12-hour), built-in power sensor circuit in the
chip (with brownout detection and battery switch function), Under battery backup mode, power
consumption is below 500µA and accurate calendar upto year 2100.
2.3.3 Customer Detection System
The customer detection system comprises two major parts, namely;
(i) Infrared Transmitter Circuit
(ii) Infrared Receiver Circuit
(i) Infrared Transmitter Circuit
Infrared (IR) radiation is electromagnetic radiation of a wavelength longer than that of visible
light, but shorter than that of microwaves. The name infrared means “below red” (from the Latin
word infra which means below), red being the color of visible light with the longest wavelength.
Infrared radiation has wavelengths of between about 750 nm and 1 mm, spanning five orders of
magnitude. A longer wavelength means it has a lower frequency than red, hence “below”.
Objects generally emit infrared radiation across a spectrum of wavelengths, but only a specific
region of the spectrum is of interest because sensors are usually designed only to collect
radiation within a specific bandwidth.
Infrared radiation is used in e.g. IrDA devices and remote controls which use infrared light-emitting diodes (LEDs) to emit infrared radiation which is focused by a plastic lens into a narrow
beam. The receiver uses a silicon photodiode to convert the infrared radiation to an electric
current. It responds only to the rapidly pulsing signal created by the transmitter, and filters out
slowly changing infrared radiation from ambient light. IR light does not penetrate walls and so
does not interfere with other devices in adjoining rooms.
The infrared transmitter circuit diagram has two NE555 timer ICs configured to function as basic astable multivibrators or free running oscillators. The astable multivibrators generate square
waves whose period is determined by the circuits external to the NE555 ICs. The astable
multivibrators do not require any external trigger to change the state of the output hence the
name free running oscillator. The time during which the output is either high or low is
determined by the two resistors and a capacitor which are externally connected to the
NE555 timers. The IR transmitter circuit is used to generate the modulated 38 KHz IR signal.
Then you point it over the TSOP4838 sensor and its output will go low (0V) when it senses the
IR signal of 38 kHz and high (5V) when the IR signal is blocked from reaching it by a customer
entering or leaving the premises. As a result, the system is able to greatly conserve power.
19
NE555 Timer IC
The NE555 monolithic timing circuit is a highly stable controller capable of producing accurate
and highly stable time delays or oscillation. The timer basically operates in one of the two
modes: either as a monostable (one-shot) multivibrator or as an astable (free-running)
multivibrator. With a monostable operation, the time delay is controlled by one external resistor
and one capacitor. With an astable operation, the frequency and duty cycle are accurately
controlled by two external resistors and one capacitor. The circuit may be triggered and reset on
falling waveforms, and the output structure can source or sink up to 200 mA.
Features of NE555 Timer
Turn-off time less than 2 microseconds
Maximum operating frequency greater than 500 kHz
Timing from microseconds to hours
Operates in both astable and monostable modes
High output current drive capability. Output Can Sink or Source upto 200 mA
Adjustable duty cycle
TTL-Compatible.
Temperature stability of 0.005% per °C
Applications of NE555 Timer
Precision timing
Pulse generation
Sequential timing
Time delay generation
Pulse width modulation
The figure below shows the pin diagram of the NE555 timer IC.
Figure 7: Pin Diagram of NE555
20
NE555 Timer IC Block Diagram
Figure 8: NE555 Timer IC Block Diagram
Purpose of NE555 Timer in CVMS
As earlier mentioned, the CVMS uses infrared rays emitted by infrared LED transmitters to detect
customers entering and leaving a business premises. These rays can be detected by the TSOP4838
infrared sensors only if they are modulated at 38 kHz. Therefore, a driving circuit comprising NE555
timer configured as an astable multivibrator is needed to feed the infrared LEDs with the required
modulated square wave of frequency 38 kHz.
Astable Multivibrator Circuit
The 38 kHz square wave signal required by the infrared LEDs can be generated using an astable
multivibrator circuit. An astable multivibrator, also called free running multivibrator, generates a square
wave of known period. It does not have any permanent stable state but has two quasi-stable states. The
circuit changes state continuously from one quasi-state to the other after a predetermined length of time
and no external trigger pulse is needed. This length of time is determined by the circuit time constants and
parameters. This circuit can be implemented in a variety of ways. It can be realized by a pair of
regeneratively coupled active devices (BJTs and FETs), negative resistance devices (UJTs, tunnel diodes,
etc) and operational amplifiers. Upon research, I found out that 555 timer would be a suitable choice
because of its compactness, reliability and frequency stability. In this project, NE555 timers have
therefore been used to produced frequency modulated IR light to the TSOP4838 receivers.
21
Each of the two LED transmitter circuits is connected as shown below with the astable multivibrator
modulating the infrared light from the transmitter to be at 38 KHz, the frequency of infrared light detected
by the TSOP4838 infrared receiver used.
R1= 1.8KΩ, R= 18KΩ, C1= 0.001µF, C2= 0.01µF
Figure 9: Frequency modulated transmitter circuit
The 38KHz frequency of infrared light from LED transmitter, f, is obtained by varying R1, R2
and C1. Generally, the following equation is used to calculate f whenever values of R1, R2 and
C1 are chosen by the oscillator designer. From my transmitter circuit design, the frequency of
infrared light from LED transmitter is given as:
f = [1.44/(R1+2R2)*C1]
= [1.44/(1.8KΩ+36KΩ)* 0.001µF]
= 38 KHz
TSOP4838 Infrared Receiver
This is a miniaturized receiver for infrared remote control systems. A PIN diode and a
preamplifier are assembled on a lead frame with the epoxy package acting as an IR filter. The
demodulated output signal can be directly connected to a digital input. The TSOP4838 is a
legacy product for all common IR remote control data formats. This receiver offers high, fixed
gain – detection threshold does not change with changes in ambient light and optical noise in
environment. The IR LED transmitter emits modulated 38 KHz IR signal which is detected by the
TSOP4838 infrared receiver. The output goes high when there is an interruption and it returns back to low
after the time period determined by the capacitor and resistor in the circuit, typically around 1 second.
22
Figure 10: TSOP4838 IR Receiver
Features of TSOP4838 IR Receiver
Photo detector and preamplifier in one package
Internal filter for PCM frequency
Improved shielding against Electromagnetic Interference(EMI)
Improved immunity against ambient light
Insensitive to supply voltage ripple and noise
Fast reaction time – works with continuous 38 kHz signal (Operating/Carrier frequency)
Supply Voltage Range: 2.5V to 5.5V
Low Supply Current consumption (950µA)
Opto Case Style: Through Hole
Operating Temperature Range: -25°C to +85°C
Package Dimensions (mm): 6.9 H x 5.6 W x 6.0 L
Package Pinning: 1= OUT, 2= GND, 3= Vs
Diode Type: Amplified Photodiode
Mounting: Leaded (Lead Length: 23.55mm)
Application: Remote control
AGC: Legacy, for long burst remote control (AGC2)
Block Diagram of TSOP4838
1= OUT, 2= GND, 3= Vs
Figure 11: Block Diagram of TSOP4838
23
The IR receiver (detector) has a band pass filter to reject spurious signals like fluorescent lights
and Automatic Gain Control (AGC) to help in reception of weak signals. AGC is used to control
the dynamic range of radio receivers. Some long range sensors adjust their detection threshold
depending on the amount of ambient light and optical noise present in the environment. With
noise, the gain of the amplifier is reduced to avoid false detections. When exposed to lower light
levels, the adjustable gain makes the receiver too sensitive. It will detect reflected or stray light.
TSOP4838 eliminates this problem by having a fixed gain. During sensor development, the
power applied to the emitter is adjusted for the maximum brightness level expected in the
sensor’s operating environment. The sensitivity of the infrared receiver can be optimally adjusted
by changing the size of the aperture and the use of attenuation filters. The TSOP4838 sensor will
have the same response regardless of the ambient light.
Some long range sensors require the infrared beam to be interrupted for up to 5 ms before
detecting an object. However, with the TSOP4838, response time is much faster; requiring the
signal to be interrupted for only 300 μs before responding. For the shortest response time a
continuous 38 kHz signal should be used. For the longest distance, the TSAL6200 infrared LED
transmitter should be driven with a higher current using a 38 kHz burst pattern.
TSOP4838 Application Circuit
Figure 12: TSOP4838 Application Circuit
Each of the two TSOP4838 infrared receivers used in the customer detection system is connected
as illustrated in the above circuit. The external components R1 and C1 are optional to improve
the robustness against electrical overstress (typical values are R1= 100Ω, C1= 0.1 µF). R1 and
C1 are used as an input filter to keep noise on the power supply from causing false triggers in the
TSOP4838 receiver. The receiver output only has weak pull up resistor (33 KΩ), so an external
resistor R1 is used to augment this.
The TSOP4838 infrared receivers are designed to suppress spurious output pulses due to noise or
disturbance signals. The devices can distinguish data signals from noise due to differences in
frequency, burst length, and envelope duty cycle. The data signal should be close to the device’s
band-pass center frequency (i.e. 38 kHz). When a data signal is applied to TSOP4838 infrared
receiver in the presence of a disturbance, the sensitivity of the receiver is automatically reduced
by the AGC to ensure that no spurious pulses are present at the receiver’s output.
24
CHAPTER 3: DESIGN AND IMPLEMENTATION
3.1 Project Description
After comprehensive research on various technologies employed in both manual and automatic
customer counting systems, the Infrared Transmitter – Receiver System was selected for
customer detection due to its numerous advantages. Consequently, a low-cost microcontroller-
based customer counter was designed and implemented for use in order to know the number of
customers in a business at any one time and track periodic customer volumes in hours, days and
months. The components required in the system were all inexpensive and readily available in the
market.
Two infrared transmitter – receiver pairs were installed at a single passage serving as customer
entry/exit point. The Customer Volume Monitoring System (CVMS) consists of 5 major
sections:
(i) Customer Detection Section
The main purpose of this system is to detect customers who are entering or exiting the business
premises. Two Infrared LED transmitters, two NE555 timers, two TSOP4838 infrared receivers
(proximity sensors), among other circuit components were used.
(ii) Customer Data Processing Section
This uses the Central Processing Unit of the ATmega328 microcontroller.
(iii) Customer Database System
This was developed using Microsoft Visual C#.net installed in a PC.
(iv) Customer Display System
This was achieved through development of a user-friendly graphical user interface using
Microsoft Visual C#.net installed in a PC.
(v) Time Monitoring System
This utilizes the DS1307 RTC Module for Arduino in monitoring the time at which the customer
counter data is to be send to the serial port of the PC for reading, storage and display in the
C#.net database system.
3.2 System Algorithm
Step 1: Start the Customer Volume Monitoring System operation.
Step 2: A beam of infrared light signal is continuously transmitted from the infrared LED
transmitters to the infrared TSOP4838 receivers.
Step 3: The customer motion and the counter value are both initialized to zero. Motion can either
be 0 for waiting state, 1 for move in state or 2 for move out state. On the other hand, the counter
25
can only take a value greater than or equal to zero as dictated by the number of customers within
the premises at any one moment.
Step 4: When the CVMS receives an interrupt from sensor 1 followed by an interrupt from
sensor 2, this is interpreted by the microcontroller as an entry and then the counter is
incremented by 1. The CVMS database is then updated and current number of customers in the
premises is displayed on the C#.net graphical user interface.
Step 5: When the CVMS receives an interrupt from sensor 2 followed by an interrupt from
sensor 1, this is interpreted by the microcontroller as an exit and then the counter is decremented
by 1. The CVMS database is then updated and current number of customers in the premises is
displayed on the C#.net graphical user interface.
Step 6: The Customer Volume Monitoring System operation continues every time the
interruption of the infrared light occurs.
Step7: When 24 minutes (representing the 24 hours in a day) elapse, the microcontroller carries
out computation to get the total customers for that day and this is displayed on the GUI and also
saved in the database for future use.
Step 8: When 720 minutes (representing the total hours in a month of 30 days) elapse, the
microcontroller carries out computation to get the total customers for that month and this is
displayed on the GUI and also saved in the database for future use.
26
3.3 System Flowchart
Figure 13: CVMS Flowchart
27
3.4 Hardware Design
3.4.1 CVMS Hardware Connection
The figures below shows an interconnection of the various hardware components required for the
Customer Volume Monitoring System.
Figure 14: CVMS Hardware Connection
Figure 15: CVMS Counter Circuit
28
3.4.2 CVMS SCHEMATIC DIAGRAM
The following is the schematic diagram of CVMS as designed using Proteus 7 Professional:
Figure 16: CVMS Schematic Diagram
3.4.3 CVMS PCB Fabrication
PCB Fabrication Overview
A printed circuit board (PCB) refers to the board used for physically supporting and wiring
surface-mounted and through-hole mounted components in many electronic circuits. Presently,
there are different software available in the market for making of the PCB design/layout e.g.
Express PCB, Proteus, Eagle, etc.
29
The following diagram shows the CVMS printed circuit board (PCB) design done using Express
PCB.
Figure 17: CVMS PCB Design
Materials Required in PCB Fabrication
a) Copper clad board
b) Ferric chloride
c) Glossy paper
d) Iron box
e) Three trays
f) Thinner
g) Marker
h) Immersion heater
FCB Fabrication and holes’ drilling
The following was the procedure followed:
i) An ordinary laser jet printer was used for obtaining a print out of the PCB artwork in a
glossy paper. During printing, toner from the laser jet printer was transferred onto the
glossy paper.
31
ii) The copper clad board and printed glossy paper were both cut to fit the PCB artwork.
iii) The surface of the copper clad board was then cleaned using steel wool.
iv) The artwork was then placed facing the copper surface. A warm iron box was afterwards
placed on top of the glossy paper in order to stick it to the copper clad board.
v) The artwork was then firmly ironed onto the copper clad. A heat resistant material was
used to hold the copper clad board and the artwork in place. Then, sufficient pressure was
applied on the iron box so that the toner in the glossy paper was transferred properly from
the paper onto the copper clad board. A lot of care was taken so as not to skid the artwork
while ironing. The principle of operation was that the hot ironing transferred the toner in
glossy paper onto the copper clad thus making the circuit layout on the copper clad board.
After 3 – 4 minutes of ironing, it was possible to see the circuit layout begin to be visible
on the ironing face as veins of a leaf. At that juncture, it was clear that the artwork had
been successfully transferred onto the copper clad board. Caution was taken not to burn
hands with the now hot copper clad board.
vi) The copper clad board was then let to cool for about 5 minutes to prevent the board from
sudden contraction when placed in cold water. Afterwards, the copper clad board was
placed in a tray of cold water for about 5 minutes in order to remove the paper from the
board. Sodium hydrogen carbonate was used to make the process faster. After the paper
was loosened by the water, it was slowly removed by hand. The unnecessary paper from
the copper clad between pad and in between drill holes was also carefully removed. The
missing pads were joined using a marker. Now the circuit only had circuit layout. This
was the mask which resisted Ferric Chloride from etching the copper tracks in the PCB
design.
vii) Water was then boiled using the immersion heater. Then, the hot water was put in the
second tray which was bigger than all the rest. This second tray was just about half full of
the hot water. Ferric Chloride solution was then put in the last tray and the copper clad
board was immersed therein. The tray with the copper clad board was then immersed in
the bigger tray with hot water. The two trays were then slightly shaken to speed up the
etching process. In about 10-15 minutes the copper clad board was completely etched and
the copper tracks were clearly visible on the board. The board was then rinsed in cold
water.
viii) A drill with an appropriate bit size was then used for drilling holes for each of the PCB
components. Proper alignment of holes was done so that inserting ICs into the PCB would be
easy. Afterwards, the print mask was removed from the PCB using thinner.
Soldering
The components’ legs were cleaned with steel wool before soldering as oxide layer on
them would have resulted in cold solder.
32
All the circuit components were then soldered into their respective areas as per the PCB
design.
The continuity test, using multimeter in diode mode, was used to make sure the adjacent
pins of ICs were not shorted while soldering.
The flux between pins was then cleaned.
3.7 Software Design
3.7.1 CVMS Counter
The program for counting the number of customers entering or exiting the business at any one
time was written using the Arduino 1.5.2 software. It was then uploaded into the ATMEGA328P
microcontroller. The code was then tested and debugged until it was error-free and running as
expected.
3.7.2 CVMS Database and GUI
The code for the CVMS database and GUI was written in Microsoft Visual Studio C#.net. The
figure below shows the system graphical user interface developed.
Figure 18: CVMS Graphical User Interface
33
CHAPTER 4: RESULTS, ANALYSIS AND DISCUSSION
4.1 CVMS Results
4.1.1 Real-time and Hourly Customer Display
After successful system design and implementation, the Customer Volume Monitoring System
was found to accurately count and display the actual number of customers within a business
premises in real-time as well as track periodic changes in customer volumes in hours. For the
sake of project presentation and results generation, a minute was taken to represent an hour. As a
result, the CVMS counter was slightly modified to give the number of customers within the
premises at any one time and track periodic changes in customer volumes as minutes elapsed.
However, in the physical deployment of the system, an hour would be after 60 minutes have
elapsed. The table below shows the results obtained.
Figure 19: Real-time and Hourly Customer Display
4.1.2 Daily Customer Count Display
Following successful system design and implementation, the Customer Volume Monitoring
System was found to accurately count and display the actual number of customers who visited
the business premises as days elapsed. For the sake of project presentation and results generation,
a day was taken to represent 24 minutes. As a result, the CVMS counter was slightly modified to
give the number of customers who had visited the premises at every period of 24 minutes.
However, in the physical deployment of the system, a day would mean 24 hours will have
elapsed. The results obtained were as follows:
34
Figure 20: Real-time and Daily Customer Display
4.1.3 Monthly Customer Display
The program for detection and display of the number of customers who visited the business
premises at the end of every month (30 days period) was successfully written and debugged. Due
to limited time at my disposal, it was not possible to wait for the system to count customers
entering and leaving the premises for a period of 720 minutes or 12 hours (since 24 minutes
would represent a day). Nevertheless, it is expected that the system would have worked perfectly
and efficiently to give the monthly count of customers visiting the premises.
4.2 Customer Data Analysis
Below is a table showing a sample customer data and analysis through a bar chart. The customer
data for all the hours in a day, days in a week and months in a year is analyzed in a similar
manner.
35
Hours Current Customers
0600 hrs 10
0700 hrs 25
0800 hrs 5
0900 hrs 49
1000 hrs 64
1100 hrs 30
1200 hrs 18
Table 1: Customer Data
0
10
20
30
40
50
60
70
Current Customers
0600 hrs
0700 hrs
0800 hrs
0900 hrs
1000 hrs
1100 hrs
1200 hrs
Figure 21: Customer Data Bar Graph
4.3 Discussion
4.3.1 System Performance
4.3.2 Challenges Faced
The successful design and implementation of the Customer Volume Monitoring System (CVMS)
has not been without challenges. The main challenges encountered were:-
Limited time within which to design and implement a properly working CVMS Counter,
Database and Graphical User Interface.
36
Delay in delivery of the hardware components required for the project. Due to time
constraints and commitment to deliver a properly working CVMS, I was forced to look
for means of personally purchasing the required components.
Thankfully, I was able to overcome the aforementioned challenges and the project design and
implementation was a great success.
37
CHAPTER 5: RECOMMENDATIONS AND CONCLUSION
5.1 Conclusion
Customer Volume Monitoring System was successfully designed and implemented using
Arduino Uno R3, DS1307 Real Time Clock module, TSAL6200 infrared LED transmitters,
NE555 timers, TSOP4838 infrared receivers, Microsoft Visual C#.net software among other
system components. This type of design is well suited for implementation in all business
premises and other places where the number of persons in a building at any time is required. The
system can also be employed to ease congestion in places where the space is limited. Based on
this system design and implementation, CVMS can also be queried to ascertain the number of
customers who visited the premises at a particular hour, day or month. This assists the business
management in doing periodical assessment of the level of business performance and customer
satisfaction as evidenced by the sales data or frequent customer visits to the premises.
5.2 Recommendations
Customer counting is not just limited to the capture and storage of the number of customers
entering and leaving a business but has a wide range of applications that provide information to
management on the volume and flow of people throughout a location. The Customer Volume
Monitoring System can thus be further be developed so that;
It can generate system reports which can be printed out by the business management staff
so as to make analysis of the customer data collected easier.
Sending of the customer data to a remote location using mobile or internet is possible.
The CVMS can also be interfaced with a GSM modem to send the customer counter data
through SMS.
CVMS can easily be integrated with a business’ Point of Sale (POS) system or workforce
management system. Through using this integration, a business can achieve important
key values such as the number of transactions per the number of customers and hence put
the customer statistics in relation to a business’ turnover, as well as increase the
efficiency in staff planning.
38
BIBLIOGRAPHY
[1] J. Blum, Exploring Arduino: Tools and Techniques for Engineering Wizardry, John Wiley &
Sons, 2013
[2] Massimo Banzi, Getting Started with Arduino, Second Edition, O’Reilly Media Inc., 2011
[3] B. Evans, Beginning Arduino Programming, 1st Edition, Apress, 2011
[4] M. Margolis, Arduino Cookbook, O’Reilly
[5] http://www.homeandlearn.co.uk/csharp(Accessed on 28/11/2013 – 5/01/2014)
[6] http://arduino.cc/en/Guide/ (Accessed on 19/11/2013 – 20/11/2013)
[7] www.vishay.com (Accessed on 12/12/2013)
[8] http://www.ladyada.net/learn/arduino/ (Accessed on 17/11/2013)
[9] www.datasheets4u.com (Accessed on 05/01/2014)
[10] www.datasheetcatalog.com (Accessed on 13/01/2014)