-
Thông tin
-
Hỏi đáp
Đồ án môn Mechatronic system đề tài "Iot parking LOT system" | Đại học Sư phạm Kỹ thuật Thành phố Hồ Chí Minh
Đồ án môn Mechatronic system đề tài "Iot parking LOT system" của Đại học Sư phạm Kỹ thuật Thành phố Hồ Chí Minh với những kiến thức và thông tin bổ ích giúp sinh viên tham khảo, ôn luyện và phục vụ nhu cầu học tập của mình cụ thể là có định hướng ôn tập, nắm vững kiến thức môn học và làm bài tốt trong những bài kiểm tra, bài tiểu luận, bài tập kết thúc học phần, từ đó học tập tốt và có kết quả cao cũng như có thể vận dụng tốt những kiến thức mình đã học vào thực tiễn cuộc sống. Mời bạn đọc đón xem!
Môn: Mechatronic system
Trường: Đại học Sư phạm Kỹ thuật Thành phố Hồ Chí Minh
Thông tin:
Tác giả:
Preview text:
lOMoARcPSD| 36625228 lOMoAR cPSD| 36625228
HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY AND EDUCATION
FACULTY FOR HIGH QUALITY TRAINING
PROJECT OF MECHATRONIC SYSTEM IOT PARKING LOT SYSTEM Table of Contents Abstract 1 Chapter 1: OVERVIEW 2 1.1. Introduction 2 1.1.1. Problems in Vietnam 3
1.1.2. Suitable solutions for current parking lot status in our country 3 5 1.1.3. IoT Parking Lot Demand 6
1.2. Misidentification of IoT Parking Lot 6 7 1.3. Project Goal 7
Chapter 2: LITERATURE REVIEW 72.1. Demand for parking lot in Vietnam 8
2.2. Global smart parking systems market size 9
2.3. Available technologies used in smart parking lot 92.3.1. Image processing technique 10 lOMoARcPSD| 36625228 2.3.2. RFID Techinique 12
Chapter 3: DESIGN AND IMPLEMENTATION 15 3.1. Block Diagram 15 3.1.1. Block listing 15 3.1.2. Connection 16 3.2. Operational Description 17 3.3. Components 17 3.3.1. Raspberry Pi 4 17 3.1.2. RFID Card 19 3.3.3. Module RFID RC522 20
3.3.4. 16x02 LCD Display Module 21 3.3.5. I2C Module 23 3.3.6. Infrared (IR) Sensor 24
3.3.7. Camera IPCC-9610 V2 - 10x 25 3.3.8. Servo motor SG90 26 3.4. Operational Design 28 3.4.1. Control Process 28
3.4.2. Web server system design 29 3.5. Software Design 29 3.5.1. Algorithm explained 29
3.5.2. Algorithm model for license plate recognition 33
3.5.3. Identify occupancy in the parking lot 41
3.5.4. Transfer data to web server 44
Chapter 5: CONCLUSION AND RECOMMENDATIONS 47 5.1 Lessons learned 47 5.2 Future work 47 5.3 Project improvements 47 lOMoARcPSD| 36625228
Figure 1.1. Traffic congestion in metropolises on peak hours 2
Figure 1.2. The vacant lands become temporary parking, significantly affecting urban beauty. 3
Figure 1.0.3. Using ultrasonic control sensors in parking lot 4
Figure 1.0.4. Detect occupancy by image processing 5
Figure 1.0.5. The penetration rate of “smart” parking spaces in the public domain reached 11% in 2018
and is expected to reach 16% by 2023 5
Figure 2.0.1. Self-spontaneous parking lot rise throughout the city because people's parking needs rise 7
Figure 2.2. Global parking system market size predicted 9 Abstract
In recent years, large cities of Vietnam have implemented many measures to develop static
traffic in urban areas. However, plans to overcome the lack of parking lots have not yet
promoted efficiency. Therefore, application of IoT for parking lots is completely necessary,
when traditional parking lots cannot meet the increasing demand for vehicles today. In
addition, It is also impossible not to mention the remarkable role of IoT. This is a network
connecting devices together, in which devices can transmit information and data with each
other without human intervention. Moreover, we apply machine vision in identifying
vehicle license plates and available places, then transfer data to our website to be able to
easily control and help customers to capture the status of the parking lot. Besides, we also
encountered many difficulties in the idea and deploying a smart parking lot. First, it can be
mentioned as the process of collecting data on license plates so that the system can learn
and identify Vietnam's license plate. Second, it is a challenge for us to design a website
and send data to it, as we take a lot of time to be able to build a website and transmit data
as well as information up completely. Finally, the system is almost complete when it is
possible to identify and analyze the number of license plates, count the remaining space up
to 90% and transfer data to the website correctly. Chapter 1: OVERVIEW 1.1. Introduction
1.1.1. Problems in Vietnam
In metropolises, the large population entails that the moving needs of the people increases
and also directly increase individual vehicles. City managers should solve some issues
about flow traffic so that minimizes traffic jams in peak hours, building additional
infrastructure such as highways, undergrounds, expanding additional routes to meet the
density of vehicles, and developing a lot of parking lots to serve the demand for residents.
For instance, in some large cities of our country today, like Ho Chi Minh City, finding a
parking lot in the city center is very difficult, because the car traffic daily in the city is
always bigger a lot compared to the number of built-in parking lots. So users are difficult
to find parking lot to send their vehicles. lOMoARcPSD| 36625228
Figure 1.0.1. Traffic congestion in metropolises on peak hours
Not only that, the lack of measures to develop static traffic in the city has contributed to
slowing the progress of building new parking lot. Besides, plans to overcome the lack of
parking lots have not yet been effective because investors have not seen their potential.
Currently, the condition of parking lot is gradually becoming a problem in big cities in our
country on Tet holidays and as usual days. Meanwhile, there are also a lot of spontaneous
parking lots with the aim of profit from people's car deposits but does not guarantee
security, quality management and especially taking ticket prices very expensive, making
many parts of people dissatisfied. So it can be seen that the demand for smart and safe
parking at the moment is currently extremely large.
Figure 1.0.2. The vacant lands become temporary parking, significantly affecting urban beauty. lOMoARcPSD| 36625228
Spontaneous parking lots have lost the aesthetics of the urban area without meeting safety
and convenience. So we believe that the development of smart parking lot is an urgent need for our current situation.
1.1.2. Suitable solutions for current parking lot status in our country Manual counting
In order to resolve that need, namely increasing the interaction between car owners and
owners of parking, IoT parking lot was established to help customers can capture the
situation of the parking lot anywhere. With current situation, the car owner when it comes
to a place, it will be very difficult to find a available place, because they won't know the
parking lots around them or not, so updating the parking lot status up to the websites are
extremely necessary, that helps the car owner quickly reach where they want to minimize
the time on the road, causing traffic jams just because they search for a place to send a car.
To do this, there are many common ways to do today that can be listed as. The manual
counting method, the owner of the parking lot will hire people who are consecutively
counting the parking lot in about 30-60 minutes and updating parking lot status on their
website. This manual count is also quite main the corpses for small parking lots and in the
beautiful weather conditions, or the day of less cars. We believe that the countless space
with bare eyes is often very time consuming, and cannot be exactly if we increase the
project scale to dozens of hectares of land. It is very difficult for employees to manage it all.
Ultrasonic control sensors
Another method is also used for a long time that is use ultrasonic sensors. This is a method
that is usually applied in parking car in commercial centers or high-rise apartments. The
convenience point this way is to reduce labor costs, supervise 24/7 activities without the
need for intervention, adjustation of people, vehicle directions to the desired parking area
during low hours points to save electricity and management, favorable for maintenance,
and repair of equipment in the parking lot if necessary, absolute security system, anti-data
loss. The downside of the use of sensor systems that we can list, which are not suitable for
large-sized car beaches, because it cost a lot of money for sensors to set in a large land. lOMoARcPSD| 36625228
Figure 1.0.3. Using ultrasonic control sensors in parking lot
Image processing technique
As for our IoT parking lot, technology we use in this project, it is a image processing
combined with the data transfer method on our website. We suppose this is an effective
solution for medium and big parking lots, as it can solve the problems that traditional cars
are encountered, while minimizing installation costs as well as appropriate With more
terrain than installing sensor system.
Figure 1.0.4. Detect occupancy by image processing
1.1.3. IoT Parking Lot Demand
The IoT parking lot devices are connected to a raspberry that receive control signals from
cameras, sensors, or a website. Cameras received the signal and information about license
plates and places then Raspberry transmitted to the website to store, so the owner can
manage its customer information from a long distance. lOMoARcPSD| 36625228
Especially for big cities, parking problems are difficult to solve effectively. By 2023,
market spending for smart parking products and services was expected to grow with a
CAGR 14% and exceed 3.8 billion dollars under the IoT Analytics report. Thanks to
growth of market spending, it forced everyone to act to find a specific solution to overcome
the problem instead of holding traditional models.
Figure 1.0.5. The penetration rate of “smart” parking spaces in the public domain reached 11% in
2018 and is expected to reach 16% by 2023
1.2. Misidentification of IoT Parking Lot
Many people believe that the IoT parking lot system does not guarantee enough trust of
safety. Specifically, in order to operate this system, cutting the human resources is obvious,
so people will think that there is a lack of people who look after their property. Not only
that, they also believe that the device they are monitoring will not be equal to humans.
However, despite cutting down human resources, we believe that the IoT Parking Lot
System still ensures the ability to protect users' properties. IoT technology allows devices
to connect with each other and send data to the website, which allows the supervisor to
manage the parking lot from a long distance. Not only that, using both physical cards and
license plates will be a huge obstacle for the crook to aim at our car park.
Another problem, many businesses are still hesitating in replacing traditional parking lots
with smart parking lots because they think no matter whether to reduce labor, they still
have to pay a not small amount of expense in maintaining the IoT parking lot. This is indeed
not wrong, but if we look at the parking needs of our country, it will notice the potential of
the IoT parking lot system. Indeed, the IoT parking lot system will solve most previous
problems of traditional car parks, while increasing performance as well as being
convenient, comfortable for customers every time they come here. This is the goal we targeted. 1.3. Project Goal
In this project, we want to create an IoT parking lot system prototype with all the necessary
functions without consuming too much money to prove that an IoT parking lot is a
reasonable parking solution for metropolises. In order to resolve the issues that traditional lOMoARcPSD| 36625228
parking lot is encountered and at the same time increasing customer experience when using
this service. We build a website to receive data that cameras and sensors transmit to manage
our car parking as well as combine those devices and let them operate automatically to
somewhen there are any employees looking after the park, the parking lot are able to still
operate normally. Therefore, customers can track the situation of parking lot at anywhere
to be able to easily make their decisions easily.
Chapter 2: LITERATURE REVIEW
2.1. Demand for parking lot in Vietnam
Realizing the reality of many shortcomings in car parking in Ho Chi Minh City. Our team
has launched smart parking lot system. Thus product are highly appreciated for safety for
users while saving time and employee costs. According to the statistics of Ho Chi Minh
City Police, the average in the city occurred 50-100 of motorbike losses in which the
hospitals, supermarkets, commercial centers, markets, etc accounting for 30%. The main
reason is because the crook used a fake ticket, the number plate or the car holder lost the
ticket. The idea of the parking system was born from there. With high security, our team
decided to apply this model as the topic for our project. We will provide the actual data to
persuade investors, potential partners or readers as your business will attract many
customers in a growing business and can guarantee sales out defy competition. This is one
of the most important parts of the business plan, including considering the size of the
current market and market development trends. Many the next part of the business plan as
the production part , Marketing and the total capital you need, will be based on the forecast
about sales mentioned in this section. Here are the parts that we want to mention in product market analysis .
Figure 2.0.1. Self-spontaneous parking lot rise throughout the city because people's parking needs rise lOMoARcPSD| 36625228
As we have seen, the needs of the customer are endless but the ability to respond to is finite,
so it is necessary to focus on the current urgent needs of our customers. Therefore, our
team has focused on finding out save the needs of customers about products that we want
to introduce to customers, a project that feasibility is quite high, meeting the need for the
current urgent level. The traffic jam is always a hot topic, there are many channels such as
press, radio, television posting this issue, and has a channel specializing in providing
information about traffic spots in the area The city to inform every people, the car flow
moves too much on the streets is a lot that the capacity of the current streets is limited so
the occurrence of the parking points is article weak to reduce traffic jams, but due to the
amount of vehicles too much, the current parking points have not really responded to the
requirements that customers want, the reason is:
● Safety levels of the above car parking points are not safe and secure
● Serving attitudes of car senders to non-delicate customers, as well as professional levels
● Vehicle sending time makes customers uncomfortable because they have to wait
until a long time for their turn
● Customers take a long time to go to nearby parking lot because they cannot know their current status.
2.2. Global smart parking systems market size
The global smart parking market was valued at $ 6.05 billion in 2019 and is expected to
reach $ 11.13 billion in 2027, reaching the CAGR speed of 12.6%.
Smart parking system market is based on hardware, software, services, types and
applications. According to the smart hardware parking system are segmented into (Pucks,
Camera & Lprs, smart, meters, signs, parking ports), according to software (parking guide
systems, analytical solutions ) According to the service (consulting services, technical
services), by type (off-street, on-street), by application (security & supervision, intelligent
payment system, electronic parking , Identify number plates) .In 2020, segment of parking
guidelines and accounting for nearly 75.0% of total revenue. These systems have become
popular in the market because they support drivers to save time by providing information
about free space, parking guides, available space and time available . These systems ensure
a better driving experience for drivers by tracking the status of many ultrasonic sensors and
electrical signals and providing user-friendly graphical interface. lOMoARcPSD| 36625228
Figure 2.0.2. Global parking system market size predicted
2.3. Available technologies used in smart parking lot
2.3.1. Image processing technique Gaussian filter
The Gaussian filter is said to be the most useful filter, implemented by convolutionalizing
the input image with a Gaussian filter matrix and then adding them together to form the output image.
The general idea is that the value of each pixel will depend more on the nearby pixels than
on the distant pixels. The weight of the dependence is taken according to the Gaussian
function (also used in the normal distribution). lOMoARcPSD| 36625228
Figure 2.0.3. Gaussian filter matrix representation
Assume the image is one-dimensional. The pixel in the center will have the greatest weight.
The pixels further away from the center will have a decreasing weight as the distance from
them to the center point increases. Thus, the closer the point is to the center, the more it
will contribute to the central point value.
Figure 2.0.4. Image filter formula based on 2-dimensional Gaussian function (horizontal and vertical) Bilateral filter
Bilateral filter is a highly effective filter in removing noise while preserving the contours (edges) in the image.
The Bilateral filter also uses a Gaussian filter with the distance to the center point, ensuring
that only nearby points participate in the value of the central pixel. However, it uses an
additional Gaussian function for the gray level, ensuring that only pixels with a gray level
similar to the central pixel participate in the smoothing process. Therefore, the Bilateral
filter preserves the edges in the image because the pixel at the edge has a very obvious change in gray level.
Furthermore, instead of operating on color channels separately like mean filter or Gauss
filter, Bilateral filter can perform purposeful color measurement in CIE-Lab color space,
smoothing color and preserve the edges in a way that is more suitable for human perception.
Figure 2.0.5. Photos before and after the Bilateral filter Canny Edge Detector
Canny edge detects the edge intensity and direction by calculating the gradient of the image
using edge detection operators. Edges correspond to a change of pixels' intensity. To detect lOMoARcPSD| 36625228
it, the easiest way is to apply filters that highlight this intensity change in both directions:
horizontal (x) and vertical (y)
Perform a Gaussian blur on the image. The blur removes some of the noise before further
processing the image. Non maximum suppression works by finding the pixel with the
maximum value in an edge. In the above image, it occurs when pixel q has an intensity that
is larger than both p and r where pixels p and r are the pixels in the gradient direction of q.
If this condition is true, then we keep the pixel, otherwise we set the pixel to zero (make it a black pixel).
Double thresholding sets two thresholds, a high and a low threshold, normalized all the
values such that they will only range from 0 to 1. Pixels with a high value are most likely
to be edges. It helps to choose a threshold ratio instead of a specific value and multiple that
by the max pixel value in the image.
Figure 2.0.6. Color image of rear car
Figure OCR with Tesseract, OpenCV and Python
Tesseract is an OCR (Optical Character Recognition) leading engine today. This tool is
distributed with the Apache 2.0 open-source license. It supports character recognition on
image files and outputs as plain text, html, pdf, tsv, invisible-text-only pdf. The user can
use it directly or the programmer can use the functions through the API.
Currently, Tesseract has developed to version 3.0x and can work on 3 popular operating
systems: Window, Mac and Linux. This tool supports character recognition of more than
100 different languages, including Vietnamese. Not only that, we can train the program to
use Tesseract to be able to recognize a certain language.
The request recognition system must first be trained with patterns of specific characters.
Intelligent systems with high recognition accuracy for most fonts are now commonplace.
Some systems are also capable of reconstructing the document's formatting close to the
original, including: images, columns, tables, and non-text elements. Currently, with
Vietnamese characters, word recognition software capable of directly identifying
documents scanned through scanners is no longer stored as an intermediate image file.
Document pages can be scanned and stored as multi-page files. The results are stored in
the format of Microsoft Word, Excel to serve the needs of data digitization well. lOMoARcPSD| 36625228
Figure 2.0.7. Tesseract OCR text localization and detection 2.3.2. RFID Techinique Definition:
RFID stands for Radio Frequency Identification (radio frequency recognition). It is a
remote radio recognition technique, allowing data on a chip to be read "do not expose"
through the radio wave path at a distance from 50 cm to 10 meters, depending on the type of RFID label card.
Service users will be provided with a magnetic card. This type of card contains ICs with
identity information about a product, animal or person to identify and track radio waves.
In the parking lot, the magnetic cards will be connected to the car sending information and
that means your information are managed better. Basically, magnetic cards like a ID car
owners and vehicles. Information on this card is unique. Each RFID card will have a different frequency range.
The basic RFID device includes an antenna or a coil, a transceiver (accompanied by the
decoder) and a RF card. When operating, RFID antenna will have a radio signaling function
to activate tags and read data related to vehicles. RFID antenna will be mounted on the transceiver or decoder.
It acts as a signal reader/scanner. When a card passes through the electromagnetic area due
to the antenna generate, the information on the card will be read and decoded. lOMoARcPSD| 36625228
Figure 2.0.8. Basic working of RFID implemented in parking lot system
How IoT parking lot system use RFID technique ?
Parking lot management system using RFID technology includes RFID device set,
computer has installed car parking management software, camera recorded images in the
parking lot. Operation of this system is as follows:
When the car through the lane on the parking lot, they will swipe the card at the RF card
reader installed outside the gate of the parking lot, while the camera is mounted in this
lanes will record the sea images vehicle number. Similarly, when taking the car from the
parking, guests also need to scan a card at the reader. If the information on two card scans
is similar, the car will be taken out of the yard.
The highlight of this system is the security of guest's information as well as vehicles,
limiting the maximum loss during the parking process. This is the reason that automatic
parking lots have no employees taking care but still much safer than traditional car parks. lOMoARcPSD| 36625228
Figure 2.0.9. Using a lot of devices combining with RFID
Chapter 3: DESIGN AND IMPLEMENTATION 3.1. Block Diagram 3.1.1. Block listing : Raspberry : Converter : Power Supply : RFID technique lOMoARcPSD| 36625228 : Monitor : Barrier : Camera : IR sensor 3.1.2. Connection lOMoARcPSD| 36625228
Figure 3.1. Block diagram connection
3.2. Operational Description
First, the automatic parking system recognizes the license plate at the entrance when the
car arrives at a specific location. The software analyzes license plate data through image
refinement techniques, image noise filters, and image processing algorithms to obtain
accurate information about each letter and number on the license plate. The data is saved
in the database and open the entry barrier. At that time, the cameras are installed in the
parking lot allows the driver to check the percentage of cars in the parking lot and the
number of parking spaces, and clearly identify each parking space. These cameras provide
images of the parking lot and analyze from these images, and then it uses a Cascade to
classify each parking space as if it is occupied by car or not. Cascade classify need to be lOMoARcPSD| 36625228
trained in the parking lot to improve accuracy even in dark, bright places and obstacles in
front of the camera. When the vehicle is leaving, the software processes using the
information updated at the time of entry and the image captured when the vehicle is at the
exit gate. If the input and output data match, the system will automatically check and open
the barrier. The system is constantly updated on the website so that parking lot owners can
manage all activities and conditions of the parking lot. 3.3. Components 3.3.1. Raspberry Pi 4 Definition:
In this project, we use raspberry pi 4 like a microprocessor to receive signals from devices
and control them. Raspberry PI is a very compact computer, and it is run by Linux operating
systems. Raspberry PI was developed by Raspberry Pi Foundation, a non-profit
organization. We can use Raspberry Pi as a computer because it has integrated everything
needed. Its SOC Broadcom processor BCM2835 includes CPU, GPU, RAM, microSD card
slot, Wi-Fi, Bluetooth and 4 USB 2.0 ports.
Figure 3.2. Raspberry pi 4 Application:
With Raspberry Pi, we just need to install the operating system, the mouse, keyboard and
screen that can be used as a computer. Raspberry PI is not fully replaced by a desktop or
laptop but it is a flexible device that can be used for electronic systems, computational
system settings, DIY projects, etc, with low expenses. Specification:
● Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
● 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
● 2.4 GHz and 5.0 GHz IEEE 803.31ac wireless, Bluetooth 5.0, BLE lOMoARcPSD| 36625228 ● Gigabit Ethernet
● 2 USB 3.0 ports; 2 USB 2.0 ports.
● Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with previous boards)
● 2 × micro-HDMI ports (up to 4kp60 supported)
● 2-lane MIPI DSI display port
● 2-lane MIPI CSI camera port
● 4-pole stereo audio and composite video port
● H.265 (4kp60 decode), H264 (1080p60 decode, 1080p30 encode) ● OpenGL ES 3.1, Vulkan 1.0
● Micro-SD card slot for loading operating system and data storage
● 5V DC via USB-C connector (minimum 3A*)
● 5V DC via GPIO header (minimum 3A*)
● Power over Ethernet (PoE) enabled (requires separate PoE HAT)
● Operating temperature: 0 – 50 degrees C ambient 3.1.2. RFID Card Definition:
RFID (Radio Frequency Identification) is a technology that uses a radio wave connection
to automatically identify and track identification tags attached to the object. This
technology does not use light rays like barcodes or direct contact. In other words, RFID
can replace barcodes on products sold at retail supermarkets. Instead of having to put the
device to the barcode to scan, RFID allows information that can be passed through small
distances without a physical contact. So, all of the benefits above, we recognize this
technology is really appropriate with our project. Application:
In recent decades, the theory of RFID technology has been enriched and improved, and
RFID tags have been developed rapidly, including active, passive, and semi-passive tags.
RFID tags are also used more and more widely. In the civil aspect, RFID are used in some
main fields like Identification, Access Control, Tracking, Anti-counterfeiting, Management, or Counting. lOMoARcPSD| 36625228
Figure 3.3. The applications of RFID
In this project, we develop RFID technology as a means for us to manage our car parking
in the most professional and effective way.
3.3.3. Module RFID RC522 Definition:
RFID RF522 module is a reader by using MFRC522 chip, which accepts the ID code from
the RFID card then sends the ID code to Raspberry. It is usually accompanied by an RFID
tag in a credit card format and an RFID tag in a keychain format. The cards can have 1K
or 4K memory divided into sectors and blocks. The RFID reader module RC522 is also
used to write RFID tags. To read the information encoded on a tag, it is placed in close
proximity to the Reader (does not need to be within direct line-of-sight of the reader). A
Reader generates an electromagnetic field which causes electrons to move through the
tag’s antenna and subsequently power the chip.
Figure 3.4. The RC522 RFID Reader module Specifications: ● Frequency range: 13,56 MHz ● Interface: SPI/I2C/UART ● Supply Voltage: 2,5V to 3,3V lOMoARcPSD| 36625228 ● Max. current: 13-26 mA ● Min. current: 10 uA ● Logic levels: 5V y 3V3 ● Reach: 5 cm
Figure 3.5. Module RFID RC522 pinout Pinout Configuration:
● VCC: RFID reader power pin RC522. It supports a supply voltage between 2.5V and 3.3V.
● RST: it is a pin to turn the module on and off. As long as the pin is in the LOW
state it will stay off with little consumption. When the state changes to HIGH the RC522 restarts.
● IRQ: interrupt pin that alerts the microcontroller when an RFID tag approaches the RFID reader RC522.
● MISO / SCL / TX: This pin has three functions. When the SPI interface is
enabled, it functions as slave output and master input.
● MOSI: entry in the SPI interface.
● SCK: clock signal of the SPI interface.
● SS / SDA / RX: The pin acts as a signal input when the SPI interface is enabled.
3.3.4. 16x02 LCD Display Module Definition:
LCD 1602 is a liquid crystal display. This component is a kind of dot matrix module. It is
used to show letters, numbers, and characters, etc. It's composed of 5x7 or 5x11 dot matrix
positions, with each position can display one character we input. LCD 1602 can separate lOMoARcPSD| 36625228
characters and lines by a dot pitch between two characters and a space between lines. The
meaning number of the LCD can show 2 rows with 16 characters in each row.
Figure 3.6. 16x02 LCD pinout Pinout Configuration:
● Vss (Ground): Ground pin connected to system ground
● Vdd (+5 Volt): Powers the LCD with +5V (4.7V – 5.3V)
● VE (Contrast V): Decides the contrast level of display. Grounded to get maximum contrast.
● Register Select: Connected to Microcontroller to shift between command/data register.
● Read/Write: Used to read or write data. Normally grounded to write data to LCD
● Enable: Connected to Microcontroller Pin and toggled between 1 and 0 for data acknowledgement.
● LED Positive: Backlight LED pin positive terminal
● LED Negative: Backlight LED pin negative terminal
● Data pins: Data pins 0 to 7 form a 8-bit data line. They can be connected to
Microcontroller to send 8-bit data. These LCD’s can also operate on 4-bit mode in
such cases Data pins 4,5,6 and 7 will be left free. Specification:
● Operating Voltage is 4.7V to 5.3V
● Current consumption is 1mA without backlight lOMoARcPSD| 36625228
● Alphanumeric LCD display module, meaning can display alphabets and numbers ●
Consists of two rows and each row can print 16 characters.
● Each character is build by a 5×8 pixel box
● Can work on both 8-bit and 4-bit mode
● It can also display any custom generated characters
● Available in Green and Blue Backlight Application:
At present, LCDs are used frequently in CD/DVD players, digital watches, computers, etc.
It is also used in many electronic projects and devices to display messages. In screen
industries, LCDs have replaced the CRTs (Cathode Ray Tubes) because these displays use
more power as compared to LCD, heavier & larger.
In this project, we use LCD 16x02 for the purpose of displaying available space in the
parking lot, and also showing "Full Slot" when the parking lot has no space available. 3.3.5. I2C Module Definition:
I2C is a simple method of communication that combines the best features of SPI and
UARTs. Module I2C supports LCD types using HD44780 drivers like LCD 1602, LCD
2004, etc. Connected to the microcontroller through the I2C interface. It is compatible with
most current microcontrollers. In this project, we use I2C to communicate easily with LCD
1602. Instead of using 12 pins of the microcontroller for connecting with the LCD. Figure 3.7. I2C module Pinout Configuration:
● GND: is a ground pin and should be connected to the ground of Arduino.
● VCC: supplies power to the module and the LCD. Connect it to the 5V output of
the Arduino or a separate power supply. lOMoARcPSD| 36625228
● SDA: is a Serial Data pin. This line is used for both transmit and receive. Connect
to the SDA pin on the Arduino.
● SCL: is a Serial Clock pin. This is a timing signal supplied by the Bus Master
device. Connect to the SCL pin on the Arduino. Applications:
It is much easier to connect an I2C LCD than to connect a standard LCD. We only need to
connect 4 pins instead of 12. Start by connecting the VIN pin to the 5V output on the
Raspberry Pi and connect GND to ground. Now, we are remaining with the pins that are
used for I2C communication. Through module I2C, we just use 4 pins: SCL, SDA, VCC,
GND to connect the LCD with the microprocessor.
3.3.6. Infrared (IR) Sensor Definition:
An infrared (IR) sensor is an electronic device that measures and detects infrared radiation
in its surrounding environment. Infrared radiation was accidentally discovered by an
astronomer named William Herchel in 1800. While measuring the temperature of each
color of light (separated by a prism), he noticed that the temperature just beyond the red
light was highest. IR is invisible to the human eye, as its wavelength is longer than that of
visible light (though it is still on the same electromagnetic spectrum). Anything that emits
heat (everything that has a temperature above around five degrees Kelvin) gives off infrared radiation.
Figure 3.8. Infrared (IR) Sensor
Principle & Application:
When there are no obstacles or objects within the detection distance, the output is at HIGH
position (5V or 3.3V). When the distance is shorter than or equal to the threshold set, the
output signal will change to position LOW (0V). The distance threshold can be set by
adjusting the potentiometer / trimpot on the board. This sensor module is only able to detect lOMoARcPSD| 36625228
distances between 2cm and 30cm within the view of the IR LED and Photoresistor. The
trigger distance is somehow very subjective to the object's surface material, color and shape.
In this project, we use IR Sensor as a tool to identify vehicles into or out of yards.
Specifically, we will arrange 2 IR Sensors in the 2 Barriers, they have the task of detecting
whether the cars pass to close the Barrier.
3.3.7. Camera IPCC-9610 V2 - 10x Definition:
This is a camera with a professional build and falls under the IP camera category. It comes
with a color sensor that makes resolution better up to 1920 x 1080 pixels. It has high-
quality zoom capabilities that produce sharp and clear images. Other features of the camera
are a motion sensor, zoom features, and easy-to-use ONVIF technology. The camera is
also compatible with various platforms like iPhones, Windows, and MacOS- so that you
can access footage anywhere. The downside of the camera is in its fragility. The smallest
hitch can necessitate the need for a new camera. The motors can be a bit noisy from time
to time which may just tip off a thief in the aftermath.
Figure 3.9. IPCC-9610 V2 - 10x Camera Specification:
● 10x optical zoom 2.0MP Resolution, Progressive Scanning CMOS with motorized
Varifocal lens, 2x h264 and one mjpeg video stream.
● Ultra low illumination 0;05 lux 0 lux(with IR on), 6pcs array adaptive IR LEDs,
Night Vision Effective distance: more than 60 meters.
● Privacy zone , Motion detect, 360 degree horizontal continuous moving..
● Windows IE, MacOS, IPhone, IPad support with Live Cams Pro. Android support
with mylivecams, Synology, BlueIris.. lOMoARcPSD| 36625228 Application:
Main Surveillance applications include Enterprise, Small business, Parking lots,
Hospitals, Traffic intersections, Backyards, Driveways, Courtyards, Farms and livestock,
Warehouse areas, Supermarkets, and Schools. In this project, we use this camera for
placing in 3 sites. One is placed in the parking lot to take a picture of available spaces and
send a signal to the microprocessor. The two rest we use for checking the license plates
of the cars and send the information to the microprocessor to process.
3.3.8. Servo motor SG90 Definition:
Tiny and lightweight with high output power. Servo can rotate approximately 180
degrees, and works just like the standard kinds but smaller. You can use any servo code,
hardware or library to control these servos. Good for beginners who want to make stuff
move without building a motor controller with feedback & gear box, especially since it
will fit in small places. It comes with 3 horns and hardware.
Figure 3.10. Servo motor SG90 Specification:
● Torque: 2.0kg/cm(4.8V), 2.2kg/cm(6V)
● Speed: 0.09s/60°(4.8V), 0.08s/60°(6V) ● Rotate angle: 180°
● Operating voltage: 4.8 ~ 6V ● Gear: plastic ● Dead band: 7us ● Weight: 10.5g
● Dimension: 22.8mm × 12.2mm × 28.5mm Application: lOMoARcPSD| 36625228
The main use of the servo motor is to achieve an accurate rotation angle between 90 degrees
- 180 degrees. This control can be applied to drive robots, move the machine hands up and
down, turn a sensor to scan throughout the room, etc. In this project, servo motors are used
to replace barriers put in entrance and exit gates to open and close.
3.4. Operational Design 3.4.1. Control Process
Figure 3.11. Control flow chart
3.4.2. Web server system design lOMoARcPSD| 36625228
Figure 3.12. Transfer data between users and website 3.5. Software Design
3.5.1. Algorithm explained Python Definition:
Python is an interpreted, object-oriented, and high-level language with dynamic semantics.
Python supports modules and packages, encouraging the program to modularize and reuse
code. The Python interpreter and the extensive standard library are available as source code
or as free binaries for all major platforms and can be freely distributed.
Figure 3.13. Python programming languague Advantages:
Python easily connects to other components:
● Python can connect to COM, .NET objects (Ironpython, Python for .net), and
CORBA, Java… Python is also supported by Internet Communications Engine
(ICE) and many other connection technologies. lOMoARcPSD| 36625228
● It is possible to write libraries in C/C++ to embed in Python and vice versa.
Python is a cross-platform language:
● Python is available for all operating systems: Windows, Linux/Unix, OS/2, Mac,
Amiga, and others. There are even versions that run on .NET, Java virtual machines,
and mobile phones (Nokia Series 60). With the same source code will run the same on all platforms.
Python is very simple and easy to learn:
● Python has a very large programming community, a standard library system, and
even open-source libraries that are shared on the network.
Python is an open-source language Installing:
● Python using an open-source license should be freely used and distributed, even
commercially. The Python license is administered by the Python Software Foundation. HTML Definition:
HTML stands for HyperText Markup Language. It is used to design web pages using a
markup language. HTML is the combination of Hypertext and Markup language.
Hypertext defines the link between the web pages. A markup language is used to define
the text document within a tag which defines the structure of web pages. This language is
used to annotate (make notes for the computer) text so that a machine can understand it
and manipulate text accordingly. Most markup languages (e.g. HTML) are humanreadable.
The language uses tags to define what manipulation has to be done on the text. lOMoARcPSD| 36625228
Figure 3.14. HTML programming language Advantages:
HTML is not a programming language. Although it constitutes the components of the
Website. But cannot create "dynamic" functions for the Website.
As I mentioned above, it helps to form the basic structure of a Website, making the Web a
complete system. Specifically, this hypertext markup language helps to layout and frame
Web page elements. At the same time, it also supports the declaration of digital files such
as music, videos, images, etc.
HTML has many formatting tags, so you can easily and efficiently present Web pages with
this hypertext markup language. To me, it is easy and simple to use markup language. We
can use it to design Web pages with text dynamically. CSS Definition:
CSS stands for Cascading Style Sheets, it is a language used to find and reformat elements
generated by markup languages (HTML). In short, the language of styling the website. You
can simply understand that, if HTML plays the role of formatting elements on the website
such as creating paragraphs, headings, tables, etc., then CSS will help us to add styles to
the elements. That HTML like changing layout, page color, changing text color, font, changing structure… lOMoARcPSD| 36625228
Figure 3.15. CSS programming language Advangtages:
Thanks to CSS, the source code of the Web page will be organized more neatly and orderly.
Website content will be more separate in the display format. From there, the process of
updating content will be easier and can minimize confusion for HTML code.
CSS style definitions are stored in external CSS files so an entire site can be changed by
changing just one file. Using CSS eliminates the need to repeat descriptions for each
element. From there, you can save maximum time working with it, making the code
shorter, making it easier to control unnecessary errors. CSS creates many different styles
that can be applied to many websites, thereby reducing the risk of repeating the same web page formats.
CSS provides more granular properties than HTML to define the look and feel of a web
page. CSS gives users multiple styles on an HTML web page so the possibilities for your
page customization become limitless. Javascript Definition:
Javascript is a programming language with the ability to bring to life when designing
websites. This is a scripting language, based on an existing development object, or
selfdefined. Because of its convenience and high application efficiency, this programming
language is trusted more and more, widely applied in effective websites. lOMoARcPSD| 36625228
Figure 3.16. JavaScript programming language Advantages:
The use of JS language can be applied to all different browsers, currently commonly used
like Chrome, or Firefox, etc. Moreover, this is also an efficient programming language,
fully supported. on mobile device browsers. Therefore, the use is diverse, and can meet
many different needs and requirements of users.
Simplicity, ease of learning and use are the hallmarks of this programming language. With
syntax quite similar to English, using Javascript becomes much easier and more accessible.
The DOM model is used, providing many useful, pre-written features that provide good
responsiveness to the different needs and requirements of the user.
With many useful features that the Javascript programming language brings, it becomes
easier to develop a script to solve a request or purpose. Custom human purposes are
effectively met with the help of JS.
3.5.2. Algorithm model for license plate recognition Color image
Color image is a composite image from 3 primary colors: red (R), green (G), blue (B) and
is usually acquired on different frequency bands. With color images, the representation is
similar to black and white images, except that the numbers at each element of the matrix
represent 3 separate colors including red(R), green(G), blue(B). To represent every color
pixel requires 24 bits, these 24 bits are divided into 3 intervals of 8 bits. Each color is also
divided into 256 different color levels. Each of these intervals represents the luminance of the primary colors. lOMoARcPSD| 36625228
Figure 3.17. Color image importing
A color image is a finite set of pixels with a suitable gray level used to describe an image
that is close to the real image. The number of pixels determines the resolution of the image.
The higher the resolution of the image, the more clearly the characteristics of the image are
displayed, making the image more realistic and sharper.
An image is a two-way signal. It is defined by the math function f(x, y) where x and y are
2 and degrees horizontally and vertically. The values of f(x, y) at any point provide the
pixel values at that point of an image. Binary image
Binary image only 2 values are 0 and 255 (integer domain) or 0 and 1 (real number domain
/ for ROI). Each picture element (picture element-pixel) corresponds to a small point on
the screen and is controlled with a light code on or off, stored as a bit (1 for bright or 0 for
off), for with black-and-white screens. Steps of image binary: lOMoARcPSD| 36625228
Figure 3.18. Binary image
● Convert a color image to a grayscale image or read it up with a grayscale image flag.
● Set the threshold for binary image.
● Apply thresholding to grayscale images to generate binary images or apply image
binarization algorithms. Pixels with a value greater than the threshold we set by 255
(or 1), less than the threshold we set by 0. Gray image
Gray image, also known as monochrome image, where each destiny has only one color,
gray. For each strong point there will be 256 different gray levels. Each gray level is
represented as an integer between 0 and 255, with 0 representing the darkest intensity, 255
representing the brightest intensity.
An image is a collection of a matrix of pixels (pixels), each pixel can be represented in n
bytes under different color channels. Conversion between color systems is usually done
through matrix transformations, converting a 24-bit RGB image to an 8-bit Grayscale image. lOMoARcPSD| 36625228
Figure 3.19. Gray image Image format
Images also have many different formats and the most common that we often encounter
are formats such as *.JPG, *.PNG, *.GIF, *.TIFF and *.BMP. These image formats have
different properties and are created to be used for different purposes. The JPG (JPEG)
image format is the most common image standard today and is used directly in these topics.
With advantages such as color depth from 24 bits to 16 million colors, suitable for creating
small image files, JPEG is compatible with every current web browser, best used for black
images. white, photos with complex colors, still life photos, usual photos, portrait photos Canny Edge Detector
Figure 3.20. Canny processing
Canny edge detects the edge intensity and direction by calculating the gradient of the image
using edge detection operators. Edges correspond to a change of pixels' intensity. To detect
it, the easiest way is to apply filters that highlight this intensity change in both directions:
horizontal (x) and vertical (y) lOMoARcPSD| 36625228
Perform a Gaussian blur on the image. The blur removes some of the noise before further
processing the image. Non maximum suppression works by finding the pixel with the
maximum value in an edge. In the above image, it occurs when pixel q has an intensity that
is larger than both p and r where pixels p and r are the pixels in the gradient direction of q.
If this condition is true, then we keep the pixel, otherwise we set the pixel to zero (make it a black pixel).
Double thresholding sets two thresholds, a high and a low threshold, normalized all the
values such that they will only range from 0 to 1. Pixels with a high value are most likely
to be edges. It helps to choose a threshold ratio instead of a specific value and multiple that
by the max pixel value in the image. Optical Character Recognition (OCR)
Tesseract is a OCR (Optical Character Recognition) leading engine today. This tool is
distributed with the Apache 2.0 open-source license. It supports character recognition on
image files and outputs as plain text, html, pdf, tsv, invisible-text-only pdf. The user can
use it directly or the programmer can use the functions through the API.
Currently, Tesseract has developed to version 3.0x and can work on 3 popular operating
systems: Window, Mac and Linux. This tool supports character recognition of more than
100 different languages, including Vietnamese. Not only that, we can train the program to
use Tesseract to be able to recognize a certain language.
The request recognition system must first be trained with patterns of specific characters.
Intelligent systems with high recognition accuracy for most fonts are now commonplace.
Some systems are also capable of reconstructing the document's formatting close to the
original, including: images, columns, tables, and non-text elements. Currently, with
Vietnamese characters, word recognition software capable of directly identifying
documents scanned through scanners is no longer stored as an intermediate image file.
Document pages can be scanned and stored as multi-page files. The results are stored in
the format of Microsoft Word, Excel to serve the needs of data digitization well.
Number plate recognition steps
Figure 3.21. Recognising license plate steps
● Separate license plate: The photo after being taken by the camera is a panoramic
photo of the rear of the car. So we need to process and zone the area containing the
license plate. Then separate the license plate to perform the next step. lOMoARcPSD| 36625228
● Recognize character: We proceed to recognize the character and its characteristics into text using OCR.
Separate license plate
Separating license plates is the first and also the most important step in license plate
recognition. The image taken from the camera will contain information other than the
license plate, so we need to crop the image so that the remaining result is the license
plate. The number plate steps are shown as shown below: lOMoARcPSD| 36625228
Figure 3.22. Separating license plate steps
Separate license plate: The photo after being taken by the camera is a panoramic photo of
the rear of the car. So we need to process and zone the area containing the license plate.
Then separate the license plate to perform the next step.
OCR is the conversion of printed paper documents into machine-readable text documents.
When a scanned paper document undergoes OCR processing, the document's text can be
edited using word processors such as Microsoft Word or Google Docs.
Tesseract is a famous OCR library due to its higher accuracy than other libraries. Tesseract
can be run standalone or integrated with OpenCV. If run standalone, Tesseract uses the
Leptonica library to read images.
We proceed to recognize the character and its characteristics into text using OCR.
Separating license plates is also the most important step in license plate recognition. The
image taken from the camera will contain information other than the license plate, so we lOMoARcPSD| 36625228
need to crop the image so that the remaining result is the license plate. The number plate
steps are shown as shown below.
Figure 3.23. Parameters from the characters on the license plate
We get the parameters of the character on the license plate including the letter, the top left
point of the letter, the width and height of the letter.
3.5.3. Identify occupancy in the parking lot lOMoARcPSD| 36625228
Figure 3.24. Steps to identify vacancies on images Cascade Trainer GUI
This is a program that can be used to train, test and improve cascade classifier models. It
uses a graphical interface to set the parameters and make it easy to use OpenCV tools for
training and testing classifiers.
When Cascade Trainer GUI is first started you will be presented with the following screen.
This is the starting screen and it can be used for training classifiers. To train classifiers
usually you need to provide the utility with thousands of positive and negative image
samples, but there are cases when you can achieve the same with less samples.
To start the training, you need to create a folder for your classifier. Create two folders inside
it. One should be “p” (for positive images) and the other should be “n” (for negative images). lOMoARcPSD| 36625228
Figure 3.25. Cascade Trainer GUI tool
For training a boosted cascade of weak classifiers we need a set of positive samples
(containing actual objects you want to detect) and a set of negative images (containing
everything you do not want to detect). The set of negative samples must be prepared
manually, whereas set of positive samples is created
Negative samples are taken from arbitrary images, not containing objects you want to
detect. These negative images, from which the samples are generated, should be listed in a
special negative image file containing one image path per line (can be absolute or relative).
Negative images (not contain parking spot having car)
Positive Images are the images that contain our object. For example, positive images for a
parking spot that have a car in every one of them with any background. lOMoARcPSD| 36625228
Positive images (contain parking spot having car)
Set parameters in cascade training ● Common arguments
+ data: Where the trained classifier should be stored. This folder should be created
manually beforehand + vec: File with positive samples
+ background: Background description file. This is the file containing the negative sample images.
+ numPos and numNeg: The number of positive and negative samples used in
training for every classifier stage.
+ numberStages: Number of cascade stages to be trained
+ precalcValBufSize: Size of buffer for precalculated feature values (in Mb).
+ numThreads : Maximum number of threads to use during training. ● Cascade parameter
+ BOOST(default) : Type of stages. Only boosted classifiers are supported as a stage type at the moment.
+ HAAR(default), LBP: Type of features: HAAR - Haar-like features, LBP local binary patterns.
+ sampleWidth and sampleHeight : Width and Height of training samples (in pixels).
● Boosted classifier parameters
+ DAB, RAB, LB, GAB(default) : Type of boosted classifiers: DAB - Discrete
AdaBoost, RAB - Real AdaBoost, LB - LogitBoost, GAB - Gentle AdaBoost.
+ minHitRate: Minimal desired hit rate for each stage of the classifier.
+ weightTrimRate: Specifies whether trimming should be used and its weight. A decent choice is 0.95.
After the opencv_traincascade application has finished its work, the trained cascade will
be saved in cascade.xml file in the -data folder.
Setting fixed positions on the parking lot image and apply the .xml file just trained. Use
that file as a tool to check if there is a car in the parking space and will give the results as shown below. lOMoARcPSD| 36625228
Figure 3.28. Check parking space availability
3.5.4. Transfer data to web server
As the diagram illustrates, users can monitor and interact with the system parking through
the website. Then users' input transmits to the server which will process the input. The
apache software in the server helps us manage the transmission information between the
website and the server. After that, the server passes that information into the database and
hardware will receive this information and control the devices according to the user.
In the opposite direction, the values received at the hardware will be sent to the database
and then the server will read the values from the database and send it to the website. lOMoARcPSD| 36625228
Figure 3.29. Show license plate and the percentage of occupancy
The server collect data from database and show it in the website. The website show
customer license plate, their entry and exit times, number of cars and spaces remainder in the parking.
In second and third pages show the status of the barrier and lights in the parking. We also
can control these devices if necessary.
Figure 3.30. The status of light and barrier
Chap 4: EXPERIMENT RESULTS lOMoAR cPSD| 36625228
Chapter 5: CONCLUSION AND RECOMMENDATIONS 5.1 Lessons learned
Currently, the number of people riding motorbikes and cars is very large, so the parking
system should be upgraded and developed. There is a lot of congestion, in traditional
parking lots, for many different reasons.
Smart parking system is the optimal solution used to reduce labor costs, increase accuracy
and speed in vehicle entry and exit. Therefore, the design of the parking lot must be suitable
for the parking lot size, operating time, parking capacity and in case of emergency.
Thereby, we know the image processing algorithms, how to control the operation of sensors
and actuators, how to connect between microcontrollers, how to store and transmit data to the web server. 5.2 Future work
In the future, we will complete the graduation model and put the product into a few small-
sized companies for testing. When the quality of the system is good, we will sell the system
model to the companies that have automatic parking upgrade needs. The model will be
upgraded to better automatic control methods for sustainability of the whole system.
5.3 Project improvements Need improvements:
● Improve accuracy when reading license plates and the specific number of vehicles
in the parking lot to increase accuracy when entering and leaving the gate improved
software recognition when encountering abnormal conditions (too hot, too dark, or blocked)
● Improve processing speed between devices such as barriers, lights and website response speed
● Increase security in the system to prevent bad people from taking advantage and stealing information.