SWATHI FINAL DOCUMENT (2) (1)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 65

ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT

PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

CHAPTER-1
INTRODUCTION
1.1 Introduction to Embedded Systems:
Embedded Systems are electronic systems that incorporate microprocessors or
microcontrollers within their implementations. The main purpose of using microprocessors or
microcontrollers is to perform the given task in a short span of time which improves the speed
and performance of the system. Having a microprocessor in the device means that removing
the bugs, making modifications, or adding new features are only matters of rewriting the
software that controls the device. Embedded Systems that include a microprocessor or
microcontroller to perform a specific dedicated application.
Embedded Systems are ubiquitous. Every week millions of tiny computer chips come pouring
out of factories finding their way into our everyday products. Embedded Systems are self-
contained programs that are embedded within a piece of hardware. Whereas a regular computer
has many different applications and software that can be applied to various tasks, Embedded
Systems are usually set to a specific task that cannot be altered without physically manipulating
the circuitry. Another way to think of an Embedded System is as a computer system created
with optimal efficiency, allowing it to complete specific functions as quickly as possible.
Embedded Systems technologies are usually expensive in the case of industrial applications.
Embedded Systems designers usually have a significant grasp of hardware technologies. They
used specific programming languages and software to develop Embedded Systems and
manipulate the equipment small businesses may wish to hire a consultant to determine what
sort of Embedded Systems will add value to your organization. An Embedded System is a
system that is going todo a predefined specified task is the Embedded System and is even
defined as combination of both software and hardware.
A general-purpose definition of Embedded Systems is that they are devices used to control,
monitor or assist the operation of equipment, machinery or plant. "Embedded" reflects the fact
that they are an integral part of the system. Having a microprocessor in the device means that
removing the bugs, making modifications, or adding new features are only matters of rewriting
the software that controls the device. Embedded Systems that include a microprocessor or
microcontroller to perform a specific dedicated application.

DEPARTMENT OF ECE, VLITS Page 1


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Some of these computers are however very simple systems as compared with a personal
computer. The very simplest Embedded Systems can perform only a single function or set of
functions to meet a single predetermined purpose. In more complex systems an application
program that enables the Embedded System to be used for a particular purpose in a specific
application determines the functioning of the Embedded System. The ability to have programs
means that the same Embedded System can be used for a variety of different purposes. In some
cases, a microprocessor may be designed in such a way that application software for a particular
purpose can be added to the basic software in a second process, after which it is not possible to
make further changes. The application software on such processors is sometimes referred to as
firmware. Specialized development tools and environments are used to design, program, and
debug embedded systems. These tools include integrated development environments (IDEs),
compilers, debuggers, and hardware emulators tailored to the specific microcontroller or
microprocessor architecture. The simplest devices consist of a single microprocessor (often
called a ―chip‖), which may itself be packaged with other chips in a hybrid system or
Application Specific Integrated Circuit (ASIC). Its input comes from a detector or sensor and
its output goes to a switch or activator which (for example) may start or stop the operation of
a machine or, by operating a valve, may control the flow of fuel to an engine.Software deals
with the languages like ALP, Embedded C, etc., and Hardware deals with Processors,
Peripherals, and Memory. Their ability to perform specialized tasks efficiently, reliably, and
often in real- time makes them indispensable in today's interconnected world.
 Memory: It is used to store data or code
 Peripherals: These are the external devices connected.
 Processor: It is an IC which is used to perform some tasks.
Embedded Systems designers usually have a significant grasp of hardware technologies. They
used specific programming languages and software to develop Embedded Systems and
manipulate the equipment small businesses may wish to hire a consultant to determine what
sort of Embedded Systems will add value to your organization. An Embedded System is a
system that is going todo a predefined specified task is the Embedded System and is even
defined as combination of both software and hardware. . The application software on such
processors is sometimes referred to as firmware.

DEPARTMENT OF ECE, VLITS Page 2


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Fig 1.1 Block Diagram of embedded system

1.2 History of Embedded system:


The history of embedded systems can be traced back to the early days of
computing. The term "embedded system" was first used in the late 1960s to describe a computer
system that was specifically designed for a particular application. These early embedded
systems were typically designed to control specific functions within a larger system.In the
1970s, the development of microprocessors led to the creation of more advanced embedded
systems. These systems were often used in applications such as industrial automation, medical
devices, and consumer electronics.In the 1980s, the development of microcontrollers further
revolutionized the embedded systems market. Microcontrollers are small, low-cost
microprocessors that can be used to control specific functions within a larger system. Examples
of microcontrollers include the Intel 8051 and the Motorola 6800.
In the 1990s, the rise of the internet and the development of wireless communication
technologies led to the creation of embedded systems that could communicate with each other
over long distances. These systems were often used in applications such as remote monitoring,
telemetry, and control.
In the 2000s, the development of low-power microcontrollers and the rise of microprocessor-
based systems led to a new wave of embedded systems. These systems were often used in
applications such as smartphones, tablets, and wearable devices.In the 21st century, the
development of machine learning algorithms and artificial intelligence has led to the creation
of even more advanced embedded systems.

DEPARTMENT OF ECE, VLITS Page 3


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

1.3 Advantages of embedded system:


1. Performance Efficiency: Embedded systems are designed to perform specific tasks,
which allows them to operate more efficiently than general-purpose computers.
2. Reliability: Due to their dedicated function, embedded systems can be more reliable
than general-purpose computers.
3. Low Power Consumption: Embedded systems are often designed to operate on low
power, making them suitable for battery-powered devices.

1.4 Applications of Embedded Systems

 Manufacturing and process control

 Transport

 Buildings and premises

 Domestic service

 Communications

 Office systems and mobile equipment

 Banking, finance, and commercial

 Medical diagnostics and life support

 Testing and monitoring

DEPARTMENT OF ECE, VLITS Page 4


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

CHAPTER 2
OVERVIEW OF THE PROJECT

2.1 Aim of the project:


Road accidents remain a significant concern worldwide, resulting in
substantial loss of life and property. Enhancing safety measures in vehicles is imperative to
mitigate the risks associated with road travel. In response to this pressing issue, we present an
innovative Accident Prevention and Alert System aimed at improving road safety by
implementing advanced technology and proactive measures within vehicles.Our system
integrates NodeMCU, DC motors with L298 motor driver, limit switches acting as crash
sensors, touch sensors for driver identification by detecting steering wheel grip, and alcohol
sensors. Additionally, it incorporates cutting-edge computer vision techniques, specifically the
YOLO (You Only Look Once) algorithm, to detect obstacles in front of the vehicle using a
laptop webcam.The primary objective of our system is to ensure safe vehicle operation by
verifying specific conditions before allowing the vehicle to start. This includes confirming the
presence of a sober and authorized driver through alcohol sensors and touch sensors detecting
steering wheel contact. Once authenticated, the system enables vehicle operation, while real-
time monitoring through the YOLO algorithm identifies potential obstacles ahead. In the event
of obstacle detection, the system promptly alerts the driver, thereby preventing potential
accidents. By leveraging hardware components, machine learning algorithms, and real-time
object detection, our proposed system offers a holistic approach to road safety. By empowering
drivers with proactive measures and timely alerts, we aim to enhance road safety, reduce
accident rates, and ultimately save lives.In this paper, we outline the design, implementation,
and functionality of our Accident Prevention and Alert System. Through the integration of
advanced technology and proactive safety measures, our system represents a significant step
towards. Enhancing safety measures in vehicles is imperative to mitigate the risks associated
with road travel. In response to this pressing issue, we present an innovative Accident
Prevention and Alert System aimed at improving road safety by implementing advanced
technology and proactive measures within vehicles.Our system. . Once authenticated, the
system enables vehicle operation, while real-time monitoring through the YOLO algorithm
identifies potential obstacles ahead

DEPARTMENT OF ECE, VLITS Page 5


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

2.2 BLOCK DIAGRAM :

Fig 2.1 Block diagram of accident prevention and alert system


Road accidents continue to be a persistent and significant problem globally, resulting in loss of
life, injuries, and property damage. Despite various safety measures and regulations, the
frequency of accidents remains a concern, necessitating innovative solutions to address the
underlying challenges.
Key issues contributing to road accidents include:
1. Driver Negligence: Many accidents occur due to driver negligence, including distractions,
fatigue, and impairment by alcohol or drugs.
2. Lack of Driver Authentication: Unauthorized or impaired individuals may operate vehicles,
increasing the risk of accidents.
3. Failure to Detect Obstacles: Drivers may fail to notice obstacles or hazards in their path,
leading to collisions or accidents.
3. Delayed Response to Hazards: Even when drivers identify obstacles, their response time
may be insufficient to prevent accidents.
4.Limited Precautionary Measures: Existing vehicle safety systems often focus on passive
measures rather than proactive prevention of accidents.

DEPARTMENT OF ECE, VLITS Page 6


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.Inadequate Integration of Advanced Technologies: Despite advancements in technology,


there is a lack of comprehensive systems integrating various technologies to prevent accidents
effectively.
6.Addressing these challenges requires the development of an innovative Accident Prevention
and Alert System that incorporates advanced technologies such as sensors, machine learning,
and real-time monitoring. Such a system should aim to:
7.Authenticate Drivers: Verify the identity and sobriety of drivers before allowing vehicle
operation.
8.Proactively Detect Obstacles: Utilize sensors and computer vision algorithms to detect
obstacles in real-time and alert drivers promptly.
9.Enhance Driver Awareness: Provide drivers with timely alerts and warnings to help them
navigate safely and avoid potential hazards.
10.Improve Response Time: Enable rapid responses to hazards by alerting drivers in real-time
and providing actionable information.
11.Integrate Comprehensive Safety Measures: Incorporate a range of safety features and
technologies to create a holistic approach to accident prevention.
12.By addressing these objectives, the proposed Accident Prevention and Alert System aims
to enhance road safety, reduce accident rates, and ultimately save lives.
The primary objective of our system is to ensure safe vehicle operation by verifying specific
conditions before allowing the vehicle to start. This includes confirming the presence of a sober
and authorized driver through alcohol sensors and touch sensors detecting steering wheel
contact. Once authenticated, the system enables vehicle operation, while real-time monitoring
through the YOLO algorithm identifies potential obstacles ahead. In the event of obstacle
detection, the system promptly alerts the driver, thereby preventing potential accidents.
2.3 Working of Accident prevention and alert system:
Accident Prevention and Alert System involves integrating hardware components, software
algorithms, and real-time object detection to ensure safe vehicle operation.
Hardware Setup:
1. Connect the NodeMCU to the DC motors with L298 motor driver, limit switches, touch
sensors, and alcohol sensor according to the circuit diagram.
2. Ensure all connections are secure and properly configured.

DEPARTMENT OF ECE, VLITS Page 7


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

3. Software Configuration:
4. Install the necessary libraries and dependencies for interfacing with sensors and
actuators on the NodeMCU.
5. Set up the NodeMCU to establish Wi-Fi connectivity for data transmission and
communication with external devices.
6. Driver Identification:
7. Implement code to monitor touch sensors attached to the steering wheel to detect driver
presence and grip.
8. Develop logic to verify driver identity based on touch sensor inputs before enabling
vehicle operation.
9. Alcohol Detection: Interface the alcohol sensor with the NodeMCU and implement
code to read alcohol levels from the sensor.
10. Set threshold levels for detecting alcohol presence and integrate logic to prevent
vehicle operation if the threshold is exceeded.
11. Crash Detection:Configure limit switches as crash sensors and connect them to the
NodeMCU.
12. Develop code to monitor limit switch inputs and trigger emergency braking or evasive
maneuvers in the event of a collision.
13. Object Detection with YOLO Algorithm:
14. Set up a laptop with a webcam and install the necessary software libraries for image
processing and object detection.
15. Integrate the YOLO algorithm into the system to analyze real-time video footage
Alert System:
1. Implement an alert system to notify the driver in case of detected obstacles, driver
impairment, or collision.
2. Develop code to trigger audible and visual alerts using buzzers, LEDs, or display
screens integrated into the vehicle dashboard.
3. User Interface:
4. Design and develop a user-friendly interface for the driver to interact with the system.
5. Implement features for configuring system settings, monitoring sensor data, and
receiving alerts in real-time.

DEPARTMENT OF ECE, VLITS Page 8


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

6. Continuous Monitoring and Feedback:


7. The system continuously monitors vehicle dynamics, driver behavior, and road
conditions to provide feedback and assistance in real-time.
8. Real-time object detection, proactive intervention, and user-friendly interfaces help
prevent accidents before they occur, enhancing overall road safety.
9. By integrating these components and technologies, the proposed Accident Prevention
and Alert System offers a comprehensive solution to prevent accidents caused by driver
negligence, impairment, or external hazards. Through real-time monitoring, proactive
intervention, and user-friendly interfaces, the system empowers drivers with the tools
and support needed to navigate safely and confidently on the road.

DEPARTMENT OF ECE, VLITS Page 9


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

CHAPTER 3
LITERATURE REVIEW
3.1 Existing System 1:
Title : Implementation of Wireless black box using MEMS accelerometer and GPS tracking
for accidental monitoring of vehicle.
Author: A. Gunadal, A. Koujalagi, S. Karavade, and S. Konnuri.
Conference: Proceedings of 2012 IEEE-EMBS International Conference on Biomedical and
Health Informatics.
Objective:
In this work, wireless black box using MEMS accelerometer and GPS tracking system is
developed for accidental monitoring. The system consists of cooperative components of an
accelerometer, microcontroller unit, GPS device and GSM module. In the event of accident,
this wireless device will send mobile phone short massage indicating the position of vehicle by
GPS system to family member, emergency medical service (EMS) and nearest hospital. The
threshold algorithm and speed of motorcycle are used to determine fall or accident in real-time.
The system is compact and easy to install under rider seat. The system has been tested in real
world applications using bicycles. The test results show that it can detect linear fall, non-linear
fall and normal ride with high accuracy.

Fig. 3.1 Block diagram of Wireless black box using MEMS accelerometer and GPS tracking
for accidental monitoring of vehicle.

DEPARTMENT OF ECE, VLITS Page 10


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Result:
The Wireless Black Box using MEMS accelerometer and GPS tracking for accidental
monitoring of vehicles project successfully implemented a comprehensive solution to prevent
accidents caused by driver negligence, impairment, or external hazards. The system employed
real-time object detection, driver authentication, alcohol detection, and crash prevention
measures to ensure the safety of the driver and the surrounding environment. The wireless black
box technology and MEMS accelerometer-GPS tracking capabilities enabled accurate
monitoring and analysis of vehicle data, while the user-friendly interface provided drivers with
real-time alerts and feedback. Rigorous testing and calibration were conducted to ensure the
reliability and accuracy of the system, and real-world trials demonstrated the effectiveness of
the system in preventing accidents and enhancing road safety. Overall, the Accident Prevention
and Alert System represents a significant advancement in road safety technology, offering a
comprehensive solution to mitigate the risks associated with road travel and contributing to
safer roads and reduced accident rates.
Disadvantages:
Wireless Black Box using MEMS accelerometer and GPS tracking for accidental
monitoring of vehicles include:
 Potential for false alarms or incorrect data interpretation
 Privacy concerns around data collection and storage
 Risk of over-reliance on the system by drivers.

DEPARTMENT OF ECE, VLITS Page 11


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

3.2 Existing System 2:


Title: Implementation of Motorcycle Detection and Tracking System with Occlusion
Segmentation.
Author: Chung-ChengChiu, Min-YuKu, Hung-Tsung, Chen Nat.
Conference: Image Analysis for Multimedia Interactive Services. Santorini, vol. 2, pp. 32-
32, June 2007.
Objective:
This paper proposes a vision-based motorcycle monitoring system to detect and tracking
motorcycles. The system proposes an occlusion detection and segmentation method. The
method uses the visual length, visual width, and Pixel Ratio to detect the classes of the
motorcycle occlusions and segment the motorcycle from each occlusive class. Because the
motorcycle riders must put on their helmets, the helmet detection or search method is used to

Fig 3.2 Block diagram of Motorcycle Detection and Tracking System with Occlusion
Segmentation.

DEPARTMENT OF ECE, VLITS Page 12


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Result:
The Motorcycle Detection and Tracking System with Occlusion Segmentation was
able to reliably detect and track motorcycles in a video stream using deep learning and
computer vision techniques. The system was able to maintain accurate tracking even in
situations with occlusions and complex backgrounds. The use of occlusion segmentation and
centroid tracking helped to improve the robustness of the motorcycle tracking, resulting in a
more reliable and accurate system.
Disadvantages:
Motorcycle Detection and Tracking System with Occlusion Segmentation what is the
disadvantages in four lines
The Motorcycle Detection and Tracking System with Occlusion Segmentation has some
disadvantages, which include:
1. Limited accuracy: The system relies on the accuracy of the GPS tracking and MEMS
accelerometer. Inaccurate readings from these sensors can lead to incorrect data and
inaccurate alerts.
2. Battery life: The system requires a battery to power the MEMS accelerometer and GPS
tracking. The battery life may be limited, requiring frequent recharging or replacement.
3. Cost: The system requires the purchase of components such as the MEMS
accelerometer, GPS tracking device, and battery. This may be a barrier to entry for some
users.
4. False positives: The system may generate false alerts if it misinterprets the data from
the MEMS accelerometer or GPS tracking device. This could lead to unnecessary
distress for the driver.
5. Privacy concerns: The system collects and stores data about the driver's location and
behavior. This may raise privacy concerns for some users.

DEPARTMENT OF ECE, VLITS Page 13


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

3.3 Existing System 3:


Title: Implementation of Hybrid Deep Learning Signature based Correlation Filter for Vehicle
Tracking in Presence of Clutters and Occlusion
Author: B. S. Shobha and R. Deepu
Conference: (IJACSA) International Journal of Advanced Computer Science and
Applications, Vol. 13, No. 10, 2022.
Objective:
This vehicle tracking is an important task of smart traffic management. Tracking is very
challenging in presence of occlusions, clutters, variation in real world lighting, scene conditions
and camera vantage. Joint distribution of vehicle movement, clutter and occlusions introduces
larger errors in particle tracking based approaches. This work proposes a hybrid tracker by
adapting kernel and particle-based filter with aggregation signature and fusing the results of
both to get the accurate estimation of target vehicle in video frames. Aggregation signature of
object to be tracked is constructed using a probabilistic distribution function of lighting
variation, clutters and occlusions with deep learning model in frequency domain.

Fig 3.3 Block diagram of Hybrid Deep Learning Signature based Correlation Filter for Vehicle
Tracking in Presence of Clutters and Occlusion
It utilizes a kernel and particle-based filter with an aggregation signature that is constructed
with a deep learning model in the frequency domain to estimate the target vehicle's position.
The proposed method also includes a fuzzy adaptive background modeling and subtraction
algorithm

DEPARTMENT OF ECE, VLITS Page 14


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Result:
The Hybrid Deep Learning Signature based Correlation Filter for Vehicle Tracking in Presence
of Clutters and Occlusion provides a tracking accuracy improvement of 3% compared to
existing tracking methods. It utilizes a kernel and particle-based filter with an aggregation
signature that is constructed with a deep learning model in the frequency domain to estimate
the target vehicle's position. The proposed method also includes a fuzzy adaptive background
modeling and subtraction algorithm to remove background clutters affecting the tracking
performance. This results in improved tracking accuracy in challenging environments.
Disadvantages:
The method may have a high computational cost due to the use of both kernel and particle-
based filter.The effectiveness of the method may be affected by the quality of the deep learning
model used in the frequency domain.The performance of the proposed method may be affected
by the complexity of the scene and the number of clutters and occlusions.The implementation
of the fuzzy adaptive background modeling and subtraction algorithm may require a high level
of expertise in this field.
1. Limited Functionality: The system is designed specifically for accident detection and
notification, which limits its functionality in comparison to more advanced systems that offer
additional safety features in modern vehicles.
2. Dependence on Sensor Accuracy: The accuracy of the system depends on the proper
functioning of various sensors, such as accelerometers, GPS, and alcohol sensors. Failure in
these sensors can lead to inaccurate or unreported accidents.
3. Limited Compatibility: The system may not be compatible with other systems in use or newer
vehicle models. This can lead to increased cost for consumers and potential limitations on the
system's usability.
4. Maintenance: Regular maintenance of the sensors and system components can be required to
ensure system performance and prevent false alerts.
Privacy Concerns: Real-time data sharing of the vehicle's location and other details can lead to
privacy concerns.
5. High Cost: The system might be expensive to install and maintain, especially for users who
cannot take advantage of the subsidy and other support schemes.

DEPARTMENT OF ECE, VLITS Page 15


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

3.4 Existing System 4:


Title: Implementation of Automatic Vehicle Accident Detection and Messaging System Using
GSM and GPS Module
Author: K. A. Hakim, M. M. Hasan, and S. Akter
Conference: B.Sc. Project, City University, Dhaka, Bangladesh, Spring 2019.
Objective:
The main aim of the project Accident Detection and Messaging System is to inform the
Ambulance and Police of the accident site and arrange for necessary steps to control the
situation. This system is not only efficient but also worthy to be implemented. . The Accident
Detection and Messaging System can be fitted in the vehicle (Ambulance or the Police) and
they are informed about any such untoward incident at the go.

Fig 3.4 Block diagram of Automatic Vehicle Accident Detection and Messaging System
Using GSM and GPS Module

DEPARTMENT OF ECE, VLITS Page 16


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Result:
This project presents vehicle accident detection and alert system with SMS to the user defined
mobile numbers. The GPS tracking and GSM alert based algorithm is designed and
implemented with ATmega 8A MCU in embedded system domain. The proposed Vehicle
accident detection system can track geographical information automatically and sends an alert
SMS regarding accident. Experimental work has been carried out carefully. The result shows
that higher sensitivity and accuracy is indeed achieved using this project. EEPROM is
interfaced to store the mobile numbers permanently. This made the project more user-friendly
and reliable. The proposed method is verified to be highly beneficial for the automotive industry
Disadvantages:
The automatic vehicle accident detection and messaging system has the following
disadvantages:
1. Limited Functionality: The system is designed specifically for accident detection and

notification, which limits its functionality in comparison to more advanced systems that offer
additional safety features in modern vehicles.
2. Dependence on Sensor Accuracy: The accuracy of the system depends on the proper

functioning of various sensors, such as accelerometers, GPS, and alcohol sensors. Failure in
these sensors can lead to inaccurate or unreported accidents.
3. Limited Compatibility: The system may not be compatible with other systems in use or newer

vehicle models. This can lead to increased cost for consumers and potential limitations on the
system's usability.
4. Maintenance: Regular maintenance of the sensors and system components can be required to

ensure system performance and prevent false alerts.


Privacy Concerns: Real-time data sharing of the vehicle's location and other details can lead to
privacy concerns.
5. High Cost: The system might be expensive to install and maintain, especially for users who

cannot take advantage of the subsidy and other support schemes.


6. Limited Prevention Capabilities: The current system is more focused on detecting accidents

after their occurrence. Although it integrates multiple sensors, it can be improved to

DEPARTMENT OF ECE, VLITS Page 17


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

CHAPTER 4
PROPOSED SYSTEM
4.1 Introduction:
Accidents on roads are a significant concern globally, leading to loss of lives and
property. To address this issue, we propose an Accident Prevention and Alert System designed
to enhance safety measures in vehicles. The system utilizes NodeMCU, DC motors with L298
motor driver, limit switches as crash sensors, touch sensors for driver identification bydetecting
if the driver is holding the steering wheel, and alcohol sensors. It incorporates advanced
computer vision techniques, specifically the YOLO (You Only Look Once) algorithm, to detect
objects in front of the vehicle using a laptop webcam.The system ensures vehicle operation
only when specific conditions are met, including verifying if the driver is holding the steering
wheel through touch sensors and ensuring sobriety through alcohol sensors. Upon verification,
the vehicle starts, and real-time monitoring using the YOLO algorithm identifies potential
obstacles in the vehicle's path. In the event of an obstacle detection, the system promptly alerts
the driver, preventing potential accidents.By integrating hardware components, machine
learning algorithms, and real-time object detection, the proposed system offers a comprehensive
solution to enhance road safety and prevent accidents. This innovative approach empowers
drivers with proactive measures to mitigate risks, ensuring safer road travel and reducing the
occurrence of accidents.
4.2 Working Principle:
Our proposed Accident Prevention and Alert System is a comprehensive solution designed to
address the shortcomings of existing methods by integrating advanced technologies for real-
time monitoring, proactive intervention, and comprehensive accident prevention measures. The
system consists of the following components:
NodeMCU and DC Motors with L298 Motor Driver: The NodeMCU serves as the central
control unit, interfacing with various sensors and actuators. DC motors with L298 motor drivers
are utilized for vehicle control, enabling responsive maneuvering based on real-time inputs.
Limit Switches as Crash Sensors: Limit switches are strategically placed to detect collisions
Touch Sensors for Driver Identification: Touch sensors are installed on the steering wheel to
detect the presence and grip of the driver. This ensures that only authorized individuals are

DEPARTMENT OF ECE, VLITS Page 18


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

permitted to operate the vehicle.


Alcohol Sensor: An alcohol sensor is incorporated to detect the presence of alcohol in the
driver's breath. If alcohol is detected above a predefined threshold, the system prevents vehicle
operation until the driver sobers up.
YOLO Algorithm for Object Detection: A laptop webcam is used in conjunction with the
YOLO (You Only Look Once) algorithm for real-time object detection. This enables the system
to identify obstacles or hazards in the vehicle's path, such as pedestrians, vehicles, or road
debris.Alert System: In the event of an obstacle detection or driver impairment, the system
triggers audible and visual alerts to notify the driver. These alerts prompt the driver to take
corrective action or initiate emergency braking to avoid collisions.Integration with Laptop
Webcam: The system interfaces with a laptop webcam to capture real-time video footage of the
road ahead. This video feed is analyzed by the YOLO algorithm to identify potential hazards,
providing an additional layer of safety.
User Interface: A user-friendly interface is provided to the driver for system configuration,
monitoring, and interaction. This interface displays real-time sensor data, alerts, and status
updates, enabling the driver to stay informed and in control at all times
.Continuous Monitoring and Feedback: The system continuously monitors vehicle dynamics,
driver behavior, and road conditions to provide feedback and assistance in real-time. This
proactive approach helps prevent accidents before they occur, enhancing overall road safety.By
integrating these components and technologies, our proposed Accident Prevention and Alert
System offers a comprehensive solution for preventing accidents caused by driver negligence,
impairment, or external hazards. Through real-time monitoring, proactive intervention, and
user-friendly interfaces, the system empowers drivers with the tools and support needed to
navigate safely and confidently on the road. : In the event of an obstacle detection or driver
impairment, the system triggers audible and visual alerts to notify the driver. These alerts
prompt the driver to take corrective action or initiate emergency braking to avoid
collisions.Integration with Laptop Webcam: The system interfaces with a laptop webcam to
capture real-time video footage of the road ahead. The system continuously monitors vehicle
dynamics, driver behavior, and road conditions to provide feedback and assistance in real-time.
This proactive approach helps prevent accidents

DEPARTMENT OF ECE, VLITS Page 19


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

4.3 Block Diagram:

Fig.4.1 Block diagram of Enhancing Road Safety through Innovative Accident


Prevention and Alert System using machine learning

DEPARTMENT OF ECE, VLITS Page 20


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

CHAPTER 5
HARDWARE IMPLEMENTATION
5.1 NodeMCU ESP8266:

Fig.5.1 NodeMCU ESP8266


The NodeMCU ESP8266 is a microcontroller development board with WiFi capability that
utilizes the ESP8266 microcontroller chip. The board operates on 3.3V, while its input voltage
is in the range of 4.5V-10V. The ESP8266's features include 16 digital I/O pins, with 16 of
them supporting PWM, 1 analog input, and 1 SPI, I2C, and UART each. The microcontroller's
flash memory is 4MB, while the ATmega328p, used in Arduino Uno, has 32KB. The operating
voltage of Arduino Uno is 5V, and its input voltage ranges from 7V-12V. The NodeMCU
ESP8266 is a microcontroller development board with WiFi capability that utilizes the
ESP8266 microcontroller chip. The board operates on 3.3V, while its input voltage is in the
range of 4.5V-10V. The ESP8266's features include 16 digital I/O pins, with 16 of them
supporting PWM, 1 analog input, and 1 SPI, I2C, and UART each. The microcontroller's flash
memory is 4MB, while the ATmega328p, used in Arduino Uno, has 32KB. The operating
voltage of Arduino Uno is 5V, and its input voltage ranges from 7V-12V.

DEPARTMENT OF ECE, VLITS Page 21


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Fig.5.2 NodeMCU ESP8266 Pin Configuration


NodeMCU ESP8266 are its built-in WiFi capability and greater memory capacity, which
allows for programming more complex projects. However, the ESP8266 can be more
challenging to program due to a less streamlined programming environment compared to
Arduino Uno. Because Arduino Uno uses a simpler USB connection, it might prove to be a
more accessible option for beginners.The NodeMCU ESP8266's lower operating voltage (3.3V
vs Arduino's 5V) can also be a disadvantage in certain applications. For instance, the ESP8266
might not work with devices that depend on a 5VDC input voltage, as it may not be capable of
delivering sufficient power to them. The NodeMCU ESP8266 carries a smaller SRAM (64KB
vs 2KB), which may impact the performance of specific projects requiring large RAM size.
Additionally, the NodeMCU ESP8266's current consumption (Deep sleep) 35mA is higher
compared to Arduino UNO 40mA when it is in deep sleep mode. This higher power
consumption may lead to a quicker exhaustion of battery life, especially if the board is in deep
sleep mode to conserve power.

DEPARTMENT OF ECE, VLITS Page 22


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.1.1 NodeMCU Development Board Pinout Configuration:

Pin Name Description


Catego
ry
Power Micro-USB, Micro-USB: NodeMCU can be powered through the USB port
3.3V, GND,
Vin 3.3V: Regulated 3.3V can be supplied to this pin to power the
board

GND: Ground pins

Vin: External Power Supply


Control EN, RST The pin and the button resets the microcontroller
Pins

Analog A0 Used to measure analog voltage in the range of 0-3.3V


Pin

GPIO GPIO1 to NodeMCU has 16 general purpose input-output pins on its board
Pins GPIO16

SPI Pins SD1, CMD, NodeMCU has four pins available for SPI communication.
SD0, CLK
UART TXD0, NodeMCU has two UART interfaces, UART0 (RXD0 & TXD0)
Pins RXD0, and UART1 (RXD1 & TXD1). UART1 is used to upload the
TXD2, firmware/program.
RXD2
I2C NodeMCU has I2C functionality support but due to the internal
Pins functionality of these pins, you have to find which pin is I2C.
Table .5.1 Table of NodeMCU Development Board Pinout Configuration

DEPARTMENT OF ECE, VLITS Page 23


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.1.2 NodeMCU ESP8266 Specifications & Features:


 Microcontroller: Tensilica 32-bit RISC CPU Xtensa LX106
 Operating Voltage: 3.3V
 Input Voltage: 7-12V
 Digital I/O Pins (DIO): 16
 Analog Input Pins (ADC): 1
 UARTs: 1
 SPIs: 1
 I2Cs: 1
 Flash Memory: 4 MB
 SRAM: 64 KB
 Clock Speed: 80 MHz
 USB-TTL based on CP2102 is included onboard, Enabling Plug n Play
 PCB Antenna
 Small Sized module to fit smartly inside your IoT projects
5.1.3 Brief About NodeMCU ESP8266:
The NodeMCU ESP8266 development board comes with the ESP-12E module containing
ESP8266 chip having Tensilica Xtensa 32-bit LX106 RISC microprocessor. This
microprocessor supports RTOS and operates at 80MHz to 160 MHz adjustable clock
frequency. NodeMCU has 128 KB RAM and 4MB of Flash memory to store data and
programs. Its high processing power with in-built Wi-Fi / Bluetooth and Deep Sleep Operating
features make it ideal for IoT projects.
NodeMCU can be powered using Micro USB jack and VIN pin (External Supply Pin). It
supports UART, SPI, and I2C interface.
NodeMCU ESP8266 are its built-in WiFi capability and greater memory capacity, which
allows for programming more complex projects. However, the ESP8266 can be more
challenging to program due to a less streamlined programming environment compared to
Arduino Uno. Because Arduino Uno uses a simpler USB connection, it might prove to be a
more accessible option for beginners.The NodeMCU ESP8266's lower operating voltage (3.3V

DEPARTMENT OF ECE, VLITS Page 24


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Fig 5.3 NodeMCU ESP8266


5.1.4 Programming NodeMCU ESP8266 with Arduino IDE:
The NodeMCU Development Board can be easily programmed with Arduino IDE since it
is easy to use.
Programming NodeMCU with the Arduino IDE will hardly take 5-10 minutes. All you
need is the Arduino IDE, a USB cable and the NodeMCU board itself. You can check this
Getting Started Tutorial for NodeMCU to prepare your Arduino IDE for
NodeMCU.Uploading your first program Once Arduino IDE is installed on the computer,
connect the board with the computer using the USB cable. Now open the Arduino IDE and
choose the correct board by selecting Tools>Boards>NodeMCU1.0 (ESP-12E Module),
and choose the correct Port by selecting Tools>Port. To get it started with the NodeMCU
board and blink the built-in LED, load the example code by selecting
Files>Examples>Basics>Blink. Once the example code is loaded into your IDE, click on
the ‗upload‘ button given on the top bar. Once the upload is finished, you should see the
built-in LED of the board blinking. Programming NodeMCU with the Arduino IDE will
hardly take 5-10 minutes. All you need is the Arduino IDE, a USB cable and the
NodeMCU board itself. You can check this Getting Started Tutorial for NodeMCU to
prepare your Arduino IDE for NodeMCU.Uploading

DEPARTMENT OF ECE, VLITS Page 25


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.1.5 Applications of NodeMCU:


 Prototyping of IoT devices
 Low power battery operated applications
 Network projects
 Projects requiring multiple I/O interfaces with Wi-Fi and Bluetooth functionalities
5.2 MQ3 Sensor:

Fig.5.4 MQ3 Sensor

5.2.1 Pin Description:


For MQ-3 Sensor Module
Pin Name Description
VCC This pin powers the module, typically the operating voltage is +5V
GND Used to connect the module to system ground
Digital Out You can also use this sensor to get digital output from this pin, by setting
(DO) a threshold value using the potentiometer
Analog Out This pin outputs 0-5V analog voltage based on the intensity of the gas
(AO)
Table.5.2 MQ-3 Sensor Module
MQ-3 module is suitable for detecting Alcohol, Benzine, CH4, Hexane, LPG, CO.
Sensitive material of MQ-3 gas sensor is SnO2, which with lower conductivity in clean air.
When the target alcohol gas exist, the sensor‘s conductivity is more higher along withthe
gas concentration rising. MQ-3 gas sensor has high sensitity to Alcohol

DEPARTMENT OF ECE, VLITS Page 26


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

For MQ-3 Sensor


1 H -Pins Out of the two H pins, one pin is connected to supply and the other
to ground
2 A-Pins The A pins and B pins are interchangeable. These pins will be tied
to Supply voltage.
3 B-Pins A pins and B pins are interchangeable. One pin will act as output
while the other will be pulled to ground.
Table.5.3 MQ-3 Sensor
5.2.2 Features of MQ-3 Alcohol Sensor
 Sensor Type - Semiconductor
 Easy SIP header interface
 Compatible with most of the microcontrollers
 Low-power standby mode
 Requires heater voltage
 Good sensitivity to alcohol gas
 Fast response and High sensitivity
 Long life and low cost
 Requires simple Drive circuit
5.2.3 Specifications of MQ-3 Gas Sensor:
 Power requirements: 5 VDC @ ~165 mA (heater on) / ~60 mA (heater off)
 Current Consumption: 150mA
 DO output: TTL digital 0 and 1 ( 0.1 and 5V)
 AO output: 0.1- 0.3 V (relative to pollution), the maximum concentration of a voltage
of about 4V
 Detecting Concentration: 0.05-10mg/L Alcohol
 Interface: 1 TTL compatible input (HSW), 1 TTL compatible output (ALR)
 Heater consumption: less than 750mW
 Operating temperature: 14 to 122 °F (-10 to 50°C)
 Load resistance: 200kΩ
 Sensitivity S: Rs(in air)/Rs(0.4mg/L Alcohol)≥5

DEPARTMENT OF ECE, VLITS Page 27


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.2.4 Brief Detail about MQ-3 Gas Sensor:


MQ-3 module is suitable for detecting Alcohol, Benzine, CH4, Hexane, LPG, CO. Sensitive
material of MQ-3 gas sensor is SnO2, which with lower conductivity in clean air. When the
target alcohol gas exist, the sensor‘s conductivity is more higher along with the gas
concentration rising. MQ-3 gas sensor has high sensitity to Alcohol, and has good resistance to
disturb of gasoline, smoke and vapor.This sensor provides an analog resistive output based on
alcohol concentration. When the alcohol gas exist, the sensor‘s conductivity gets higher along
with the gas concentration rising. There is a resistance across an A and B inside the sensor
which varies on detection of alcohol. More the alcohol, the lower the resistance. The alcohol is
measured by measuring this resistance. The sensor and load resistor form a voltage divider, and
the lower the sensor resistance, the higher the voltage reading will be Structure and
configuration of MQ-3 gas sensor is shown in the figure above for Configuration A or B, sensor
composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer, measuring
electrode and heater are fixed into a crust made by plastic and stainless steel net. The heater
provides necessary work conditions for work of sensitive components. The enveloped MQ-3
have 6 pin, 4 of them are used to fetch signals, and other 2 are used for providing heating
current.
5.2.5 Applications of MQ-3 Gas Sensor:
 Gas level over-limit alarm
 Breathalyser
 Portable alcohol detector
 Stand-alone/background sensing device
 Environmental monitoring equipment
 Portable alcohol detector.
 Breathalyzer.
 Stand-alone sensing module.
 Used in environmental monitoring equipment.
 Vehicle alcohol detector.

DEPARTMENT OF ECE, VLITS Page 28


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.3 Touch sensor:

Fig 5.5 Touch sensor


Channel Capacitive Touch Sesnor Module uses the touch-sensing IC TTP223 to sense the
touch input thus making it easy to add capacitive touch input to your project. The touching
detection IC is designed for replacing traditional direct button key with diverse pad size. The
module has single touch pad. Power the module with 2 ~ 5.5V DC and the touch pad is all
active to sense the input.
Single Channel Capacitive Touch Sensor Module is easy to interface. It can be used along with
a microcontroller or an arduino or even without one. When a capacitive load (such as a human
hand) is in close proximity to the sense-pad, the sensor detects the change in capacitance and
activates the switch. Custom sense-pads can be made from nearly any conductive material and
these sensors can detect touch through thin layers of non-conductive materials such as glass,
plastic, fabric or even wood.
In the normal state, the module output is low, low power consumption; When a finger touches
the corresponding position, the module output high, if not touched for 12 seconds, switch to
low-power mode.

DEPARTMENT OF ECE, VLITS Page 29


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Module can be installed in such as surface plastic, glass of non-metallic materials


In addition to the thin paper ( non-metallic ) covering the surface of the module , as long as the
correct location of the touch , you can make hidden in the walls, desktops and other parts of
buttons
5.3.1 Features:
1. Low power consumption
2. Power supply for 2 ~ 5.5V DC
3. Can replace the traditional touch of a button
4. Four M2 screws positioning holes for easy installation
5.3.2 Specifications:
1. Power supply voltage(VCC): 2.0, 3, 5.5 V.
2. Output high VOH: 0.8VCC V
3. Output low VOL: 0.3VCC V
4. Response time (touch mode) : 60 mS
5. Output Pin Sink Current (@ VCC = 3V, VOL = 0.6V) : 8 mA
6. Output pin pull-up current (@ VCC = 3V, VOH = 2.4V) : 4 mA
7. Response time (low power mode) : 220 mS
8. Size : 24 x 24 x 7.2 mm
5.3.3Touch Sensor Interface:
1. Control Interface: A total of three pins (GND, VCC, SIG), GND to ground, VCC is the
power supply, SIG digital signal output pin
2. Power Indicator: Green LED, power on the right that is shiny
3. Touch area: Similar to a fingerprint icon inside the area, you can touch the trigger
finger.
4. Positioning holes: 4 M2 screws positioning hole diameter is 2.2mm, the positioning of
the module is easy to install, to achieve inter-module combination.

DEPARTMENT OF ECE, VLITS Page 30


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.4 60 RPM Centre Shaft Economy Series DC Motor:


60RPM Centre Shaft Economy Series DC Motor is high quality low cost DC geared motor. It
has steel gears and pinions to ensure longer life and better wear and tear properties. The gears
are fixed on hardened steel spindles polished to a mirror finish. The output shaft rotates in a
plastic bushing. The whole assembly is covered with a plastic ring. Gearbox is sealed and
lubricated with lithium grease and require no maintenance. The motor is screwed to the gear
Although motor gives 60 RPM at 12V but motor runs smoothly from 4V to 12V and gives wide
range of RPM, and torque. Tables below gives fairly good idea of the motor‘s performance in
terms of RPM and no load current as a function of voltage and stall torque, stall current as a
function of voltage.
5.4.1 Specifications:
 DC supply: 4 to 12V
 RPM: 60 at 12V
 Total length: 46mm
 Motor diameter: 36mm
 Motor length: 25mm
 Brush type: Precious metal
 Gear head diameter: 37mm
 Gear head length: 21mm
 Output shaft: Centred
 Shaft diameter: 6mm
 Shaft length: 22mm
 Gear assembly: Spur
 Motor weight: 100gms

DEPARTMENT OF ECE, VLITS Page 31


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Inside view of Centre Shaft Economy Series DC Motor

Fig. 5.6 Motor Mounting Clamp and Position Encoder Kit for Centre Shaft Economy

Centre Shaft Economy Series DC Motor is high quality low cost DC geared motor. It has steel
gears and pinions to ensure longer life and better wear and tear properties. The gears are fixed
on hardened steel spindles polished to a mirror finish. The output shaft rotates in a plastic
bushing. The whole assembly is covered with a plastic ring. Gearbox is sealed and lubricated
with lithium grease and require no maintenance. The motor is screwed to the gear box from
inside.Although motor gives 60 RPM at 12V but motor runs smoothly from 4V to 12V and
gives wide range of RPM, and torque. Tables below gives fairly good idea of the motor‘s
performance in terms of RPM and no load current as a function of voltage and stall torque, stall
current as a function of voltage. and pinions to ensure longer life and better wear and tear
properties. The gears are fixed on hardened steel spindles polished to a mirror finish. The output
shaft rotates in a plastic bushing. The whole assembly is covered with a plastic ring. Gearbox
is sealed and lubricated with lithium grease and require no maintenance. The motor is screwed
Although motor gives 60 RPM at 12V but motor runs smoothly from 4V to 12V and gives wide
range of RPM, and torque. steel spindles polished to a mirror finish. The output shaft rotates in
a plastic bushing. The whole assembly is covered with a plastic ring. Gearbox is sealed and
lubricated with lithium grease and require no maintenance. current as a function of voltage and
stall torque, stall current as a function of voltage. and pinions to ensure longer life and better
wear and tear properties. The gears are fixed on hardened steel spindles polished

DEPARTMENT OF ECE, VLITS Page 32


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Motor performance in terms of RPM Motor performance in terms of stall


and no load current as a function of torque and stall current as a function
input voltage of input voltage

Voltag RPM (No Curre Volt Stall Stall


e (V) Load) nt (A) age torque Current

4 16 0.013 (V) (Kg/cm) (A)

5 21 0.014 4 3.440 0.403


6 28 0.014 5 4.020 0.516
7 36 0.016 6 4.966 0.618
8 42 0.0 7 5.762 0.715
9 47 0.019 8 6.772 0.820
10 52 0.020 9 7.912 0.922
11 59 0.022 10 8.557 1.006
12 64 0.024 11 9.030 1.115
12 9.352 1.203
Table .5.4 Motor performance

5.5 L298 Motor Driver:

Fig 5.8 L298 Motor Driver

This L298N Motor Driver Module is a high power motor driver module for driving DC and
Stepper Motors. This module consists of an L298 motor driver IC and a 78M05 5V regulator.
L298N Module can control up to 4 DC motors, or 2 DC motors with directional and speed
control.

DEPARTMENT OF ECE, VLITS Page 33


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.5.1 L298N Module Pinout Configuration:

Pin Name Description

IN1 & IN2 Motor A input pins. Used to control the spinning direction of Motor A

IN3 & IN4 Motor B input pins. Used to control the spinning direction of Motor B

ENA Enables PWM signal for Motor A

ENB Enables PWM signal for Motor B

OUT1 & Output pins of Motor A


OUT2

OUT3 & Output pins of Motor B


OUT4

12V 12V input from DC power Source

5V Supplies power for the switching logic circuitry inside L298N IC

GND Ground pin

Table 5.5 L298N Module Pinout Configuration


5.5.2 Features & Specifications:
1. Driver Model: L298N 2A
2. Driver Chip: Double H Bridge L298N
3. Motor Supply Voltage (Maximum): 46V
4. Motor Supply Current (Maximum): 2A
5. Logic Voltage: 5V
6. Driver Voltage: 5-35V
7. Driver Current:2A
8. Logical Current:0-36mA
9. Maximum Power (W): 25W

DEPARTMENT OF ECE, VLITS Page 34


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.5.3 Brief about L298N Module:


The L298N Motor Driver module consists of an L298 Motor Driver IC, 78M05 Voltage
Regulator, resistors, capacitor, Power LED, 5V jumper in an integrated circuit.

Fig 5.9 L298N Module


78M05 Voltage regulator will be enabled only when the jumper is placed. When the power
supply is less than or equal to 12V, then the internal circuitry will be powered by the voltage
regulator and the 5V pin can be used as an output pin to power the microcontroller. The jumper
should not be placed when the power supply is greater than 12V and separate 5V shouldbe given
through 5V terminal to power the internal circuitry.
ENA & ENB pins are speed control pins for Motor A and Motor B while IN1& IN2 and IN3
& IN4 are direction control pins for Motor A and Motor B.
Internal circuit diagram of L298N Motor Driver module is given below

Fig.5.7 Buzzer

DEPARTMENT OF ECE, VLITS Page 35


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

5.6 Active Passive Buzzer:

Fig 5.8 Active Passive Buzzer


Buzzer Pin Configuration:
Pin Pin Description
Number Name
1 Positive Identified by (+) symbol or longer terminal lead. Can be powered by
6V DC
2 Negativ Identified by short terminal lead. Typically connected to the ground
e of the circuit

Table.5.6 Buzzer Pin Configuration


Buzzer Features and Specifications:
1. Rated Voltage: 6V DC
2. nOperating Voltage: 4-8V DC
3. Rated current: <30mA
4. Sound Type: Continuous Beep
5. Resonant Frequency: ~2300 Hz
6. Small and neat sealed package
7. Breadboard and Perf board friendly
How to use a Buzzer
A buzzer is a small yet efficient component to add sound features to our project/system. It is
very small and compact 2-pin structure hence can be easily used on breadboard, Perf Board and
even on PCBs which makes this a widely used component in most electronic applications.There
are two types are buzzers that are commonly available. The one shown here

DEPARTMENT OF ECE, VLITS Page 36


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

is a simple buzzer which when powered will make a Continuous Beeeeeeppp.... sound, the
other type is called a readymade buzzer which will look bulkier than this and will produce a
Beep. Beep. Beep. Sound due to the internal oscillating circuit present inside it. But, the one
shown here is most widely used because it can be customised with help of other circuits to fit
easily in our application.This buzzer can be used by simply powering it using a DC power
supply ranging from 4V to 9V. A simple 9V battery can also be used, but it is recommended to
use a regulated +5V or +6V DC supply. The buzzer is normally associated with a switching
circuit to turn ON or turn OFF the buzzer at required time and require interval.

DEPARTMENT OF ECE, VLITS Page 37


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

CHAPTER-6
SOFTWARE DESCRIPTION
6.1 ARDUINO IDE:
The Arduino Integrated Development Environment - or Arduino Software (IDE) - contains a
text editor for writing code, a message area, a text console, a toolbar with buttons for common
functions and a series of menus. It connects to the Arduino and Genuino hardware to upload
programs and communicate with them.
Writing Sketches
Programs written using Arduino Software (IDE) are called sketches. These sketches are written
in the text editor and are saved with the file extension .ino. The editor has features for
cutting/pasting and for searching/replacing text. The message area gives feedback while saving
and exporting and also displays errors. The console displays text output by the Arduino
Software (IDE), including complete error messages and other information. The bottom
righthand corner of the window displays the configured board and serial port. The toolbar
buttons allow you to verify and upload programs, create, open, and save sketches, and open the
serial monitor.
6.1.1 File:
1. New [Text Wrapping Break]Creates a new instance of the editor, with the bare
minimum structure of a sketch already in place.
2. Open [Text Wrapping Break]Allows to load a sketch file browsing through the
computer drives and folders.
3. Open Recent [Text Wrapping Break]Provides a short list of the most recent sketches,
ready to be opened.
4. Sketchbook [Text Wrapping Break]Shows the current sketches within the sketchbook
folder structure; clicking on any name opens the corresponding sketch in a new editor
instance.
5. Examples [Text Wrapping Break]Any example provided by the Arduino Software
(IDE) or library shows up in this menu item. All the examples are structured in a tree
that allows easy access by topic or library.

DEPARTMENT OF ECE, VLITS Page 38


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

 Save [Text Wrapping Break]Saves the sketch with the current name. If the file hasn't
been named before, a name will be provided in a "Save as.." window.
 Save as... [Text Wrapping Break]Allows to save the current sketch with a different
name.
 Page Setup [Text Wrapping Break]It shows the Page Setup window for printing.
 Print [Text Wrapping Break]Sends the current sketch to the printer according to the
settings defined in Page Setup.
 Preferences [Text Wrapping Break]Opens the Preferences window where some settings
of the IDE may be customized, as the language of the IDE interface.
 Quit [Text Wrapping Break]Closes all IDE windows. The same sketches open when
Quit was chosen will be automatically reopened the next time you start the IDE.
6.1.2 Edit:
1. Undo/Redo [Text Wrapping Break]Goes back of one or more steps you did while editing;
when you go back, you may go forward with Redo.
2. Cut [Text Wrapping Break]Removes the selected text from the editor and places it into the
clipboard.
3. Copy [Text Wrapping Break]Duplicates the selected text in the editor and places it into the
clipboard.
4. Copy for Forum [Text Wrapping Break]Copies the code of your sketch to the clipboard in
a form suitable for posting to the forum, complete with syntax coloring.
5. Copy as HTML [Text Wrapping Break]Copies the code of your sketch to the clipboard as
HTML, suitable for embedding in web pages.
6. Paste [Text Wrapping Break]Puts the contents of the clipboard at the cursor position, in the
editor.
7. Select All [Text Wrapping Break]Selects and highlights the whole content of the editor.
8. Comment/Uncomment [Text Wrapping Break]Puts or removes the // comment marker at
the beginning of each selected line.
9. Increase/Decrease Indent [Text Wrapping Break]Adds or subtracts a space at the beginning
of each selected line, moving the text one space on the right or eliminating a space at the
beginning.

DEPARTMENT OF ECE, VLITS Page 39


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

10. Find [Text Wrapping Break]Opens the Find and Replace window where you can specify
text to search inside the current sketch according to several options.
11. Find Next [Text Wrapping Break]Highlights the next occurrence - if any - of the string
specified as the search item in the Find window, relative to the cursor position.
12. Find Previous [Text Wrapping Break]Highlights the previous occurrence - if any - of the
string specified as the search item in the Find window relative to the cursor position.
6.1.3 Sketch:
1. Verify/Compile [Text Wrapping Break]Checks your sketch for errors compiling it; it
will report memory usage for code and variables in the console area.
2. Upload [Text Wrapping Break]Compiles and loads the binary file onto the configured
board through the configured Port.
3. Upload Using Programmer [Text Wrapping Break]This will overwrite the bootloader
on the board; you will need to use Tools > Burn Bootloader to restore it and be able to
Upload to USB serial port again. However, it allows you to use the full capacity of the
Flash memory for your sketch. Please note that this command will NOT burn the fuses.
To do so a Tools -> Burn Bootloader command must be executed.
4. Export Compiled Binary [Text Wrapping Break]Saves a .hex file that may be kept as
archive or sent to the board using other tools.
5. Show Sketch Folder [Text Wrapping Break]Opens the current sketch folder.
6. Include Library [Text Wrapping Break]Adds a library to your sketch by inserting
#include statements at the start of your code. For more details, see libraries below.
Additionally, from this menu item you can access the Library Manager and import new
libraries from .zip files.
7. Add File... [Text Wrapping Break]Adds a source file to the sketch (it will be copied
from its current location). The new file appears in a new tab in the sketch window. Files
can be removed from the sketch using the tab menu accessible clicking on the small
triangle icon below the serial monitor one on the right side o the toolbar.

DEPARTMENT OF ECE, VLITS Page 40


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

6.1.4 Tools:
1. Auto Format [Text Wrapping Break]This formats your code nicely: i.e. indents it so
that opening and closing curly braces line up, and that the statements inside curly braces
are indented more.
2. Archive Sketch [Text Wrapping Break]Archives a copy of the current sketch in .zip
format. The archive is placed in the same directory as the sketch.
3. Fix Encoding & Reload [Text Wrapping Break]Fixes possible discrepancies between
the editor char map encoding and other operating systems char maps.
4. Serial Monitor [Text Wrapping Break]Opens the serial monitor window and initiates
the exchange of data with any connected board on the currently selected Port. This
usually resets the board, if the board supports Reset over serial port opening.
5. Board [Text Wrapping Break]Select the board that you're using. See below for
descriptions of the various boards.
6. Port [Text Wrapping Break]This menu contains all the serial devices (real or virtual)
on your machine. It should automatically refresh every time you open the top-level tools
menu.
7. Programmer [Text Wrapping Break]For selecting a harware programmer when
programming a board or chip and not using the onboard USB-serial connection.
Normally you won't need this, but if you're burning a bootloader to a new
microcontroller, you will use this.
8. Burn Bootloader [Text Wrapping Break]The items in this menu allow you to burn
a bootloader onto the microcontroller on an Arduino board. This is not required for
normal use of an Arduino or Genuino board but is useful if you purchase a new
ATmega microcontroller (which normally come without a bootloader). Ensure that
you've selected the correct board from the Boards menu before burning the bootloader
on the target board. This command also set the right fuses. Opens the serial monitor
window and initiates the exchange of data with any connected board on the currently
selected Port. This usually resets the board, if the board supports Reset over serial port
opening

DEPARTMENT OF ECE, VLITS Page 41


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

6.1.5 Help:
Here you find easy access to a number of documents that come with the Arduino Software
(IDE). You have access to Getting Started, Reference, this guide to the IDE and other
documents locally, without an internet connection. The documents are a local copy of the online
ones and may link back to our online website.
Find in Reference [Text Wrapping Break]This is the only interactive function of the help
6.2 Arduino IDE: Initial Setup
This is the Arduino IDE once it‘s been opened. It opens into a blank sketch where you can start
programming immediately. First, we should configure the board and port settings to allow us
to upload code. Connect your Arduino board to the PC via the USB cable.

6.1 IDE: Board Setup


You have to tell the Arduino IDE what board you are uploading to. Select the Tools pulldown
menu and go to Board. This list is populated by default with the currently available Arduino
Boards that are developed by Arduino. If you are using an Uno or an Uno-Compatible Clone
(ex. Funduino, SainSmart, IEIK, etc.), select Arduino Uno. If you are using another
board/clone, select that board.
6.2.1 IDE: COM Port
If you downloaded the Arduino IDE before plugging in your Arduino board, when you plugged
in the board, the USB drivers should have installed automatically. The most recent Arduino
IDE should recognize connected boards and label them with which COM port they are using.
Select the Tools pulldown menu and then Port. Here it should list all open COM ports, and if

DEPARTMENT OF ECE, VLITS Page 42


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

there is a recognized Arduino Board, it will also give it‘s name. Select the Arduino board that
you have connected to the PC. If the setup was successful, in the bottom right of the Arduino
IDE, you should see the board type and COM number of the board you plan to program. Note:
the Arduino Uno occupies the next available COM port; it will not always be COM3.
6.2.2 Testing Your Settings:
Uploading Blink One common procedure to test whether the board you are using is properly
set up is to upload the ―Blink‖ sketch. This sketch is included with all Arduino IDE releases
and can be accessed by the File pull-down menu and going to Examples, 01.Basics, and then
select Blink . Standard Arduino Boards include a surface-mounted LED labeled ―L‖ or ―LED‖
next to the ―RX‖ and ―TX‖ LEDs, that is connected to digital pin 13. This sketch will blink the
LED at a regular interval, and is an easy way to confirm if your board is set up properly and
you were successful in uploading code. Open the ―Blink‖ sketch and press the ―Upload‖ button
in the upper-left corner to upload ―Blink‖ to the board.

Fig 6.2 Arduino IDE: Loading Blink Sketch

DEPARTMENT OF ECE, VLITS Page 43


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

6.3 PROTEUS:
Generally we are listening the words PCB’s, PCB layout, PCB designing, ect. But
what is PCB? Why we are using this PCB? We want to know about all these things as a
electronic engineer. PCB means Printed Circuit Board. This is a circuit board with printed
copper layout connections. These PCB‘s are two types. One is dotted PCB and another one is
layout PCB. The two examples are shown in below.
What is the main difference between the dotted PCB and layout PCB? In dotted PCB board
only dots are available. According to our requirement we can place or insert the components in
those holes and attach the components with wires and soldering lid. In this dotted PCB we can
make the circuit as out wish but it is very hard to design. There are so many difficulties arethere.
Those are connecting the proper pins, avoiding shot connections and etc. Coming to thelayout
PCB this is simple to design. First we select the our circuit and by using different PCB designing
software‘s, design the layout of the circuit and by itching process preparing the copper layout
of our circuit and solder the components in the correct places. It is simple to design, take less
time to design, no shortages, looking nice and perfect.
Up to now we have discussed about types of PCB‘s and difference between the types. Now we
can discuss about PCB designing software. There are so many PCB designing softwares
available. Some are Express PCB, eagle PCB, PCB Elegance, free PCB, open circuit design,
zenith PCB andProteus etc. Apart from remaining Proteus is different. Proteus is designsuit and
PCB layout designing software. In Proteus we can design any circuit and simulate the circuit
and make PCB layout for that circuit.
6.3.1 Introduction to Proteus:
Proteus professional is a software combination of ISIS schematic capture program and ARES
PCB layout program. This is a powerful and integrated development environment. Tools in this
suit are very easy to use and these tools are very useful in education and professional PCB
designing. As professional PCB designing software with integrated space based auto router, it
provides features such as fully featured schematic capture, highly configurable design rules,
interactive SPICE circuit simulator.
extensive support for power planes, industry standard CADCAM & ODB++ output and
integrated 3D viewer.
Up to know we have discussed about the basics and software description. Now we are entering

DEPARTMENT OF ECE, VLITS Page 44


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

into the designing section. Run the ISIS professional program by clicking the icon on the
desktop, then this splash screen will appear.
Next, a work space with interface buttons for designing circuit will appear as shown in figure
below. Note that there is a blue rectangular line in the workspace; make sure that whole circuit
is designed inside the rectangular space.
Next step is selecting the components to our required circuit. Let us take one example is
designing of 38 kHz frequency generator by using 555 timer IC. The circuit diagram is shown
in below image.
In the above circuit the required components are 555 timer IC, 470? and 22K? resisters, 10K?
variable resister, 0.001µf capacitor and one IR LED. So select the components from library. In
menu bar library > pick device/ symbol. Then one window will open that shown in below.

Fig 6.3 Librarys for components


There is another way to select the components. In work space left side there is a tool bar. In
that tool bar click the component mode button or pick from library. Next, a work space with
interface buttons for designing circuit will appear as shown in figure below. Note that there is
a blue rectangular line in the workspace; make sure that whole circuit is designed inside the
rectangular space.
Next step is selecting the components to our required circuit. Let us take one example is
designing of 38 kHz frequency generator by using 555 timer IC. The circuit diagram is shown
in below image.

DEPARTMENT OF ECE, VLITS Page 45


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Fig.6.5 Component Mode


Select the all components from library, that components are added to devices list. Click on the
device and change the angle of the device by using rotate buttons. Then click in the work space
then the selected component is placed in work space. Place all the devices in work space and
put the curser at the component pin end then draw the connections with that pen symbol.
Connect all the components according to circuit then that designed circuit is show in below
image.

Fig 6.6 Schematic Diagram


If any modifications want to do to the component place the mouse point and click on After

DEPARTMENT OF ECE, VLITS Page 46


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

completion of designing save with some mane and debug it. This is virtual simulation means
without making circuit we can see the result in virtually through this software and we can
design the PCB layout to our required circuit with this software.
6.4 ThingSpeak IoT Platform:
ThingSpeak is IoT platform for user to gather real-time data; for instance, climate information,
location data and other device data. In different channels in ThingSpeak, you can summarize
information and visualize data online in charts and analyze useful information.ThingSpeak can
integrate IoT:bit (micro:bit) and other software/ hardware platforms. Through IoT:bit, you can
upload sensors data to ThingSpeak (e.g. temperature, humidity, light intensity, noise, motion,
raindrop, distance and other device information).
6.5 Thingspeak Configuration:
Goal:
we need to create the thingspeak channel and get the key
Step 1
Go to https://thingspeak.com/, register an account and login to the platform
Step 2
Choose Channels -> My Channels -> New Channel
Step 3
Input Channel name, Field1 , then click ―Save Channel‖
Channel name: smart-house
Field 1: Temperature
Step 4
You will see a chat for data field1
Step 5
Open your web browser, go to https://thingspeak.com , select your channel > ―API Keys‖
,copy the API key as follows:

DEPARTMENT OF ECE, VLITS Page 47


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

6.6 MIT APPINVENTOR:


The smartphone is an information nexus in today‘s digital age, with access to a nearly infinite
supply of content on the web, coupled with rich sensors and personal data. However, people
have difficulty harnessing the full power of these ubiquitous devices for themselves and their
communities. Most smartphone users consume technology without being able to produce it,
even though local problems can often be solved with mobile devices. How then might they
learn to leverage smartphone capabilities to solve real-world, everyday problems? MIT App
Inventor is designed to democratize this technology and is used as a tool for learning
computational thinking in a variety of educational contexts, teaching people to build apps to
solve problems in their communities. MIT App Inventor is an online development platform that
anyone can leverage to solve real-world problems. It provides a web-based ―What you see is
what you get‖ (WYSIWYG) editor for building mobile phone applications targeting the
Android and iOS operating systems. It uses a block-based programming language built on
Google Blockly (Fraser, 2013) and inspired by languages such as StarLogo TNG (Begel &
Klopfer, 2007) and Scratch (Resnick et al., 2009; Maloney, Resnick, Rusk, Silverman, &
Eastmond, 2010), empowering anyone to build a mobile phone app to meet a need. To date,
6.8 million people in over 190 countries have used App Inventor to build over 24 million apps.
We offer the interface in more than a dozen languages. People around the world use App
Inventor to provide mobile solutions to real problems in their families, communities, and the
world. The platform has also been adapted to serve requirements of more specific populations,
such as building apps for emergency/first responders (Jain et al., 2015) 0robotics (Papadakis &
Orfanakis, 2016). In this chapter, we describe the goals of MIT App Inventor and how they
have influenced our design and development—from the program‘s inception at Google in 2008,
through the migration to MIT, to the present day. We discuss the pedagogical value of MIT
App Inventor and its use as a tool to teach and encourage people of all ages to think and act
computationally. We also describe three applications developed by students in different parts
of the world to solve real issues in their communities. We conclude by discussing the
limitations and benefits of tools such as App Inventor and proposing new directions for
research.

DEPARTMENT OF ECE, VLITS Page 48


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

MIT App Inventor Overview :


The MIT App Inventor user interface includes two main editor`s: the design editor and
the blocks editor. The design editor, or designer (see Fig. 3.1), is a drag and drop interface to
lay out the elements of the application‘s user interface (UI). The blocks editor (see Fig. 3.2) is
an environment in which app inventors can visually lay out the logic of their apps using color-
coded blocks that snap together like puzzle pieces to describe the program. To aid in
development and testing, App Inventor provides a mobile app called the App Inventor Companion
(or just ―the Companion‖) that developers can use to test and adjust the behavior of their apps in real
time. In this way, anyone can quickly build a mobile app and immediately begin to iterate and test MIT
App Inventor:

Fig. 6.7 App Inventor‘s design editor.


In the design of MIT App Inventor, introducing mobile app development in educational contexts was a
central goal. Prior to its release, most development environments for mobile applications were clunky,
only accessible with expertise in systems level or embedded programming, or both. Even with Google‘s
Android operating system and the Java programming language, designing the user interface was a
complex task. Further, use of the platform required familiarity with Java syntax and semantics, and the
ability to debug Java compilation errors (e.g., misspelled variables or misplaced semicolons) for
success. These challenges presented barriers to entry for individuals not versed in computer science,
In the design of MIT App Inventor, introducing mobile app development in educational contexts was a
central goal. Prior to its release, most development environments for mobile applications were clunky,
only accessible with expertise in systems level or embedded programming, or both. Even with Google‘s
Android operating system and the Java programming language, designing the user interface was a

DEPARTMENT OF ECE, VLITS Page 49


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

complex task. Further, use of the platform required familiarity with Java syntax and semantics,
and the ability to debug Java compilation errors (e.g., misspelled variables or misplaced
semicolons) for success. These challenges presented barriers to entry for individuals not versed
in computer science, App Inventor‘s target demographic. We briefly highlight and discuss
design goals for the App Inventor project, specifically, the use of components to abstract some
of the complexity of platform behavior, and the use of blocks to eliminate complexity of the
underlying programming language. These goals can be further explained as aligning the visual
language to the mental models of young developers and enabling exploration through fast,
iterative design.

Fig. 6.8 App Inventor‘s blocks editor

DEPARTMENT OF ECE, VLITS Page 50


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

CHAPTER 7

7.1 RESULTS AND DISCUSSION

OBJECT DETECTION SYSTEM:

Fig.7.1 Result of object detection system

In the growing world where computers are being used to program everything, Artificial
Intelligence and Machine Learning is in the current trend. With the ongoing evolution of the
Machine Learning, we can develop unimaginable things, one of which is the enhancing human
safety through innovative accident prevention and alert system. Our document deals with the
object detection by the automated cars in order to prevent accidents that becomes one of the main
concerns in today’s world.. Deep learning is used to do Image processing. A lot of images are
captured in order to allow the device to learn and detect the lanes in an efficient manner .From this
figure we can understand that how object is detected Succesfully.

DEPARTMENT OF ECE, VLITS Page 51


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

7.2 GPS TRACKING SYSTEM, DETECTION OF ALCHOL, TOUCH SENSOR IN


STERRING, IR SENSOR FOR SEAT BELT DETECTION,CRASH DETECTOR :

Fig.7.2. Result of latitude and longitude, Detection of alcohol ,Touch Sensor in Sterring,
IR sensor for Seat belt Detection ,Crash detector.

DEPARTMENT OF ECE, VLITS Page 52


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Enhancing human safety system through innovative accident prevention and alert technologies.
The authors present the findings of their Accident Prevention and Alert System, which utilizes an
Arduino-based vehicle accident alert system. This system incorporates GPS, GSM, and MEMS
accelerometer technologies to detect potential accidents and send alerts to theThingSpeak channel.
Current car accident detection and alert systems primarily send SMS messages to specified mobile
numbers. These systems typically utilize microcontrollers like the ATmega 8A MCU for GPS
tracking and GSM alert-based methods. They can automatically track geographic data and send
SMS alerts in the event of an accident. An accelerometer detects sudden tilting of the vehicle,
triggering the GSM module to transmit an alert message and the accident location. While such
systems are valuable for informing emergency services about accidents, they have limitations. They
focus mainly on post-accident detection and lack additional safety features in modern vehicle
systems. Moreover, their accuracy depends on the proper functioning of various sensors, which can
lead to inaccuracies or unreported accidents if sensors fail. Compatibility problems with more recent
car types and the routine maintenance requirement might also be challenging.
The hardware implementation of our system includes components such as a NodeMCU ESP8266,
an MQ3 sensor for alcohol detection, a touch sensor for driver identification, a DC series motor for
vehicle control, an L298N motor driver, and an active-passive buzzer for audible alerts. These
components work together to ensure accurate and reliable detection of potential hazards and driver
impairment, enabling proactive intervention to prevent accidents.
the development and implementation of our Accident Prevention and Alert System represent a
significant advancement in road safety technology. By integrating innovative hardware components
and advanced software algorithms, our system offers a comprehensive solution to prevent accidents
caused by driver negligence, impairment, or external hazards. Through real-time monitoring,
proactive intervention, and user-friendly interfaces, our system empowers drivers with the tools and
support needed to navigate safely on the road. As we continue to hone and improve our system in
response to user input and technical developments, it will play a critical role in boosting road safety
and saving lives.
Our proposed system's object detection system, GPS tracking system, and other components have
been successfully implemented and tested. Real-world trials have demonstrated the system's
effectiveness in preventing accidents and enhancing road safety.

DEPARTMENT OF ECE, VLITS Page 53


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

CONCLUSION
In conclusion, the development and implementation of the Accident Prevention and Alert
System represent a significant advancement in road safety technology. By integrating
innovative hardware components such as NodeMCU, sensors, and actuators with advanced
software algorithms like the YOLO (You Only Look Once) object detection algorithm, we have
created a comprehensive solution to prevent accidents caused by driver negligence,
impairment, or external hazards.Through driver authentication, alcohol detection, crash
sensors, and real-time object detection, our system ensures that only authorized and sober
individuals operate the vehicle and takes proactive measures to avoid collisions. The integration
of a user-friendly interface provides drivers with real-time alerts and feedback, empowering
them to make informed decisions and navigate safely on the road.Throughout the
implementation process, rigorous testing and calibration were conducted to ensure the
reliability, accuracy, and effectiveness of the system. Real-world trials were performed to
evaluate performance and usability, leading to refinements and optimizations to enhance
overall road safety.In conclusion, the Accident Prevention and Alert System represents a
significant step forward in road safety technology, offering a comprehensive solution to
mitigate the risks associated with road travel. By preventing accidents before they occur and
empowering drivers with proactive measures and real-time alerts, our system contributes to
safer roads, reduced accident rates, and ultimately saves lives. As we continue to refine and
improve the system based on feedback and advancements in technology, we are confident that
it will play a crucial role in enhancing road safety and improving the overall driving experience
for all road users.

DEPARTMENT OF ECE, VLITS Page 54


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

FUTURE SCOPE
Some possible directions for further development include:
1. Integration with additional sensors: Expanding the system to include additional sensors
such as temperature, humidity, and light sensors can provide even more context and
information to the driver.
2. Vehicle-to-vehicle (V2V) communication: Implementing V2V communication can
enable vehicles to share real-time information about their positions, speeds, and
intentions, potentially preventing collisions and reducing congestion.
3. Advanced machine learning algorithms: Incorporating more advanced machine
learning algorithms, such as deep learning, can improve the accuracy and reliability of
the obstacle detection and driver identification components.
4. Real-time traffic information: Integrating real-time traffic information can help drivers
anticipate and avoid congested areas, reducing travel times and increasing safety.
5. Integration with smart city infrastructure: Connecting the Accident Prevention and
Alert System with smart city infrastructure, such as traffic lights and traffic
management systems, can optimize traffic flow and reduce the likelihood of accidents.
6. Mobile app integration: Developing a mobile app that interfaces with the Accident
Prevention and Alert System can provide drivers with additional features and
functionality, such as personalized alerts, remotely controlling the vehicle, and
accessing driving analytics and performance metrics.

DEPARTMENT OF ECE, VLITS Page 55


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

APPENDIX
APPENDIX 1:

C++ code for Accident pevention and alert system:


#include "ThingSpeak.h"
#include <ESP8266WiFi.h>
#include <TinyGPS.h>
TinyGPS gps;
float flat=0, flon=0;
int statusCode = 0;
unsigned long lastTime = 0;
unsigned long timerDelay = 16000;
WiFiClient client;
const int FieldNumber1 = 1;
String strs[14]={"204526","3VUP1I9DNENT9SF1","394455","YOH6FCA74VQLKBBS","SRC
24G","src@internet","0","0","0","0","0","0","0","0"};
int StringCount = 0;
int prv=0;
int led=D4;
int m11=D0;
int m12=D1;
int m21=D2;
int m22=D3;
int irs=D6;
int als=A0;
int cs=D5;
int ts=D7;
int buz=D8;
int cnt=0;
void read_gps()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;

DEPARTMENT OF ECE, VLITS Page 56


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

for (unsigned long start = millis(); millis() - start < 1000;)


{
while (Serial.available())
{
char c = Serial.read()
if (gps.encode(c))
newData = true;
}
}
if (newData)
{
unsigned long age;
gps.f_get_position(&flat, &flon, &age);

}
}
void setup()
{
WiFi.mode(WIFI_STA);
ThingSpeak.begin(client);
Serial.begin(9600);
pinMode(m11,OUTPUT);
pinMode(m12,OUTPUT);
pinMode(m21,OUTPUT);
pinMode(m22,OUTPUT);
pinMode(ts,INPUT);
pinMode(irs,INPUT);
pinMode(cs,INPUT);
pinMode(buz,OUTPUT);
delay(1000);
}
void loop()
{
// Network //

DEPARTMENT OF ECE, VLITS Page 57


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

if (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(1000);
WiFi.begin(strs[4], strs[5]);
for(int kk=0;kk<10;kk++)
{
digitalWrite(led,0);
delay(300);
digitalWrite(led,1);
delay(300);
}
if(WiFi.status() == WL_CONNECTED)
Serial.println("ok");
}
// - Channel 1 -//
const char* string2 = strs[2].c_str();
const char* string3 = strs[3].c_str();
int temp = ThingSpeak.readLongField(atol(string2), FieldNumber1, string3);
statusCode = ThingSpeak.getLastReadStatus();
if (statusCode == 200)
{
if(temp !=prv)
{
prv=temp;
Serial.print(temp);
digitalWrite(buz,1);
delay(1000);
digitalWrite(buz,0);
}
}
delay(100);
int aval=analogRead(als)/100;
int tval=digitalRead(ts);

DEPARTMENT OF ECE, VLITS Page 58


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

int irval=1-digitalRead(irs);
int cval=1-digitalRead(cs);
Serial.println("A:"+String(aval) +" T:"+String(tval)+ " I:"+String(irval) + " C:"+String(cval));
if(aval>32 || tval==0 || irval==0 || cval==1)
{
digitalWrite(buz,1);
delay(1000);
digitalWrite(buz,0);
digitalWrite(m11,0);
digitalWrite(m12,0);
digitalWrite(m21,0);
digitalWrite(m22,0); }
else{
digitalWrite(m11,1);
digitalWrite(m12,0);
digitalWrite(m21,1);
digitalWrite(m22,0);}
delay(1000);
cnt=cnt+1;
if(cnt==15)
{
cnt=0;
read_gps();
ThingSpeak.setField(1, String(aval));
ThingSpeak.setField(2, String(tval));
ThingSpeak.setField(3, String(irval));
ThingSpeak.setField(4, String(cval));
ThingSpeak.setField(5, String(flat,4));
ThingSpeak.setField(6, String(flon,4));
const char* string0 = strs[0].c_str();
const char* string1 = strs[1].c_str();
int x = ThingSpeak.writeFields(atol(string0), string1);
if(x == 200){
delay(10);

DEPARTMENT OF ECE, VLITS Page 59


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

APPENDIX 2:
Machine learning code:
import cv2
import numpy as np
import time
# Load Yolo
net = cv2.dnn.readNet("weights/yolov3-tiny.weights", "cfg/yolov3-tiny.cfg")
classes = []
with open("coco.names", "r") as f:
classes = [line.strip() for line in f.readlines()]
layer_names = net.getLayerNames()
output_layers = [layer_names[i - 1] for i in net.getUnconnectedOutLayers()]
colors = np.random.uniform(0, 255, size=(len(classes), 3))
# Loading image
cap = cv2.VideoCapture(0)
font = cv2.FONT_HERSHEY_PLAIN
starting_time = time.time()
frame_id = 0
while True:
_, frame = cap.read()
frame_id += 1
height, width, channels = frame.shape
# Detecting objects
blob = cv2.dnn.blobFromImage(frame, 0.00392, (416, 416), (0, 0, 0), True, crop=False)
net.setInput(blob)
outs = net.forward(output_layers)

# Showing informations on the screen


class_ids = []
confidences = []
boxes = []

DEPARTMENT OF ECE, VLITS Page 60


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

for out in outs:


for detection in out:
scores = detection[5:]
class_id = np.argmax(scores)
confidence = scores[class_id]
if confidence > 0.2:
# Object detected
center_x = int(detection[0] * width)
center_y = int(detection[1] * height)
w = int(detection[3] * width)
h = int(detection[3] * height)
# Rectangle coordinates
x = int(center_x - w / 1.8)
y = int(center_y - h / 1.8)
boxes.append([x, y, w, h])
confidences.append(float(confidence))
class_ids.append(class_id)
indexes = cv2.dnn.NMSBoxes(boxes, confidences, 0.4, 0.3)
for i in range(len(boxes)):
if i in indexes:
x, y, w, h = boxes[i]
label = str(classes[class_ids[i]])
confidence = confidences[i]
color = colors[class_ids[i]]
cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2)
cv2.putText(frame, label + " " + str(round(confidence, 2)), (x, y + 30), font, 2, color,

2)
elapsed_time = time.time() - starting_time
fps = frame_id / elapsed_time
cv2.putText(frame, "FPS: " + str(round(fps, 2)), (10, 50), font, 2, (0, 0, 0), 3)

DEPARTMENT OF ECE, VLITS Page 61


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

cv2.imshow("Image", frame)
cap = cv2.VideoCapture(0)
font = cv2.FONT_HERSHEY_PLAIN
starting_time = time.time()
frame_id = 0
while True:
_, frame = cap.read()
frame_id += 1
height, width, channels = frame.shape
# Detecting objects
blob = cv2.dnn.blobFromImage(frame, 0.00392, (416, 416), (0, 0, 0), True, crop=False)
net.setInput(blob)
outs = net.forward(output_layers)
# Showing informations on the screen
x, y, w, h = boxes[i]
label = str(classes[class_ids[i]])
confidence = confidences[i]
color = colors[class_ids[i]]
cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2)
cv2.putText(frame, label + " " + str(round(confidence, 2)), (x, y + 30), font, 2, color,
key = cv2.waitKey(1)
if key == 27:
break
cap.release()
cv2.destroyAllWindows()

DEPARTMENT OF ECE, VLITS Page 62


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

REFERENCES
1. A. Gunadal, A. Koujalagi, S. Karavade, and S. Konnuri, ―Wireless black box using
MEMS accelerometer and GPS tracking for accidental monitoring of vehicle,‖ project
reference No. : 37S0430 college branch guide : s.g.balekundri institute of
technology,belgaum, 2015.
2. Chung-ChengChiu, Min-YuKu, Hung-Tsung, Chen Nat, "Motorcycle Detection and
Tracking System with Occlusion Segmentation," Image Analysis for Multimedia
Interactive Services. Santorini, vol. 2, pp. 32- 32, June 2007.
3. G. Gurjar, N. Chandurkar, R. Nagpure, S. Ganorkar, and J. Shelke, (March 2017)
'Wireless Black Box using MEMS Accelerometer and GPS Tracking for Accidental
Monitoring of Vehicles', IJESC, vol 7(No 3).
4. A. Musa, E. Alozie, S.A. Suleiman, J.A. Ojo, and A.L. Imoize, "A Review of Time-
Based Solar Photovoltaic Tracking Systems," Information (Switzerland), vol. 14, no. 4,
pp. 211, 2023. [Online]. Available: http://www.mdpi.com/journal/information/. doi:
10.3390/info14040211.
5. N. Purushotham and J. Madan Kumar, ―Wireless black box using MEMS
accelerometer and GPS tracking for accidental monitoring of vehicles,‖ International
Journal of Scientific Engineering and Technology Research Volume.03, IssueNo.03,
March-2014, Pages:0403-0408.
6. B. S. Shobha and R. Deepu, ―Hybrid Deep Learning Signature based Correlation
Filter for Vehicle Tracking in Presence of Clutters and Occlusion‖ International Journal
of Advanced Computer Science and Applications(IJACSA), 13(10), 2022, pp. 961-969.
DOI:10.14569/IJACSA.2022.01310114.
7. A. Kassem, R. Jabr, G. Salamouni, and Z. K. Maalouf, ―Vehicle black box system,‖
2008 IEEE Int. Syst. Conf. Proceedings, SysCon 2008, no. May 2008, pp. 463–468,
2008, doi: 10.1109/SYSTEMS.2008.4519050.
8. S. Sethuraman and S. Santhanalakshmi, "Implementing Vehicle Black Box System by
IoT based approach," 2020 4th International Conference on Trends in Electronics and
Informatics (ICOEI)(48184), Tirunelveli, India, 2020, pp. 390-395, doi:
10.1109/ICOEI48184.2020.9142906.
9. M. Palanisamy, D. Azhagesan, B. Varadharaian and S. Kumar, "Design of Electronic

DEPARTMENT OF ECE, VLITS Page 63


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

Control Unit with Black Box for Ground Vehicles," 2021 4th Biennial International
Conference on Nascent Technologies in Engineering (ICNTE), NaviMumbai, India,
2021, pp. 1-6, doi: 10.1109/ICNTE51185.2021.9487579.
10. N. Watthanawisuth, T. Lomas and A. Tuantranont, "Wireless black box using MEMS
accelerometer and GPS tracking for accidental monitoring of vehicles," Proceedings of
2012 IEEE-EMBS International Conference on Biomedical and Health Informatics,
Hong Kong, China, 2012, pp. 847-850, doi: 10.1109/BHI.2012.6211718.
11. M. R. Wahid, E. Joelianto and N. A. Azis, "System Identification of Switched
Reluctance Motor (SRM) Using Black Box Method for Electric Vehicle Speed Control
System," 2019 6th International Conference on Electric Vehicular Technology
(ICEVT), Bali, Indonesia, 2019, pp. 208-212, doi:
10.1109/ICEVT48285.2019.8994020.
12. P. Yellamma, N. S. N. S. P. Chandra, P. Sukhesh, P. Shrunith and S. S. Teja, "Arduino
Based Vehicle Accident Alert System Using GPS, GSM and MEMS Accelerometer,"
2021 5th International Conference on Computing Methodologies and Communication
(ICCMC), Erode, India, 2021, pp. 486-491, doi: 10.1109/ICCMC51019.2021.9418317.
13. R. C. Pandia, (2016). Black Box: A Project Report Submitted in Partial Fulfillment of
the Requirements for the Award of Degree of Bachelor of Technology in Electronics
and Telecommunication. Orissa Engineering College.
14. K. N. Kumar, C. Vishnu, R. Mitra and C. K. Mohan, "Black-box Adversarial Attacks
in Autonomous Vehicle Technology," 2020 IEEE Applied Imagery Pattern Recognition
Workshop (AIPR), Washington DC, DC, USA, 2020, pp. 1-7, doi:
10.1109/AIPR50011.2020.9425267.
15. M. M. Rahman, A. Z. M. T. Kabir, S. Z. Khan, N. Akhtar, A. Al Mamun and S. M. M.
Hossain, "Smart Vehicle Management System for Accident Reduction by Using
Sensors and An IoT Based Black Box," 2021 8th International Conference on Electrical
Engineering, Computer Science and Informatics (EECSI), Semarang,

DEPARTMENT OF ECE, VLITS Page 64


ENHANCING HUMAN SAFETY THROUGH INNOVATIVE ACCIDENT
PREVENTION AND ALERT SYSTEM USING MACHINE LEARNING

DEPARTMENT OF ECE, VLITS Page 65

You might also like