You are on page 1of 36

TABLE OF CONTENTS

Chapter one .................................................................................................................................................. 2


1.1 Introduction .................................................................................................................................. 2
1.2 Related work ................................................................................................................................. 3
1.3 Purpose of the project .................................................................................................................. 6
Chapter two .................................................................................................................................................. 7
Method ......................................................................................................................................................... 7
2.1 component .......................................................................................................................................... 7
2.2 Connecting hardware ........................................................................................................................ 13
Chapter three .............................................................................................................................................. 16
Software ...................................................................................................................................................... 16
3.1 Camera software and Arduino mage in matlab ................................................................................ 16
3.2 Arduino Software .............................................................................................................................. 17
3.3 Matlab Software................................................................................................................................ 17
3.4 Computer vision ................................................................................................................................ 19
3.5 GIU interface ..................................................................................................................................... 21
Chapter Fourth ............................................................................................................................................ 23
Results and Conclusion ............................................................................................................................... 23
4.1 Results ............................................................................................................................................... 23
4.2 Conclusion ......................................................................................................................................... 34
Works Cited ................................................................................................................................................. 35

1|Page
CHAPTER ONE

1.1 Introduction

2|Page
1.2 Related work
This section will explore some of currently available electronics gates which are used to allow just
specific cars to enter company, university or factory. Each one depend on different technique to allow
cars to pass. Accordingly, each technique will be discussed in the following paragraphs.

Keypads: this system requires a driver to stop, roll down a window and enter an access code on a Keypad.
These systems are uncomfortable to use, especially during heavy rain or snow. Though this system is very
cost-effective, it is slow, so its not the best option for a high-traffic area where a lot of vehicles are moving
through. Overall, it takes an average of 45 seconds to get through, as every driver must stop, punch in the
access code, then wait for the gate to open before driving in [1].

Figure (1-1) Keypads

Swipe or Contact Cards: require a driver to stop, roll down a window and swipe the card through a slot or
touch the Card to a pad. Unfortunately, Swipe and/or Contact Cards usually end up being loaned out and
some will be lost or never returned. Widespread use of this technology has made it easy to have additional
swipe Cards made for family and friends. Although Card systems are inexpensive, loose Cards can end up
circulating through many unknown hands. Drivers usually take about 20 seconds to stop, roll down the
window, swipe (or tap) then wait for the gate to open and drive in, which is faster than most Keypad
Systems [1].

3|Page
Figure (1-2) swipe or Contact Cards

Access Control Transmitters: Drivers don't have to stop at the gate, roll down a window and then press a
button. Drivers can use the Remote Clicker while they are far away, and by the time they arrive at the gate
it is already open. This is the second advantage of a Remote Clicker system, speed. Because there is no
waiting time, traffic enters smoothly without getting backed up. However, the disadvantage is that drivers
can open the gate for other vehicles. If the other vehicles should not have been allowed in, this creates a
problem. Another disadvantage is cost, not including the price of batteries. Where they may be broken,
stolen or lost [1].

Open gates automatically using RFID: RFID stands for Radio frequency identification which is basically
an automatic identification method. The data stored on RFID tags can be retrieved remotely. RFID tags
can be incorporated into systems for identification of a person or any other product. The information of
a person or product is tracked using radio waves. RFID technology basically aims to replace the barcode
readers and magnetic strip and provides efficient working of a system [2]. Unfortunately, this system has
two major disadvantages, its high cost and the probability of radio frequency interference. In many luxury
vehicles, windshields and windows are made of glass with metal oxide, which blocks radio signals from
passing through. These vehicles cannot use an RF-ID Tag that mounts inside, because the windows block
the signal. To avoid this problem, the vehicle owner may be forced to purchase a more expensive external
waterproof tag, which mounts on the front headlamp [1].

4|Page
Figure (1-2) Open gates automatically using RFID

Open gates automatically using Barcode: Barcode Decals are read by specialized outdoor Barcode
Readers. An adhesive-backed barcode decal is applied to the side window of a vehicle. When that vehicle
passes the barcode reader, it decodes the decal which identifies the vehicle and opens the gate. These
systems have several advantages including reliability, ease of use and the low cost of decals. Also, Barcode
readers are optical systems, they are not affected by radio frequency interference [1].When a BAi Barcode
Decal has been properly applied to window glass, it stays there - it cannot be loaned out or lost. If it is a
BAi Black-on-Black label on a tinted window, it will blend in to appear nearly invisible. Our system is not
affected by radio interference or low battery life. Even better, BAi Readers only work with the original
decal. It will not read photographs, photocopies or digital images of our barcode decals [1].

Figure (1-3) Open gates automatically using Barcode

5|Page
1.3 Purpose of the project
The purpose of the project is to design an electronic check point based on computer vision algorithm
to detect the car number. If the vehicle detected number is identical to one of the numbers stored in the
system database the gate will open; however, if the car number is identical to one of the stored numbers
in the stolen cars database, an alarm will work and the door will not open.

6|Page
CHAPTER TWO

METHOD
We use some microcontrollers such as Arduino mage as a middle link between the computer
and the components controlled by the computer. These components include the servo motor, which holds
the gate arm, the alarm, the led, and the Distance sensor .The computer sends the Arduino commands
across the USB port and then from the Arduino to the components.

2.1 component
Component used in the project, Arduino mage Control opening and closing of leds and gate as
well as alarm. Arduino oun Used to control the Ultrasonic Sensor. Ultrasonic Sensor Used to detect the
presence of the car and close the gate and feel after the exit of the car from the gate. The servo motor is
used to carry the gate arm and open and close the doors after receiving the instruction to open and close
it. And Camera used to take picture to car plate.

2.1.1 Arduino Mega: The Arduino Mega is a microcontroller board based on the ATmega1280. It has 54
digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware
serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset
button. Simply connect it to a computer with a USB cable or power it with an AC-to-DC adapter or battery
to get started figure (2-1). The Mega is compatible with most shields designed for the Arduino
Duemilanove or DiecimilaIt is programmed by Matlab. From datasheet some features [3]:
Microcontroller:ATmega1280
Operating Voltage:5V
Input Voltage (recommended):7-12V
Input Voltage (limits):6-20V
Digital I/O Pins:54 (of which 15 provide PWM output)
Analog Input Pins:16
DC Current per I/O Pin:40 mA
DC Current for 3.3V Pin:50 mA
Flash Memory:128 KB of which 4 KB used by bootloader
SRAM:8 KB
EEPROM:4 KB
Clock Speed:16 MHz

7|Page
Figure (2-1) Arduino mage

2.1.2 Arduino Uno: is a microcontroller board based on the ATmega328P. It has 14 digital input / output
pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal, a USB connection,
a power jack, an ICSP header and a reset button. Simply connect it to a computer with a USB cable or
power it with AC-to-DC adapter or battery to get started [4].

Figure (2-2) Arduino uno

8|Page
2.1.3 HC - SR04 Ultrasonic: The module performance is stable, measure distance accurately. SRF05,
SRF02 ultrasonic mounting module and abroad comparable [5]. Main Features:
Static Current: Less than 2mA
Output Signal: Electric frequency signal, high level 5V, low level 0V
Sensor Angle: Not more than 15 degrees
Detection Distance: 2cm-450cm
High Precision: Up to 0.3cm
Input Trigger Signal: 10us TTL impulse
Echo Signal: Output TTL PWL signal
Input Voltage: 5V

Figure (2-3) HC - SR04 Ultrasonic

2.1.4 Servo Motor: Unlike dc motors, with servo motors you can position the motor shaft at a specific
position (angle) using control signal. The motor shaft will hold at this position as long as the control signal
not changed. This is very useful for controlling robot arms, unmanned airplanes control surface or any
object that you want it to move at certain angle and stay at its new position.. Servo motors may be
classified according to size or torque that it can withstand into mini, standard and giant servos. Usually
mini and standard size servo motors can be powered by Arduino directly with no need to external power
supply or driver. Specifications [6]:
Voltage 4.2-6V
Speed 0.18 sec/60degree (4.8v), 0.16 sec/60degree (6v)
Torque 6 kg.cm (4.8v), 7.5 kg.cm (6v), Stall torque
Dimension 40.8 x 20.1x 38 mm
Weight 52g

9|Page
Figure (2-4) servo motor

2.1.5 Alarm (5X95DB): Alarm Arduino High-decibel12V Electronic Buzzer Beep. Specification [7]:
Color: White
Quantity: 5 pc
Alarm Diameter: 29mm / 1.14"
Alarm Height: 15mm / 0.59
2 Mounting Holes distance: 40mm / 1.57"
2 Wires length: 105mm / 4.13"
Rated Voltage: 12V
Operating Voltage: 3-24V
Rated Current(MAX): 20mA
Min Sound Output at 10 cm: 95 DB
Resonant Frequency: 3100500
Operating Temperature: -20 ~ +80
Intermittent Sound
Mounting Holes

Figure (2-5) 5X95DB Alarm

10 | P a g e
2.1.6 Logitech C525 720p HD Webcam Camera [8]:
Resolution: 1280*720
Sensor: CMOS
Sensor pixels: 8MP
Frame rate: 30fps
RAM: 2GB
Hard disk space: 200MB
Zoom MODUS: automatic focusing

Figure (2-6) Logitech C525 720p HD Webcam Camera

2.1.7 Ac\dc adapter:


Model: DLL015122000D

Input: 100-240-50\60HZ 0.55A


Output: +12V=2A

11 | P a g e
Figure (2-7) ac\dc adapter

2.1.8 Led (light-emitting diode) [9]:


Power dissipation :75 mW
DC Forward Current :30 mA
Peak Forward Current :155 mA
Reverse Voltage: 5 V

Figure (2-8) light-emitting diode

12 | P a g e
2.2 Connecting hardware

Connect the Arduino mage to the Matlab with the USB cable. Connect pin (5, 6, 7) of Arduino
mage to The tip of the anode of (3) led by Jumper Wire and the other side to ground of Arduino mage and
connect pin (9) with The data terminal of the servo motor The other two sides of the servo motor, one of
them to ground of arduino mage and the other to (vcc) of Arduino mega. Connect pin (4) with the data
terminal of the buzzer and the other side to ground of Arduino mega. Also Connect pin (A0, A1) of Arduino
mega to pin (D7, D6) of Arduino uno by Jumper Wire. connect pin (9,8) to terminal (tri,acho) of one of
the HC - SR04 Ultrasonic and terminal (tri,acho) of other the HC - SR04 Ultrasonic connect to pin (D3,D4)
of Arduino uno And both parties of the HC - SR04 Ultrasonic of (vcc,ground) connect to (vcc,ground) of
Arduino uno. Connect pin (D10) of Arduino uno to the tip of the anode of led by Jumper Wire and the
other side to ground of Arduino uno. The Arduino uno gets voltages from the ac\dc adapter while the
Arduino mage gets a voltages from the computer across the USB cable.

13 | P a g e
Figure (2-10) procedure hardware

14 | P a g e
Figure (2-11) procedure hardware

15 | P a g e
CHAPTER THREE

SOFTWARE

Languages in which the program is written Arduino IDE and Matlab. Programs that control
Ultrasonic that is connected with the Arduino uno are written in Arduino IDE. Computer vision and
program to control the servo motor and alarm that is connected with the Arduino with Arduino mage are
written in Matlab.

1- Matlab is widely used in all areas of applied mathematics, in education and research at universities,
and in the industry. MATLAB stands for Matrix Laboratory and the software is built up around vectors and
matrices. This makes the software particularly useful for linear algebra but MATLAB is also a great tool for
solving algebraic and differential equations and for numerical integration. MATLAB has powerful graphic
tools and can produce nice pictures in both 2D and 3D. It is also a programming language, and is one of
the easiest programming languages for writing mathematical programs. MATLAB also has some tool boxes
useful for signal processing, image processing, optimization, etc. [10].

2- The Arduino IDE (Integrated Development Environment): is the program used to write code, and
comes in the form of a downloadable file on the Arduino website. The Arduino board is the physical board
that stores and forms the code uploaded to it. Both the software package and the board are referred to
as "Arduino" [11].

3.1 Camera software and Arduino mage in matlab


We use the function webcam ('Logitech HD Webcam C525') to turn on the camera and we also use
the function snapshot ( ) to take a picture from the camera. It uses other functions such as cam.Focus
cam.Zoom to control the focus and zoom the camera. As for Arduino it is initialized through the function
arduino( ). The servo motor is initialized and Determine pin which connects motor to the Arduino by
using function servo () .The function writePosition( ) is used to control the angle of the arm servo motor.
Turn on the LEDs connected with the Arduino through the function. writeDigital)(. As for the alarm device
connected with Arduino is run through the function playTone( ).
.

Servo motor
camera

matlab

16 | P a g e
Figure (3-1) software

3.2 Arduino Software

When the car passes from the first Ultrasonic that is connected with the Arduino uno, the green led will
work and also sends a 5-volt pin (D7) that will be read by the Arduino mage through the pin (A0). If the
car passes through the second Ultrasonic, the Arduino uno will send 5 volt to the pin (D6) which will be
read by the Arduino mage through the pin (A1).

3.3 Matlab Software

When the car passes beside the HC - SR04 Ultrasonic, The green led connected with pin (10D)
of the Arduino uno will turn on and the Arduino mage will read voltages less 5V from pin (7D) of the
Arduino uno through pin (A0) of Arduino mage .After that, a picture of the car plate will be taken. This
image is analyzed by Computer vision. If computer cannot read the car number from this picture, the blue
led connected with pin (7D) of the Arduino mage will turn on and then a short period will turn off. If
computer can read the car number from this picture, computer will compare this number with the
numbers stored in the file text. If the vehicle number is identical to one of the numbers stored in the
vehicle file text that is allowed to pass, The Arduino will send the servo motor signal to the Data wire of
the servo motor connected to pin (9D) of the Arduino mage to move to position (0.5) so that the gate will
open and the white led connected with pin (5D) of the Arduino mage will turn on and after entering the
car(Passing the HC - SR04 Ultrasonic (2) Full body of the vehicle the Arduino mage will read voltages 0V
from the pins(7D,6D) of the Arduino uno through pin (A0,A1) of Arduino mage), The Arduino will send
the servo motor signal to move to position (0) so that the gate will closes and the white led connected
with pin (5D) of the Arduino mage will turn off. But if the car number is identical to one of the stored
numbers in the stolen vehicle file text, The Arduino will send the alarm signal to the Data wire of the
alarm connected to pin (4D) of the Arduino mage to work and the white, red and blue leds connected with
pins (5D,6D,7D) of the Arduino mage will turn on and then a short period The Arduino will send the alarm
signal to close and also the white, red and blue leds connected with pins (5D,6D,7D) of the Arduino mage
will turn off . If the car number does not match the numbers stored in the stolen car file and the file is
allowed to pass, the red led connected with pin (6D) of the Arduino mage will turn on and then a short
period will turn off.

17 | P a g e
Start

no
input

If there is a
car Alarm work
Stolen car yes
And door closed
yes

Input image

yes
no
Computer vision to
extract the car plate

This is a mistake in A car is Open the door and


extracting the car allowed to yes close the door after
plate leaving the car
pass

no

Compare with store number no


store in database

end

Figure (3-2) software

18 | P a g e
3.4 Computer vision
Used to read the car number. The process of reading the car number goes through several stages:

1- Take a picture from the camera


2- Convert image to gray with resized size to [400 * NAN]. After that morphological image processing
with Convert image to binary.
3- Then detect the area containing the car number
4- Cut the area containing the car number
5- And then revealed the numbers and letters Arabic and English in this region
6- Cut the area containing Arabic characters and numbers
7- The detection of figures and Arabic letters in this region
8- Matching process: Take object and change its size to [200 *120] and work with the matching images
of the characters in the function similarityletters and if the item matches with one of the images
write the sequence number of the image stored in the matrix of letter. After completing the
characters, take the rest of the objects and change their sizes to [200 *120] and work with the
corresponding images of the numbers stored in the function similaritynumbers.

19 | P a g e
1

7
Figure (3-3) Computer vision

20 | P a g e
3.5 GIU interface

Used to facilitate the work of the program such as closing the program or open the program and some
other features That make our deal with This system is easier.

1 4 11
2
3 5
6 8
7 9 10

Figure (3-4) GIU interface

1- Start button: Used when pressed, will turn green, indicating that the program will start

2- Stop button: The program stops when the program is pressed, the color of the Start button changes to
white, this shows that the program stopped

3- Exit button: Used to exit the interface and Prefer to stop the work of the program if it works and then
exit.

4- Used to display the car number.


5-Used to display the work that the program will perform after reading the number.

6- When you press this button, the numbers of cars allowed to pass will appear on the screen (7).
7- This screen will show the number of cars allowed after pressing the button (6).

21 | P a g e
8- When you press this button, the stolen car numbers will appear on the screen (9).
9- This screen will show the stolen car numbers after pressing the button (8).

10- When storing stolen car numbers or allowed to pass through a file, you must write Character any
number you want to write within this file that should be in the form of a number. When you press this
button, an interface will appear that contains the table of each character and the number that
corresponds.

Figure (3-5)

11-Four screens showing how the computer analyzes the car number.

22 | P a g e
CHAPTER FOURTH

RESULTS AND CONCLUSION

4.1 Results
We tested this system On different car plates in terms of color (The red color for a car used for a taxi,
white for a private car, and a blue car belonging to a government and As for the color yellow is used for
car load) and number, where use all the numbers and put this the car numbers in a different angle and
lighting brightness.
Table (4-1)

Picture of the car Detect the location Read the number


number plate of the car number

A87648

H87778

M48914

23 | P a g e
B77878

B74848

E74446

J97999

H97919

24 | P a g e
Z94966

E74746

F77878

J97669

F978 73

25 | P a g e
A87678

A86648

H97979

H87978

H87678

26 | P a g e
R48604

L45713

L48444

L45763

W38563

W36563

27 | P a g e
M48994

K91436

D21218

D46975

M38397

28 | P a g e
R48404

M48997

L48764

N38383

R41601

29 | P a g e
M41611

R41604

M41601

N38543

S86748

30 | P a g e
R45713

D44444

K91936

M48397

R49713

S86746

31 | P a g e
M38333

S36646

W36646

M41614

W36666

32 | P a g e
N38333

W36663

E74848

J97699

D46675

D48444

33 | P a g e
B74878

F97669

T97669

T36646

4.2 Conclusion
After using 60 plates of a car numbers and place in a different angle and lighting, this system can detect
the location of the car number in the car plate and read the number. In cases, the system fails to read the
car number, such as if the car is far from the camera, the system will fail to read the number from the car
plate , This problem has been solved by using a sensor that does not take a picture unless the car is close
to the camera . As well as if the car is too close to the camera and part of the character or number is
missing, the system will also fail to read the car number. Sometimes the system fails to read the car
number if the car plate is tilted.

34 | P a g e
WORKS CITED

[1] "bai," [Online]. Available: http://www.barcode-automation.com/barcode-comparison.php.

[2] "kfrlab," [Online]. Available: http://www.kfrlab.com/pages/rfid_project.html.

[3] "Arduino," 2014. [Online]. Available: https://www.arduino.cc/en/Main/arduinoBoardMega.

[4] "arduino," 2014. [Online]. Available: https://store.arduino.cc/usa/arduino-uno-rev3.

[5] "gearbest," [Online]. Available: https://www.gearbest.com/development-


boards/pp_58067.html?vip=2511153&gclid=CjwKCAjwo4jOBRBmEiwABWNaMckHApiyPewmvM
5OaaJAsyKYKJ6AnoCH0o59WYb9FSOosl0LP2m52xoC4KYQAvD_BwE.

[6] "Future Electronics," [Online]. Available: https://store.fut-electronics.com/products/standard-


metal-servo-motor-7-5-kg-cm.

[7] "banggood," [Online]. Available: https://www.banggood.com/5X95DB-Alarm-Arduino-High-


decibel12V-Electronic-Buzzer-Beep-p-933696.html.

[8] "compareimports," [Online]. Available:


https://www.https://www.compareimports.com/sku/3927008-Logitech-C525-720p-HD-
Webcam-Camera/?gclid=CjwKCA.com/sku/3927008-Logitech-C525-720p-HD-Webcam-
Camera/?gclid=CjwKCAjwo4jOBRBmEiwABWNaMepdU-
PA3zDo8z2qODgIMdSezOtrC7vi1WM6tV1S2d0gZtPPh8DhlhoCHYkQAvD_BwE.

[9] "datasheet," [Online]. Available: https://cdn-shop.adafruit.com/datasheets/WP7113SRD-D.pdf.

[10] K. Sandberg, "math," [Online]. Available:


https://www.math.utah.edu/~wright/misc/matlab/matlabintro.html.

[11] "wpi," 3 December 2014. [Online]. Available:


https://wiki.wpi.edu/robotics/Introduction_to_Arduino_IDE.

35 | P a g e
36 | P a g e

You might also like