0% found this document useful (0 votes)
15 views57 pages

Project Report

The document presents a project report on an AI-powered traffic management system developed by students at Dhirajlal Gandhi College of Technology. It details the integration of computer vision and embedded hardware for intelligent traffic enforcement, utilizing YOLOv8 for object detection and Arduino for real-time processing. The proposed system aims to enhance road safety through automated monitoring of helmet usage and speed limits, offering advantages over existing manual systems.

Uploaded by

Prakasika .K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views57 pages

Project Report

The document presents a project report on an AI-powered traffic management system developed by students at Dhirajlal Gandhi College of Technology. It details the integration of computer vision and embedded hardware for intelligent traffic enforcement, utilizing YOLOv8 for object detection and Arduino for real-time processing. The proposed system aims to enhance road safety through automated monitoring of helmet usage and speed limits, offering advantages over existing manual systems.

Uploaded by

Prakasika .K
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AI-POWERED TRAFFIC

MANAGEMENT SYSTEM

A PROJECT REPORT

Submitted by

MANUSRI.V (610521243024)
MONISHA.C (610521243028)
PRAKASIKA.K (610521243033)
SIVAPRIYA.P (610521243039)

In partial fulfillment for the award of the degree

of

BACHELOR OF TECHNOLOGY

in

ARTIFICIAL INTELLIGENCE AND DATA SCIENCE

DHIRAJLAL GANDHI COLLEGE OF TECHNOLOGY (AUTONOMOUS),


SALEM-636 309

ANNA UNIVERSITY :: CHENNAI-600 025

MAY -2025

1
DHIRAJLAL GANDHI COLLEGE OF TECHNOLOGY
(An Autonomous Institution)
Omalur, Salem - 636 309, Tamil Nadu, INDIA

ANNA UNIVERSITY :: CHENNAI-600 025

BONAFIDE CERTIFICATE

Certified that this project report “AI-POWERED TRAFFIC MANAGEMENT


SYSTEM” is the bonafide work of

MANUSRI.V (610521243024)

MONISHA.C (610521243028)

PRAKASIKA.K (610521243033)

SIVAPRIYA.P (610521243039)

Who carried out the project work under my supervision.

SIGNATURE SIGNATURE

[Link], M.E., [Link], M.E.,


SUPERVISOR HEAD OF THE DEPARTMENT
Assistant Professor Professor
Artificial Intelligence and Data Science Artificial Intelligence and Data Science

Dhirajlal Gandhi College of Technology Dhirajlal Gandhi College of Technology


Salem-636309. Salem-636309.

Submitted for the University Viva-Voce examination held on ............................

INTERNAL EXAMINER EXTERNAL EXAMINER


2
ACKNOWLEDGEMENT

We express heartfelt thanks to the management of the DHIRAJLAL


GANDHI COLLEGE OF TECHNOLOGY for giving as an opportunity of the
completion of this project in this institution. His extemporarily vision has been the
key to our destiny.

We dedicate our sincere thanks to our respected Principal


[Link].,M.E.,Ph.D., for his guidance sustained encouragement for the
successful completion of this project.

We express heartfelt thanks to [Link], M.E., professor and Head


of the Department of Artificial Intelligence and Data Science, for his valuable
suggestion and guidance to the project. His positive approach had offered instant
help in all possible ways from the beginning.

We also extend our sincere thanks to [Link], M.E., [Link],


Department of Artificial Intelligence and Data Science, for his valuable suggestion
and guidance to the project.

We also extend our sincere thanks to our project coordinator and class advisor
[Link],M.E., Asst. professor, Department of Artificial Intelligence and
Data Science, for his encouragement and valuable suggestions throughout the
project. We also extend our thanks to other faculty members and our friends for their
moral support to us in helping us to successfully complete this project.

We pay our profound gratitude to the almighty god for his invisible vigilance
and blessing for the fulfillment of work. We would like thank to our parents for
giving us support and encouragement

3
CONTENT

CHAPTER TITLE PAGE


NO NO

ABSTRACT 6

1. INTRODUCTION 7
1.1 General 7

2. LITERATURE SURVEY 8

2.1 Lightweight YOLOv5 8


2.2 ALPR System 8
2.3 Hybrid YOLO Pipelines 9
2.4 Novel Dataset for Toll Collection 9
2.5 Genetic Algorithm-Enhanced YOLOv5 10

3. EXISTING SYSTEM 11

3.1 Disadvantages 11

4. PROPOSED SYSTEM 12
4.1 Advantages 12

5. SYSTEM REQUIREMENTS 13

5.1 HARDWARE REQUIREMENTS 14


5.1.1 Arduino UNO 14
5.1.2 LCD Display 21
5.1.3 Buzzer 30

4
5.1.4 MOSFET 31
5.1.5 DC Motor 36

5.2 SOFTWARE REQUIREMENTS 41

5.2.1 Python 41
5.2.2 OpenCV 42
5.2.3 YOLOv8 42
5.2.4 Tensorflow/Keras 43
5.2.5 Tkinter 44

5.2.6 Pandas 45
5.2.7 NumPy 46
5.2.8 PySerial 47
5.2.9 Jupyter Notebook 49
5.2.10 Pycharm 50

6. COST ESTIMATION 51

7. ADVANTAGES 54

8. APPLICATIONS 54

9. CONCLUSION 55

10. REFERENCES 56

5
ABSTRACT

This project presents an integrated system combining computer vision and


embedded hardware for intelligent traffic enforcement and automated vehicle speed
regulation. The system is divided into two main stages: software and hardware. On
the software side, an advanced object detection model (YOLOv8) is used to identify
and extract license plate numbers and helmet-wearing status from uploaded images.
Simultaneously, a trained deep learning model identifies road speed signs (20km/h,
50km/h, 100km/h) using real-time webcam input. The extracted license plate data
and detected speed limits are then transmitted to an Arduino Uno via serial
communication.

On the hardware side, the Arduino processes the received data to display the
license plate on a 16x2 LCD. Based on the detected speed limit, the system uses a
MOSFET circuit to control the speed of a DC motor accordingly. Additionally, a
buzzer and LED indicators provide visual and auditory alerts based on helmet
compliance and speed instructions. This intelligent system simulates a real-world
scenario of smart surveillance and automated vehicle response, promoting road
safety and law enforcement through automation. It can be further expanded for real-
time vehicle tracking and traffic rule violation detection in smart city applications.

6
[Link]

Road safety and traffic regulation are critical components in ensuring secure
and organized transportation systems. With the increasing number of vehicles on
the road, enforcing traffic rules such as wearing helmets and adhering to speed
limits has become a major challenge. This project proposes a smart and automated
solution that combines computer vision and embedded systems to address these
concerns efficiently.

The system is designed in two stages: software and hardware. In the software
stage, an image is processed using a YOLOv8-based deep learning model to detect
the presence of a helmet and extract the license plate number of the rider. A
secondary road sign recognition model is used to detect speed limit signs from a live
webcam feed. The extracted data—license plate and speed limit—is then transmitted
to an Arduino Uno for further processing.

In the hardware stage, the Arduino receives and displays the license plate on
an LCD screen. It then adjusts the speed of a DC motor through a MOSFET circuit
based on the detected speed limit. Visual indicators (green/red LEDs) and a buzzer
are used to indicate rule violations. This intelligent setup demonstrates how
automation can improve road safety by combining software detection with real-time
hardware response.

7
2. LITERATURE SURVEY

2.1. Title: Fast Helmet and License Plate Detection Based on Lightweight
YOLOv5

Authors: Chenyang Wei, Zhi Tan, Qiang Qing, Renchao Zeng, Guanghui Wen

Abstract: This study introduces a lightweight YOLOv5-based model tailored for


the rapid detection of electric bike helmets and license plates. By implementing two
key strategies to enhance the original YOLOv5, the model achieves efficient
detection suitable for embedded systems like Unmanned Aerial Vehicles (UAVs).
The proposed approach addresses challenges in deploying sophisticated object
detection algorithms on resource-constrained devices, ensuring both speed and
accuracy in helmet and license plate detection tasks.

Published in: Sensors, 2023

2.2. Title: An Efficient and Layout-Independent Automatic License Plate


Recognition System Based on the YOLO Detector

Authors: Rayson Laroca, Luiz A. Zanlorensi, Gabriel R. Gonçalves, Eduardo Todt,


William Robson Schwartz, David Menotti

Abstract: This paper presents an efficient Automatic License Plate Recognition


(ALPR) system utilizing the YOLO object detector. The system integrates license
plate detection and layout classification to enhance recognition accuracy through
post-processing rules. Trained on diverse datasets with various data augmentation
techniques, the model demonstrates robustness across different conditions.
Achieving an average end-to-end recognition rate of 96.9% across eight public

8
datasets, the system outperforms previous works and commercial systems in several
benchmarks. Additionally, the model operates in real-time, processing multiple
vehicles simultaneously.

Published in: arXiv preprint, 2019

2.3. Title: Optimizing Helmet Detection with Hybrid YOLO Pipelines: A


Detailed Analysis

Authors: Vaikunth M, Dejey D, Vishaal C, Balamurali S

Abstract: This research focuses on enhancing helmet detection using a hybrid


YOLO model (h-YOLO) that combines features from YOLOv8, YOLOv9, and
YOLOv11. The study compares these models in terms of reliability and
computational load, proposing a modified architectural pipeline that significantly
improves overall performance. Evaluations based on recall, precision, and mean
Average Precision (mAP) indicate that h-YOLO outperforms individual YOLO
models, making it preferable for real-time helmet detection applications.

Published in: arXiv preprint, 2024

2.4. Title: Vehicle and License Plate Recognition with Novel Dataset for Toll
Collection

Authors: Muhammad Usama, Hafeez Anwar, Abbas Anwar, Saeed Anwar

Abstract: The paper proposes an automatic framework for toll collection


comprising three steps: vehicle type recognition, license plate localization, and
reading. Addressing challenges posed by image variations due to factors like vehicle
9
decorations and lighting conditions, the framework leverages deep learning
architectures, including YOLOv2, YOLOv3, YOLOv4, and Faster R-CNN. A novel
dataset, Diverse Vehicle and License Plates Dataset (DVLPD), consisting of 10,000
images across six vehicle types, is introduced. The best Mean Average Precision
([email protected]) achieved is 98.8% for vehicle type recognition, 98.5% for license plate
detection, and 98.3% for license plate reading, demonstrating the framework's
efficacy.

Published in: arXiv preprint, 2022

2.5. Title: Real-Time Helmet Violation Detection in AI City Challenge 2023


with Genetic Algorithm-Enhanced YOLOv5

Authors: Elham Soltanikazemi, Ashwin Dhakal, Bijaya Kumar Hatuwal, Imad


Eddine Toubal, Armstrong Aboah, Kannappan Palaniappan

Abstract: This research addresses the challenge of real-time surveillance for


enforcing helmet regulations among motorcyclists. Utilizing the YOLOv5 object
detection model, enhanced with genetic algorithms, the system is trained on the
NVIDIA AI City Challenge 2023 Track 5 dataset. The model achieves precision,
recall, and mAP scores of 0.848, 0.599, and 0.641 respectively on training data, and
a mAP score of 0.6667 on test datasets. These results underscore the model's
potential in enhancing motorcycle safety through real-time helmet violation
detection.

Published in: arXiv preprint, 2023

10
3. EXISTING SYSTEM

The existing system for monitoring road safety primarily relies on manual
enforcement and traditional surveillance cameras. Traffic police or CCTV systems
are used to monitor violations such as not wearing helmets, over-speeding, and
identifying vehicles through license plates. In some advanced systems, ANPR
(Automatic Number Plate Recognition) is used to capture license plates, and radar
sensors detect speed. However, these systems often operate in isolation and are not
integrated with real-time alert mechanisms. Additionally, many existing systems
depend on human intervention for reviewing footage and issuing penalties, which is
time-consuming and inefficient. There is limited automation in detecting helmet
violations and recognizing speed limit signs. Furthermore, these systems lack
integration with microcontrollers like Arduino to trigger on-the-spot alerts or safety
actions, making real-time safety enforcement inadequate.

[Link] of Existing System:

❖ High dependency on manual monitoring and human review.


❖ Lack of real-time alerting or automated responses.
❖ Limited accuracy in detecting helmet violations and speed signs.
❖ Expensive infrastructure and maintenance costs.
❖ Not scalable or portable for rural or remote areas.

11
4. PROPOSED SYSTEM

The proposed system integrates both software and hardware components to


create an intelligent and automated traffic safety monitoring solution. On the
software side, it uses deep learning models such as YOLOv8 for real-time detection
of helmets and license plates from uploaded images, and a CNN-based model for
identifying speed limit signs via a live webcam. The detected license plate number
and helmet status are sent to the Arduino Uno through serial communication. On the
hardware side, the Arduino receives this data and displays the license plate number
on an LCD. Depending on the speed limit detected, a MOSFET-controlled DC motor
adjusts its speed to simulate vehicle movement, while a buzzer and LED indicators
alert for violations. This system ensures real-time feedback and enforces traffic rules
more efficiently, making it ideal for smart cities and automated road safety
applications.

[Link] of the Proposed System:

❖ Real-time detection and response with minimal human intervention.


❖ Accurate identification of license plates, helmet usage, and speed limits.
❖ Immediate hardware actions (alerts and motor control) based on software
input.
❖ Cost-effective and scalable using Arduino and basic components.
❖ Portable and adaptable for various urban and rural settings.

12
5. SYSTEM REQUIREMENTS

[Link] REQUIREMENTS:

❖ ARDUINO UNO
❖ LCD DISPLAY
❖ MOSFET
❖ DC MOTOR
❖ BUZZER

[Link] REQUIREMENTS:

❖ Python (Programming Language)


❖ OpenCV (for image and video processing)
❖ YOLOv8 (for helmet and license plate detection)
❖ TensorFlow / Keras (for road sign classification model)
❖ Tkinter (for GUI interface)
❖ Pandas (for handling license plate database)
❖ NumPy (for numerical operations)
❖ PySerial (for communication with Arduino)
❖ Pillow (PIL) (for image display in Tkinter GUI)
❖ Jupyter Notebook / PyCharm (Python IDEs used during development)
❖ CSV file (for storing license plate database)

13
5.1. HARDWARE REQUIREMENT:

5.1.1. ARDUINO UNO:

Arduino/Genuino 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. It contains everything needed to support the microcontroller;
simply connect it to a computer with a USB cable or power it with a AC-to-DC
adapter or battery to get started.. You can tinker with your UNO without worrying
too much about doing something wrong, worst case scenario you can replace the
chip for a few dollars and start over again.

"Uno" means one in Italian and was chosen to mark the release of Arduino
Software (IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were
the reference versions of Arduino, now evolved to newer releases. The Uno board is
the first in a series of USB Arduino boards, and the reference model for the Arduino
platform; for an extensive list of current, past or outdated boards see the Arduino
index of boards.

14
You can find here your board warranty informations.

Getting Started
You can find in the Getting Started section all the information you need to configure
your board, use the Arduino Software (IDE), and start tinker with coding and
electronics.

Need Help?

• On the Software on the Arduino Forum


• On Projects on the Arduino Forum
• On the Product itself through our Customer Support

Technical specs:

Microcontroller ATmega328P
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limit) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
PWM Digital I/O Pins 6
Analog Input Pins 6
DC Current per I/O Pin 20 mA
DC Current for 3.3V Pin 50 mA
32 KB (ATmega328P)
Flash Memory
of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328P)

15
EEPROM 1 KB (ATmega328P)
Clock Speed 16 MHz
Length 68.6 mm
Width 53.4 mm
Weight 25 g

Power:
The Arduino/Genuino Uno board can be powered via the USB connection or
with an external power supply. The power source is selected automatically.

16
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 from 6 to 20 volts. If supplied


with less than 7V, however, the 5V pin may supply less than five volts and the board
may become unstable. If using more than 12V, the voltage regulator may overheat
and damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

• Vin. The input voltage to the Arduino/Genuino board when it's using an external
power source (as opposed to 5 volts 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.
• [Link] pin outputs a regulated 5V from the regulator on the board. The board can
be supplied with power either from the DC power jack (7 - 12V), the USB connector
(5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V
pins bypasses the regulator, and can damage your board. We don't advise it.
• 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw
is 50 mA.
• GND. Ground pins.
• IOREF. This pin on the Arduino/Genuino board provides the voltage reference with
which the microcontroller operates. A properly configured shield can read the
IOREF pin voltage and select the appropriate power source or enable voltage
translators on the outputs to work with the 5V or 3.3V.

17
Memory:
The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader). It also
has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with
the EEPROM library).

Input and Output:


See the mapping between Arduino pins and ATmega328P ports. The mapping
for the Atmega8, 168, and 328 is identical.

Each of the 14 digital pins on the Uno can be used as an input or output,
using pinMode(),digitalWrite(), and digitalRead() functions. They operate at 5 volts.
Each pin can provide or receive 20 mA as recommended operating condition and
has an internal pull-up resistor (disconnected by default) of 20-50k ohm. A
maximum of 40mA is the value that must not be exceeded on any I/O pin to avoid
permanent damage to the microcontroller.

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. See the attachInterrupt()
function for details.
• 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 using the SPI library.

18
• LED: 13. There is a built-in LED driven by digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.
• TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the
Wire library.

The Uno has 6 analog inputs, labeled A0 through A5, each of which provide
10 bits of resolution (i.e. 1024 different values). By default they measure from
ground to 5 volts, though is it possible to change the upper end of their range using
the AREF pin and the analogReference() function.

There are a couple of other pins on the board:

• AREF. Reference voltage for the analog inputs. Used with analogReference().
• 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.

Communication:
Arduino/Genuino Uno has a number of facilities for communicating with a
computer, another Arduino/Genuino board, or other microcontrollers. The
ATmega328 provides UART TTL (5V) serial communication, which is available on
digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the board channels this serial
communication over USB and appears as a virtual com port to software on the
computer. The 16U2 firmware uses the standard USB COM drivers, and no external
driver is needed. However, on Windows, a .inf file is required. The Arduino
Software (IDE) includes a serial monitor which allows simple textual data to be sent
to and from the 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).

19
A SoftwareSerial library allows serial communication on any of the Uno's digital
pins.

The ATmega328 also supports I2C (TWI) and SPI communication. The
Arduino Software (IDE) includes a Wire library to simplify use of the I2C bus; see
the documentation for details. For SPI communication, use the SPI library.

Automatic (Software) Reset:


Rather than requiring a physical press of the reset button before an upload, the
Arduino/Genuino Uno board 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/16U2 is connected to the reset line of the ATmega328
via a 100 nanofarad capacitor. When this line is asserted (taken low), the reset line
drops long enough to reset the chip. The Arduino Software (IDE) uses this capability
to allow you to upload code by simply pressing the upload button in the interface
toolbar. This means that the bootloader 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 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 bootloader is
running on the 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.

20
The Uno board 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 a 110
ohm resistor from 5V to the reset line; see this forum thread for details.

Revisions:
Revision 3 of the board has the following new features:
1.0 pinout: added SDA and SCL pins that are near to the AREF pin and two other
new pins placed near to the RESET pin, the IOREF that allow the shields to adapt
to the voltage provided from the board. In future, shields will be compatible with
both the board that uses the AVR, which operates with 5V and with the Arduino Due
that operates with 3.3V. The second one is a not connected pin, that is reserved for
future purposes.

• Stronger RESET circuit.


• Atmega 16U2 replace the 8U2.

5.1.2. LCD DISPLAY:

INTRODUCTION:
Liquid crystal displays (LCDs) have materials which combine the properties
of both liquids and crystals. Rather than having a melting point, they have a
temperature range within which the molecules are almost as mobile as they would
be in a liquid, but are grouped together in an ordered form similar to a crystal.

An LCD consists of two glass panels, with the liquid crystal material sand
witched in between them. The inner surface of the glass plates are coated with
transparent electrodes which define the character, symbols or patterns to be
displayed polymeric layers are present in between the electrodes and the liquid

21
crystal, which makes the liquid crystal molecules to maintain a defined orientation
angle.

One each polarisers are pasted outside the two glass panels. These polarisers
would rotate the light rays passing through them to a definite angle, in a particular
direction

When the LCD is in the off state, light rays are rotated by the two polarisers
and the liquid crystal, such that the light rays come out of the LCD without any
orientation, and hence the LCD appears transparent. When sufficient voltage is
applied to the electrodes, the liquid crystal molecules would be aligned in a specific
direction. The light rays passing through the LCD would be rotated by the polarisers,
which would result in activating / highlighting the desired characters.

The LCD’s are lightweight with only a few millimeters thickness. Since the
LCD’s consume less power, they are compatible with low power electronic circuits,
and can be powered for long durations. The LCD’s don’t generate light and so light
is needed to read the display. By using backlighting, reading is possible in the dark.
The LCD’s have long life and a wide operating temperature range. Changing the
display size or the layout size is relatively simple which makes the LCD’s more
customer friendly. The LCDs used exclusively in watches, calculators and
measuring instruments are the simple seven-segment displays, having a limited
amount of numeric data. The recent advances in technology have resulted in better
legibility, more information displaying capability and a wider temperature range.
These have resulted in the LCDs being extensively used in telecommunications and
entertainment electronics. The LCDs have even started replacing the cathode ray
tubes (CRTs) used for the display of text and graphics, and also in small TV
applications.

22
POWERSUPPLY:
The power supply should be of +5V, with maximum allowable transients of
10mv. To achieve a better / suitable contrast for the display, the voltage (VL) at pin
3 should be adjusted properly.

A module should not be inserted or removed from a live circuit. The ground
terminal of the power supply must be isolated properly so that no voltage is induced
in it. The module should be isolated from the other circuits, so that stray voltages are
not induced, which could cause a flickering display.

HARDWARE:

Develop a uniquely decoded ‘E’ strobe pulse, active high, to accompany each
module transaction. Address or control lines can be assigned to drive the RS and
R/W inputs.

Utilize the Host’s extended timing mode, if available, when transacting with
the module. Use instructions, which prolong the Read and Write or other appropriate
data strobes, so as to realize the interface timing requirements.

If a parallel port is used to drive the RS, R/W and ‘E’ control lines, setting the
‘E’ bit simultaneously with RS and R/W would violate the module’s set up time. A
separate instruction should be used to achieve proper interfacing timing
requirements.

MOUNTING:

Cover the display surface with a transparent protective plate, to protect the
[Link]’t touch the display surface with bare hands or any hard materials. This
will stain the display area and degrade the insulation between terminals. Do not use
organic solvents to clean the display panel as these may advesely affect tape or with

23
absorbant cotton and petroleum benzene. The processing or even a slight
deformation of the claws of the metal frame will have effect on the connection of
the output signal and cause an abnormal display. Do not damage or modify the
pattern wiring, or drill attachment holes in the PCB. When assembling the module
into another equipment, the space between the module and the fitting plate should
have enough height, to avoid causing stress to the module surface. Make sure that
there is enough space behind the module, to dissipate the heat generated by the ICs
while functioning for longer durations.

When an electrically powered screwdriver is used to install the module,


ground it properly. While cleaning by a vacuum cleaner, do not bring the sucking
mouth near the module. Static electricity of the electrically powered driver or the
vacuum cleaner may destroy the module.

ENVIRONMENTAL PRECAUTIONS:

Operate the LCD module under the relative condition of 40C and 50%
relative humidity. Lower temperature can cause retardation of the blinking speed of
the display, while higher temperature makes the overall display discolor. When the
temperature gets to be within the normal limits, the display will be normal.
Polarization degradation, bubble generation or polarizer peel-off may occur with
high temperature and humidity. Contact with water or oil over a long period of time
may cause deformation or colour fading of the display. Condensation on the
terminals can cause electro-chemical reaction disrupting the terminal circuit.

24
TROUBLE SHOOTING:

INTRODUCTION:

When the power supply is given to the module, with the pin 3 (VL) connected
to ground, all the pixels of a character gets activated in the following manner:
All the characters of a single line display, as in CDM 16108. The first eight
characters of a single line display, operated in the two-line display mode, as in CDM
16116.

The first line of characters of a two-line display as in CDM 16216 and 40216.
The first and third line of characters of a four-line display operated in the two-line
display mode, as in CDM 20416. If the above mentioned does not occur, the
module should be initialized by software. Make sure that the control signals ‘E’ ,
R/W and RS are according to the interface timing requirements.

IMPROPER CHARACTER DISPLAY:

When the characters to be displayed are missing between, the data read/write
is too fast. A slower interfacing frequency would rectify the problem. When
uncertainty is there in the start of the first characters other than the specified ones
are rewritten, check the initialization and the software routine. In a multi-line
display, if the display of characters in the subsequent lines does’nt take place
properly, check the DD RAM addresses set for the corresponding display lines.

When it is unable to display data, even though it is present in the DD RAM,


either the display on/off flag is in the off state or the display shift function is not set
properly. When the display shift is done simultaneous with the data writa operation,
the data may not be visible on the display. If a character not found in the font table
is displayed, or a character is missing, the CG ROM is faulty and the controller IC

25
have to be changedIf particular pixels of the characters are missing, or not getting
activated properly, there could be an assembling problem in the module. In case any
other problems are encountered you could send the module to our factory for testing
and evaluation.

CRYSTALONICS DISPLAY:
INTRODUCTION:

Crystalonics dot –matrix (alphanumeric) liquid crystal displays are available


in TN, STN types, with or without backlight. The use of C-MOS LCD controller and
driver ICs result in low power consumption. These modules can be interfaced with
a 4-bit or 8-bit micro processor /Micro controller.

The built-in controller IC has the following features:

➢ Correspond to high speed MPU interface (2MHz)


➢ 80 x 8 bit display RAM (80 Characters max)
➢ 9,920 bit character generator ROM for a total of 240 character fonts. 208
character fonts (5 x 8 dots) 32 character fonts (5 x 10 dots)
➢ 64 x 8 bit character generator RAM 8 character generator RAM 8 character
fonts (5 x 8 dots) 4 characters fonts (5 x 10 dots)
➢ Programmable duty cycles
1/8 – for one line of 5 x 8 dots with cursor

1/11 – for one line of 5 x 10 dots with cursor

1/16 – for one line of 5 x 8 dots with cursor

➢ Wide range of instruction functions display clear, cursor home, display on/off,
cursor on/off, display character blink, cursor shift, display shift.

26
➢ Automatic reset circuit, that initializes the controller / driver ICs after power on.
BUSY FLAG:

When the busy flag is1, the controller is in the internal operation mode, and
the next instruction will not be accepted.

When RS = 0 and R/W = 1, the busy flag is output to DB7.

The next instruction must be written after ensuring that the busy flag is 0.

ADDRESS COUNTER:

The address counter allocates the address for the DD RAM and CG RAM
read/write operation when the instruction code for DD RAM address or CG RAM
address setting, is input to IR, the address code is transferred from IR to the address
counter. After writing/reading the display data to/from the DD RAM or CG RAM,
the address counter increments/decrements by one the address, as an internal
operation. The data of the address counter is output to DB0 to DB6 while R/W = 1
and RS = 0.

DISPLAY DATA RAM (DD RAM)

The characters to be displayed are written into the display data RAM (DD
RAM), in the form of 8 bit character codes present in the character font table. The
extended capacity of the DD RAM is 80 x 8 bits i.e. 80 characters.

CHARATCER GENERATOR ROM (CG ROM)

The character generator ROM generates 5 x 8 dot 5 x 10 dot character patterns


from 8 bit character codes. It generates 208, 5 x 8 dot character patterns and 32, 5 x
10 dot character patterns.

27
CHARACTER GENERATOR RAM (CG RAM)

In the character generator RAM, the user can rewrite character patterns by
program. For 5 x 8 dots, eight character patterns can be written, and for 5 x 10 dots,
four character patterns can be written.

INTERFACING THE MICROPROCESSOR CONTROLLER:

The module, interfaced to the system, can be treated as RAM input/output,


expanded or parallel I/[Link] there is no conventional chip select signal,
developing a strobe signal for the enable signal (E) and applying appropriate signals
to the register select (RS) and read/write (R/W) signals are [Link] module is
selected by gating a decoded module – address with the host – processor’s read/write
strobe. The resultant signal, applied to the LCDs enable (E) input, clocks in the
[Link] ‘E’ signal must be a positive going digital strobe, which is active while data
and control information are stable and true. The falling edge of the enable signal
enables the data / instruction register of the controller. All module timings are
referenced to specific edges of the ‘E’ signal. The ‘E’ signal is applied only when a
specific module transaction is [Link] read and write strobes of the host, which
provides the ‘E’ signals, should not be linked to the module’s R/W line. An address
bit which sets up earlier in the host’s machine cycle can be used as R/[Link] the
host processor is so fast that the strobes are too narrow to serve as the ‘E’ pulse

a. Prolong these pulses by using the hosts ‘Ready’ input


b. Prolong the host by adding wait states
c. Decrease the Hosts Crystal frequency.
Inspite of doing the above mentioned, if the problem continues, latch both the data
and control information and then activate the ‘E’ signal

28
When the controller is performing an internal operation he busy flag (BF) will
set and will not accept any instruction. The user should check the busy flag or should
provide a delay of approximately 2ms after each [Link] module presents
no difficulties while interfacing slower [Link] liquid crystal display module can
be interfaced, either to 4-bit or 8-bit MPUs.

For 4-bit data interface, the bus lines DB4 to DB7 are used for data transfer,
while DB0 to DB3 lines are disabled. The data transfer is complete when the 4-bit
data has been transferred twice.

The busy flag must be checked after the 4-bit data has been transferred twice.
Two more 4-bit operations then transfer the busy flag and address counter [Link]
8-bit data interface, all eight-bus lines (DB0 to DB7) are used.

A liquid crystal display (LCD) is a thin, flat electronic visual display that uses the
light modulating properties of liquid crystals (LCs). LCs do not emit light directly.

They are used in a wide range of applications including: computer monitors,


television, instrument panels, aircraft cockpit displays, signage, etc. They are
common in consumer devices such as video players, gaming devices, clocks,
29
watches, calculators, and telephones. LCDs have displaced cathode ray tube(CRT)
displays in most applications. They are usually more compact, lightweight, portable,
less expensive, more reliable, and easier on the eyes. They are available in a wider
range of screen sizes than CRT and plasma displays, and since they do not use
phosphors, they cannot suffer image [Link] are more energy efficient and
offer safer disposal than CRTs. Its low electrical power consumption enables it to be
used in battery-powered electronic equipment. It is an electronically-modulated
optical device made up of any number of pixels filled with liquid crystals and arrayed
in front of a light source (backlight) or reflector to produce images in colour or
monochrome. The earliest discovery leading to the development of LCD technology,
the discovery of liquid crystals, dates from 1888. By 2008, worldwide sales of
televisions with LCD screens had surpassed the sale of CRT units

ALARM:

An alarm gives an audible or visual warning about a problem or condition.

5.1.3. BUZZER:

A buzzer or beeper is a signalling device, usually electronic, typically used


in automobiles, household appliances such as a microwave oven, or game shows. It
most commonly consists of a number of switches or sensors connected to a control
unit that determines if and which button was pushed or a preset time has lapsed, and
usually illuminates a light on the appropriate button or control panel, and sounds a
warning in the form of a continuous or intermittent buzzing or beeping sound.
Initially this device was based on an electromechanical system which was identical
to an electric bell without the metal gong (which makes the ringing noise).

30
Often these units were anchored to a wall or ceiling and used the ceiling or
wall as a sounding board. Another implementation with some AC-connected devices
was to implement a circuit to make the AC current into a noise loud enough to drive
a loudspeaker and hook this circuit up to a cheap 8-ohm speaker. Nowadays, it is
more popular to use a ceramic-based piezoelectric sounder like a Sonalert which
makes a high-pitched tone. Usually these were hooked up to "driver" circuits which
varied the pitch of the sound or pulsed the sound on and off.

5.1.4. MOSFET:

MOSFET operation:

A traditional metal–oxide–semiconductor (MOS) structure is obtained by


depositing a layer of silicon dioxide (SiO2) and a layer of metal (polycrystalline
silicon is commonly used instead of metal) on top of a semiconductor die. As the
silicon dioxide is a dielectric material its structure is equivalent to a planar capacitor,
with one of the electrodes replaced by a semiconductor.

When a voltage is applied across a MOS structure, it modifies the distribution


of charges in the semiconductor. If we consider a P-type semiconductor (with NA the
density of acceptors, p the density of holes; p = NA in neutral bulk), a positive
voltage, VGB, from gate to body (see figure) creates a depletion layer by forcing the

31
positively charged holes away from the gate-insulator/semiconductor interface,
leaving exposed a carrier-free region of immobile, negatively charged acceptor ions.
See doping (semiconductor). If VGB is high enough, a high concentration of negative
charge carriers forms in an inversion layer located in a thin layer next to the interface
between the semiconductor and the insulator. (Unlike the MOSFET, discussed
below, where the inversion layer electrons are supplied rapidly from the source/drain
electrodes, in the MOS capacitor they are produced much more slowly by thermal
generation through carrier generation and recombination centers in the depletion
region.) Conventionally, the gate voltage at which the volume density of electrons
in the inversion layer is the same as the volume density of holes in the body is called
the threshold voltage.

This structure with P-type body is the basis of the N-type MOSFET, which
requires the addition of an N-type source and drain regions.

1.1.1 MOSFET structure and channel formation

32
Cross section of an NMOS without channel formed: OFF state

Cross section of an NMOS with channel formed: ON state

A metal–oxide–semiconductor field-effect transistor (MOSFET) is based on


the modulation of charge concentration by a MOS capacitance between a body
electrode and a gate electrode located above the body and insulated from all other
device regions by an oxide. The MOSFET includes two additional terminals (source
and drain), each connected to individual highly doped regions that are separated by
the body region. These regions can be either p or n type, but they must both be of
the same type, and of opposite type to the body region. The highly doped source and
drain regions typically are denoted by a '+' following the type of doping. The body
is not highly doped, as denoted by the lack of a '+' sign.

If the MOSFET is an n-channel or n-MOSFET, then the source and drain are
'n+' regions and the body is a 'p' region. As described above, with sufficient gate
voltage, above a threshold voltage value, electrons from the source (and possibly
also the drain) enter the inversion layer or n-channel at the interface between the p
region and the oxide. This conducting channel extends between the source and the
drain, and current is conducted through it when a voltage is applied between source
and drain.

33
For gate voltages below the threshold value, the channel is lightly populated,
and only a very small subthreshold leakage current can flow between the source and
the drain.

If the MOSFET is a p-channel or p-MOSFET, then the source and drain are
'p+' regions and the body is a 'n' region. When a negative gate-source voltage
(positive source-gate) is applied, it creates a p-channel at the surface of the n region,
analogous to the n-channel case, but with opposite polarities of charges and voltages.
When a voltage less negative than the threshold value (a negative voltage for p-
Channel) is applied between gate and source, the channel disappears and only a very
small subthreshold current can flow between the source and the drain.

The source is so named because it is the source of the charge carriers


(electrons for n-channel, holes for p-channel) that flow through the channel;
similarly, the drain is where the charge carriers leave the channel.

1.1.2 Modes of operation:

The operation of a MOSFET can be separated into three different modes,


depending on the voltages at the terminals. In the following discussion, a simplified
algebraic model is used that is accurate only for old technology. Modern MOSFET
characteristics require computer models that have rather more complex behavior.
For example, see Liu [3] and the device modeling list. For an enhancement-mode, n-
channel MOSFET the three operational modes are:Cut-off or Sub-threshold or Weak
Inversion Mode

When V GS < Vth:

where Vth is the threshold voltage of the device.

34
According to the basic threshold model, the transistor is turned off, and there
is no conduction between drain and source. In reality, the Boltzmann distribution of
electron energies allows some of the more energetic electrons at the source to enter
the channel and flow to the drain, resulting in a subthreshold current that is an
exponential function of gate–source voltage. While the current between drain and
source should ideally be zero when the transistor is being used as a turned-off switch,
there is a weak-inversion current, sometimes called subthreshold leakage.

In weak inversion the current varies exponentially with gate-to-source bias


VGS as given approximately by:

where ID0 = current at VGS = Vth and the slope factor n is given by

n = 1 + CD / COX,

with CD = capacitance of the depletion layer and COX = capacitance of the oxide
layer. In a long-channel device, there is no drain voltage dependence of the current
once VDS > > VT, but as channel length is reduced drain-induced barrier lowering
introduces drain voltage dependence that depends in a complex way upon the device
geometry (for example, the channel doping, the junction doping and so on).
Frequently threshold voltage Vth for this mode is defined as the gate voltage at which
a selected value of current ID0 occurs, for example, ID0 = 1 μA, which may not be the
same Vth-value used in the equations for the following modes.

35
5.1.5. DC MOTOR:

PRINCIPLES OF OPERATION:

In any electric motor, operation is based on simple electromagnetism. A


current-carrying conductor generates a magnetic field; when this is then placed in an
external magnetic field, it will experience a force proportional to the current in the
conductor, and to the strength of the external magnetic field. As you are well aware
of from playing with magnets as a kid, opposite (North and South) polarities attract,
while like polarities (North and North, South and South) repel. The internal
configuration of a DC motor is designed to harness the magnetic interaction between
a current-carrying conductor and an external magnetic field to generate rotational
motion.

Let's start by looking at a simple 2-pole DC electric motor (here red represents
a magnet or winding with a "North" polarization, while green represents a magnet
or winding with a "South" polarization).

36
Every DC motor has six basic parts -- axle, rotor (armature), stator,
commutator, field magnet(s), and brushes. In most common DC motors, the external
magnetic field is produced by high-strength permanent magnets. The stator is the
stationary part of the motor -- this includes the motor casing, as well as two or more
permanent magnet pole pieces. The rotor (together with the axle and attached
commutator) rotate with respect to the stator. The rotor consists of windings
(generally on a core), the windings being electrically connected to the commutator.
The above diagram shows a common motor layout -- with the rotor inside the stator
(field) magnets.

The geometry of the brushes, commutator contacts, and rotor windings are
such that when power is applied, the polarities of the energized winding and the
stator magnet(s) are misaligned, and the rotor will rotate until it is almost aligned
with the stator's field magnets. As the rotor reaches alignment, the brushes move to
the next commutator contacts, and energize the next winding. Given our example
two-pole motor, the rotation reverses the direction of current through the rotor
winding, leading to a "flip" of the rotor's magnetic field, driving it to continue
rotating.

37
In real life, though, DC motors will always have more than two poles (three
is a very common number). In particular, this avoids "dead spots" in the commutator.
You can imagine how with our example two-pole motor, if the rotor is exactly at the
middle of its rotation (perfectly aligned with the field magnets), it will get "stuck"
there. Meanwhile, with a two-pole motor, there is a moment where the commutator
shorts out the power supply. This would be bad for the power supply, waste energy,
and damage motor components as well. Yet another disadvantage of such a simple
motor is that it would exhibit a high amount of torque "ripple" (the amount of torque
it could produce is cyclic with the position of the rotor).

So since most small DC motors are of a three-pole design, let's tinker with the
workings of one via an interactive animation (JavaScript required):

38
A few things from this -- namely, one pole is fully energized at a time (but
two others are "partially" energized). As each brush transitions from one commutator
contact to the next, one coil's field will rapidly collapse, as the next coil's field will
rapidly charge up (this occurs within a few microsecond). We'll see more about the
effects of this later, but in the meantime you can see that this is a direct result of the
coil windings' series wiring:

There's probably no better way to see how an average DC motor is put


together, than by just opening one up. Unfortunately this is tedious work, as well as
requiring the destruction of a perfectly good motor.

The guts of a disassembled Mabuchi FF-030-PN motor (the same model that
Solarbotics sells) are available for (on 10 lines / cm graph paper). This is a basic 3-
pole DC motor, with 2 brushes and three commutator contacts.

The use of an iron core armature (as in the Mabuchi, above) is quite common,
and has a number of advantages. First off, the iron core provides a strong, rigid
support for the windings -- a particularly important consideration for high-torque
motors. The core also conducts heat away from the rotor windings, allowing the

39
motor to be driven harder than might otherwise be the case. Iron core construction
is also relatively inexpensive compared with other construction types.

But iron core construction also has several disadvantages. The iron armature
has a relatively high inertia which limits motor acceleration. This construction also
results in high winding inductances which limit brush and commutator life.

In small motors, an alternative design is often used which features a 'coreless'


armature winding. This design depends upon the coil wire itself for structural
integrity. As a result, the armature is hollow, and the permanent magnet can be
mounted inside the rotor coil. Coreless DC motors have much lower armature
inductance than iron-core motors of comparable size, extending brush and
commutator life.

The coreless design also allows manufacturers to build smaller motors;


meanwhile, due to the lack of iron in their rotors, coreless motors are somewhat
prone to overheating. As a result, this design is generally used just in small, low-
power motors. Beamers will most often see coreless DC motors in the form of pager
motors.

Again, disassembling a coreless motor can be instructive -- in this case, my


hapless victim was a cheap pager vibrator motor. The guts of this disassembled

40
motor are available (on 10 lines / cm graph paper). This is (or more accurately, was)
a 3-pole coreless DC motor.

RATING:

Voltage: 12V

Rpm:1500

Current:4A

5.2. SOFTWARE REQUIREMENTS:

5.2.1. Python (Programming Language):

Python is a powerful, high-level programming language widely used for


artificial intelligence, data science, machine learning, computer vision, and
automation. One of the key reasons Python was chosen for this project is its
simplicity and readability, which allows developers to focus more on problem-
solving rather than syntax.

In this project, Python acts as the backbone of the entire system. It is used to
integrate various components such as the YOLOv8 model, TensorFlow-based road
sign classifier, image processing with OpenCV, GUI development using Tkinter,
and communication with the Arduino using PySerial. Python's extensive libraries
and frameworks support seamless development and testing.

Moreover, Python offers cross-platform compatibility, which makes it easy to


run the software on different operating systems like Windows, macOS, or Linux. Its
dynamic typing, automatic memory management, and support for multiple
paradigms (procedural, object-oriented, and functional programming) contribute to
its wide adoption in AI-based systems like this one.

41
5.2.2. OpenCV (for Image and Video Processing):

OpenCV (Open Source Computer Vision Library) is an open-source computer


vision and machine learning library. It contains more than 2500 optimized
algorithms, which can be used for a wide range of tasks such as object detection,
face recognition, tracking, motion analysis, and more.

Reading image and video data from files or the webcam.

❖ Converting image color formats (e.g., BGR to RGB for display or processing).
❖ Drawing bounding boxes and labels around detected objects.
❖ Resizing and normalizing frames before feeding them into the deep learning
model.
❖ Displaying the video feed to visualize road sign detection in real-time.

OpenCV acts as the bridge between raw visual data and the trained machine
learning models. It helps preprocess input images to the required format and also
post-processes the output to make it understandable and usable for the end-user.

Its high-speed performance and compatibility with NumPy (used for matrix
operations) make it ideal for real-time video applications, which is critical in this
project for road sign detection.

5.2.3. YOLOv8 (for Helmet and License Plate Detection):

YOLO (You Only Look Once) is a state-of-the-art, real-time object detection


algorithm known for its speed and accuracy. YOLOv8 is one of the latest versions
in the YOLO series developed by Ultralytics. It provides improved performance,
faster training times, and better accuracy compared to earlier versions like YOLOv5.

42
In this project, YOLOv8 is used to detect:

❖ Riders wearing helmets


❖ Riders without helmets
❖ Number plates (license plates)

A custom-trained YOLOv8 model ([Link]) is used, which has been trained on a


dataset containing labeled images of these three classes. The model outputs
bounding boxes around detected objects, along with class labels and confidence
scores.

❖ The YOLOv8 model enables the system to perform:


❖ Detection of helmet compliance for safety monitoring
❖ Identification of vehicles via number plate detection
❖ Sending real-time data to the Arduino for display and action

Due to its lightweight architecture, YOLOv8 can run on systems with low
computational resources, which is perfect for real-time embedded applications like
this.

5.2.4. TensorFlow / Keras (for Road Sign Classification Model):

TensorFlow is a leading open-source platform for machine learning and deep


learning developed by Google. Keras is a high-level API that runs on top of
TensorFlow, making it easier to build and train neural networks.

In this project, TensorFlow and Keras are used to develop a Convolutional


Neural Network (CNN) that can classify speed limit road signs. The model is trained
on a dataset consisting of various speed signs such as 20km/h, 50km/h, and 100km/h.

43
The steps performed using TensorFlow/Keras include:

❖ Designing theCNN architecture (convolutional layers, pooling layers, dense


layers)
❖ Training the model on labeled images of road signs
❖ Evaluating and saving the model (road_sign_detection_model.h5)
❖ Loading and using the model for real-time predictions

During execution, frames from the webcam are resized and preprocessed before
being passed to the CNN model. The output (predicted class and confidence) is then
checked, and if the confidence is above a threshold, the corresponding speed limit is
sent to the Arduino.

This module ensures that speed limits are dynamically detected and enforced,
enhancing traffic rule compliance through automation.

5.2.5. Tkinter (for GUI Interface):

Tkinter is Python’s standard GUI (Graphical User Interface) library. It


provides tools to create windows, buttons, labels, images, and other interactive
components.

In this project, Tkinter is used to create a simple and user-friendly interface for:

❖ Uploading an image to detect helmets and license plates


❖ Displaying the uploaded image with bounding boxes and labels
❖ Showing the extracted license plate number
❖ Initiating the real-time road sign detection via webcam
❖ The interface includes:
❖ A button to upload images
❖ A display area for showing processed images

44
Tkinter enables rapid development of the front-end without the need for web
frameworks or external GUI libraries. It allows seamless interaction between the
user and the underlying machine learning models, making the system more
accessible and interactive for demonstrations or testing.

[Link] (for Handling License Plate Database):

Pandas is a powerful open-source data analysis and manipulation library for


Python. It provides data structures like Series and DataFrame that are essential for
handling structured data.

In this project, Pandas is used to:

❖ Read a CSV file (license_plates.csv) containing mappings of image filenames


to license plate numbers
❖ Search for the license plate corresponding to the uploaded image
❖ Retrieve and display the plate number for further processing

The license plate information is essential for tracking vehicles and displaying the
correct identity on the LCD through Arduino. Pandas makes it extremely easy to
filter, match, and extract values from a dataset based on conditions.

Using Pandas eliminates the need for complex SQL queries or database
management systems in this small-scale project, while still offering powerful data-
handling capabilities.

Conclusion:

Together, these six software components form a robust, intelligent, and


interactive system for real-time traffic rule enforcement and monitoring. Python
serves as the central platform integrating machine learning (YOLOv8,

45
TensorFlow/Keras), image processing (OpenCV), GUI development (Tkinter), data
management (Pandas), and hardware interfacing (via PySerial). The system not only
demonstrates real-world applicability but also highlights how different software
tools can collaborate to deliver an innovative and effective smart transportation
solution.

[Link] (for Numerical Operations):

NumPy, short for Numerical Python, is one of the most fundamental and
widely used libraries in the Python ecosystem, especially in the domains of scientific
computing, data analysis, machine learning, and computer vision.

In this project, NumPy plays a crucial role in handling numerical data


involved in image processing, model predictions, and data transformations. When
using libraries like OpenCV or TensorFlow, image data is often converted to or
manipulated as NumPy arrays. These arrays allow for fast, vectorized operations,
which are essential for real-time performance.

Key Use Cases in the Project:

Image Data Handling: Every image read using OpenCV is stored as a NumPy
array. NumPy allows easy slicing, reshaping, and transformation of this data.

Model Input Preparation: When passing image frames to machine learning models
(like YOLOv8 or TensorFlow CNN), NumPy is used to normalize pixel values,
resize matrices, and prepare the data in the correct shape.

Mathematical Computation: In operations like bounding box calculations,


confidence thresholds, or coordinate transformations, NumPy's functions (like
[Link], [Link], or [Link]) are commonly used.

46
Its speed and seamless integration with other scientific libraries (like
OpenCV, Pandas, TensorFlow, etc.) make it an essential part of your system,
enabling it to operate efficiently in real-time environments.

5.2.8. PySerial (for Communication with Arduino):

PySerial is a Python library that enables communication with hardware


devices over the serial port. It acts as a bridge between Python-based systems and
microcontroller platforms like Arduino.

In your project, PySerial is used for sending data from the computer (running
the machine learning models and GUI) to the Arduino, which displays information
on an LCD or triggers physical alerts.

Use Cases in the Project:

Sending Helmet Detection Status: After detecting whether a rider is wearing


a helmet, the system sends status values (like "Helmet" or "No Helmet") to the
Arduino.

License Plate Transmission: The detected license plate number from an uploaded
image is sent via serial to be displayed on the Arduino-connected LCD.

Speed Sign Detection Results: When the TensorFlow CNN model identifies a road
sign (like "Speed Limit 50 km/h"), the detected value is transmitted to the Arduino.

Typical Code Usage:

import serial

arduino = [Link]('COM3', 9600)

[Link](b'NoHelmet\n')

47
The ease of integration with Arduino and the simplicity of syntax make
PySerial a perfect choice for hardware-software communication, helping you build
interactive smart transportation systems.

Pillow (PIL) (for Image Display in Tkinter GUI):

Pillow is the modern fork of the original PIL (Python Imaging Library). It
allows Python developers to manipulate and display images with ease, especially
within GUI environments like Tkinter.

In this project, Pillow is primarily used to display images within the GUI
window built using Tkinter. While OpenCV handles real-time image processing,
Pillow provides better integration with Tkinter for GUI display purposes.

Use Cases in the Project:

Display Uploaded Images: When a user uploads an image to detect helmets or


license plates, Pillow is used to convert and show the image on the GUI canvas.

Render Processed Results: Once the detection is complete, Pillow helps display
the same image with bounding boxes drawn, showing results like detected helmets
and license plates.

Typical Workflow:

• Convert OpenCV BGR image to RGB format.


• Convert NumPy array to PIL image.
• [Link]() to display it in Tkinter.

Sample Code:

from PIL import Image, ImageTk

48
import cv2

image = [Link]('[Link]')

image = [Link](image, cv2.COLOR_BGR2RGB)

img = [Link](image)

img_tk = [Link](img)

[Link](image=img_tk)

This integration gives your system a user-friendly visual interface that helps in easy
testing and demonstration of model predictions.

[Link] Notebook / PyCharm (Python IDEs used during development):

Every software development project requires a reliable and productive


development environment. In this project, both Jupyter Notebook and PyCharm
were used during various phases of development and testing.

Jupyter Notebook:

Primarily used for experimentation, model training, and visualization. Ideal


for tasks like training the YOLOv8 model on Google Colab or visualizing model
accuracy, loss graphs, and sample detections. Supports step-by-step debugging and
inline visualization, which is useful for deep learning workflows.

Typical Jupyter Use Cases in the Project:

❖ Training the CNN model using TensorFlow/Keras.


❖ Testing YOLOv8 models with validation images.
❖ Displaying detection results on sample data.

49
[Link]:

A full-featured Python IDE used for developing the final application. Supports
project management, code navigation, debugging, version control, and deployment.
Ideal for combining all modules—GUI, serial communication, model loading, and
real-time webcam integration—into a single, cohesive application.

Using both Jupyter and PyCharm allows you to follow a notebook-driven


development approach for data science, followed by script-based production
development in PyCharm.

CSV File (for Storing License Plate Database):

A CSV (Comma-Separated Values) file is a simple, plain-text file format used


to store tabular data. In this project, a CSV file is used to maintain a database of
image filenames mapped to license plate numbers.

Structure Example:

image_filename,license_plate

[Link],TN38BQ1234

[Link],TN01AX5678

Use Cases in the Project:

When a user uploads an image, the filename is used to look up the license
plate number from the CSV. This plate number is displayed on the GUI and sent to
Arduino via PySerial for real-time monitoring.

Why CSV is Ideal:

❖ Lightweight and easy to use.

50
❖ No need for complex database management or SQL.
❖ Easily handled using Python's Pandas library.

Sample Code Using Pandas:

import pandas as pd

df = pd.read_csv("license_plates.csv")

plate = [Link][df['image_filename'] == '[Link]']['license_plate'].values[0]

This simple yet effective method of storing and retrieving data makes the system
fast, lightweight, and easy to manage for small-scale projects.

6. COST ESTIMATION:

Component/Category Estimated Cost Estimated Cost Notes


(INR) (USD)

Microcontroller
Arduino Uno 600 – 800 7 – 10 board

For displaying
16x2 LCD Display 150 – 200 2 – 2.5 license plate

MOSFET 30 – 50 0.4 – 0.6 Motor speed control

Simulates vehicle
DC Motor 150 – 250 2–3 speed

51
Component/Category Estimated Cost Estimated Cost Notes
(INR) (USD)

Buzzer 20 – 40 0.25 – 0.5 For auditory alerts

LEDs (Green/Red) 20 – 40 0.25 – 0.5 Visual indicators

Includes adapters
Power Supply & Cables 100 – 200 1.2 – 2.5 and connectors

Misc. Hardware (PCB, Assembly and


Breadboard, etc.) 100 – 200 1.2 – 2.5 prototyping

For real-time video


Webcam 500 – 1000 6 – 12 input

Computer (for software


dev.) -- -- Assumed available

Software (Python, Open-source


OpenCV, etc.) Free Free libraries

Development IDE Open-source or free


(Jupyter/PyCharm) Free/Community Free/Community community editions

52
Component/Category Estimated Cost Estimated Cost Notes
(INR) (USD)

Excluding computer;
varies by supplier
Total (approx.) 1,670 – 2,780 20 – 34 and region

Note:

• This is a cost estimation for a prototype or academic project, not a commercial


or city-scale deployment.
• For large-scale or commercial intelligent traffic management systems, costs
can range from $20,000 to over $200,000 depending on complexity,
integration, and scale.
• The above table is based on typical Indian market prices as of 2025 and
assumes basic hardware components as listed in the project document

Conclusion:

Together, these components—NumPy, PySerial, Pillow, development


environments like Jupyter and PyCharm, and the CSV-based database—add
powerful functionality and flexibility to your smart traffic enforcement system. Each
one serves a distinct purpose:

❖ NumPy enhances numerical performance and real-time image manipulation.


❖ PySerial connects Python-based AI systems to the physical world via
Arduino.
❖ Pillow brings interactivity to your GUI by allowing image display in Tkinter.
53
❖ Jupyter Notebook and PyCharm streamline the development process from
model training to integration and testing.
❖ CSV files provide a quick and efficient way to store and access license plate
data.

This ecosystem of tools and libraries shows how Python can bridge the gap
between AI and embedded systems, creating an intelligent, real-time solution for
traffic monitoring and rule enforcement.

7. ADVANTAGES:

❖ Real-Time Traffic Rule Enforcement Using AI


❖ Automated Detection of Helmet Violations and License Plates
❖ Seamless Integration with Arduino for Physical Alerts and Displays
❖ User-Friendly GUI for Image Upload, Detection, and Monitoring
❖ Lightweight and Scalable Solution with CSV-Based Data Management

8. APPLICATION:

❖ Traffic Rule Monitoring at Intersections and Highways


❖ Automated Helmet Detection for Two-Wheeler Safety Enforcement
❖ Smart Surveillance in Parking Lots and Toll Booths
❖ Real-Time Road Sign Detection in Smart Vehicles
❖ License Plate Identification for Law Enforcement and Violation Tracking

54
9. CONCLUSION:

This project presents an integrated, AI-powered solution for real-time traffic


rule enforcement and vehicle monitoring using advanced computer vision and deep
learning techniques. By combining the strengths of YOLOv8 for helmet and license
plate detection and TensorFlow/Keras for road sign classification, the system
ensures high accuracy and rapid detection of violations such as not wearing helmets
and overspeeding. The use of OpenCV enables efficient image and video processing,
while the GUI built with Tkinter offers a user-friendly interface for interaction and
visualization. Pandas and CSV file integration streamline data management by
storing and retrieving license plate details, and PySerial allows smooth
communication with Arduino for displaying alerts and status updates on hardware
modules like LCD displays.

This system can significantly assist traffic authorities in enforcing road safety
rules, reducing manual monitoring efforts, and promoting compliance among
commuters. It can also be extended to smart city infrastructure for broader
deployment in urban transportation management. With real-time monitoring and
automation, the project not only contributes to enhanced road safety but also
supports the development of intelligent transportation systems. Overall, this project
demonstrates how software and hardware integration can bring meaningful change
in traffic enforcement through technological innovation.

55
10. REFERENCES:

1. Aboah, A., Wang, B., Bagci, U., & Adu-Gyamfi, Y. (2023). "Real-time Multi-
Class Helmet Violation Detection Using Few-Shot Data Sampling Technique and
YOLOv8." arXiv preprint arXiv:2304.08256.

2. Laroca, R., Zanlorensi, L. A., Gonçalves, G. R., Todt, E., Schwartz, W. R., &
Menotti, D. (2019). "An Efficient and Layout-Independent Automatic License Plate
Recognition System Based on the YOLO Detector." arXiv preprint
arXiv:1909.01754.

3. Yang, Y., Liu, S., Ma, W., Wang, Q., & Liu, Z. (2018). "Efficient Traffic-Sign
Recognition with Scale-aware CNN." arXiv preprint arXiv:1805.12289.

4. Wei, C., Tan, Q., Qing, R., Zeng, G., & Wen, G. (2023). "Fast Helmet and License
Plate Detection Based on Lightweight YOLOv5." Sensors, 23(9), 4335.

5. Vaikunth, M., Dejey, D., Vishaal, C., & Balamurali, S. (2024). "Optimizing
Helmet Detection with Hybrid YOLO Pipelines: A Detailed Analysis." arXiv
preprint arXiv:2412.19467.

6. Agarwal, A., Singhal, G., Kumar, S., & Kumar, J. (2023). "Helmet Detection and
Number Plate Recognition for Safety and Surveillance System." International
Journal of Research in Engineering, Science and Management, 6(3), 94–98.

7. Gurram, V. R., Gandla, A., Veldurthi, J., Dugyala, R., Mohammed, K. A., Swathi,
B., Sobti, R., & Kumar, A. (2024). "A Comprehensive Review on Helmet Detection
and Number Plate Recognition Approaches." E3S Web of Conferences, 507, 01075.
8. D., G., Nayagam, R. D., Raj, V. A., Kamaladhas, M. D., Priya, M. S., & S., K.
(2024). "Detection of Helmet and License Plate Using Machine Learning."
International Journal of Intelligent Systems and Applications in Engineering.

56
9. Venkateswarlu, K., Chiranjeevi, K., & Ramesh, A. (2023). "YOLO Based
Advanced Smart Traffic Assistance Platform for Number Plate and Helmet
Detection." International Journal of Research in Applied Science and Engineering
Technology.

10. M., Vaikunth, D., Dejey, C., Vishaal, & S., Balamurali. (2024). "Optimizing
Helmet Detection with Hybrid YOLO Pipelines: A Detailed Analysis." arXiv
preprint arXiv:2412.19467.

57

You might also like