1822 B.E Eie Batchno 5
1822 B.E Eie Batchno 5
SATHYABAMA
INSTITUTE OF SCIENCE AND TECHNOLOGY
(DEEMED TO BE UNIVERSITY)
Accredited with Grade “A” by NAAC
JEPPIAAR NAGAR, RAJIV GANDHI SALAI,
CHENNAI 600 119
MARCH-2022
i
DEPARTMENT OF ELECTRONICS AND INSTRUMENTATION
ENGINNERING
BONAFIDE CERTIFICATE
This is to certify that this Project Report is the bonafide work of C. Benoni Isaac Raj
(Register Number: 38180001) and Bernard. A (Register Number: 38180002) who
carried out the project entitled “SELF DRIVING CAR USING AI AND COMPUTER
VISION " under our supervision from October 2021 to March 2022.
Internal Guide
Dr.N.R Krishnamoorthy M.E., Ph.D.,
Name:
Signature:
ii
DECLARATION
DATE: 09.05.2022
PLACE: Chennai
iii
ACKNOWLEDGEMENT
I would also like to express our sincere and deep sense of gratitude to our internal
guide Dr. N. R Krishnamoorthy M.E., Ph.D., for his valuable guidance, suggestions
and constant encouragement paved way for the successful completion of our project
work.
We wish to express our thanks to all Teaching and Non-teaching staff members of
the Electrical and Instrumentation Engineering who were helpful in many ways for
the completion of the project.
iv
ABSTRACT
The goal of the proposed system is to represent the Autonomous model that
uses the Raspberry Pi as the main working chip and our system uses Open CV with
Artificial intelligence and deep learning technology. OpenCV (Open-Source Computer
Vision Library) is an open-source computer vision software library. It was built to
provide a common infrastructure for computer vision applications and to speed up the
use of machine perception in commercial products. The proposed system will move on
its own without human assistance to its destination. The model uses a central
processing system as the Raspberry Pi, connected to the Pi camera module. The
camera will give the input images for the processes. The whole process is completed
using the Raspberry Pi and OpenCV with python language. The methods used to
achieve the independent movement of the robot are canny edge detection algorithm.
The robot with Raspberry Pi, Esp32, camera, LCD display, motors and wheels are
being attached to the chassis and the required circuit connections are made. This
system will be of assistance to the automotive industry as it will help to reduce the
required surveillance and tension of the situation, thereby reducing the risk. This model
is mainly used in industries, which helps in transportation and delivery of verities of
goods from one point to another point. It also does the work faster than humans and
ease the process.
v
CONTENT
Abstract v
List of figures ix
List of abbreviation xi
1 Introduction 1
2 Literature survey 2
3.1 Aim 6
4.4.2.1 Features 11
4.4.3.1 Features 11
vi
4.4.6.1 Improvements 15
4.4.6.5 Applications 18
4.4.7.2 Features 20
4.4.10 DC Motors 26
4.4.11 Esp32-Wroom 29
4.4.12.1 Specifications 32
vii
4.5.1 OpenCV 33
4.5.2 Python 34
4.5.3 Embedded C 36
6 Conclusion 50
References 51
viii
LIST OF FIGURES
4.1 Raspberry Pi 13
4.11 DC motor 27
4.13 Esp32-Wroom 29
ix
5.6 Edge detection 45
x
LIST OF ABBREVIATIONS
AI - Artificial intelligence
ML - Machine learning
RGB - Red, green, blue
IDE - Integrated development environment
CUDA - Compute Unified Device Architecture
GND - Ground
MP - Mega Pixel
CSI - Camera Serial Interface
TTL - Transistor–transistor logic
UART - Universal asynchronous receiver-transmitter
ADC - Analog to digital converter
DAC - Digital to analog converter
LCD - Liquid Crystal Display
LED - Light Emitting Diode
PCB - Printed Circuit Board
RAM - Random Access Memory
GPIO - General - Purpose Input/Output
EEPROM - Electrically Erasable Programmable Read-Only Memory
PoE - Power Over Ethernet
BLE - Bluetooth Low Energy
LAN - Local area network
GPU - Graphical processing unit
MMC - Modular multilevel converter
SD - Secure Digital
HDMI - High-Definition Multimedia Interface
HD - High definition
SDRAM - Synchronous Dynamic Random Access Memory
xi
DC - Direct current
IOT - Internet of things
RNN - Recurrent neural network
CNN - Convolutional neural network
OpenCV - Open computer vision
xii
CHAPTER 1
INTRODUCTION
Robotics is the science of developing machines that can act like humans and
copy their movements. Robots can be employed in a variety of scenarios and for a
variety of objectives, but many are now used in hazardous areas (such as inspection
of radioactive items, bomb detection and deactivation), manufacturing operations, or
other situations where humans are unable to live. A robot that executes behaviors or
tasks with a high degree of autonomy is known as an autonomous robot (without
external influence). Artificial intelligence, robotics, and information engineering are all
considered subfields of autonomous robotics. Spaceflight, household maintenance
(such as cleaning), wastewater treatment, and delivering goods and services are just
a few of the applications for autonomous robots.
1
CHAPTER 2
LITERATURE SURVEY
[1]Aninditya Anggari Nuryono in 2020 discussed that robotic vision is a robot that
can obtain information through image processing by the camera. The camera installed
on the line following robot aims to identify image-based lines and to navigate the robot
to follow the path. The method of image preprocessing along with robot action for line-
following robots is used. The image preprocessing includes dilation, erosion, Gaussian
filtering, contour search, and centerline definition to detect path lines and to decide the
robot’s action. The robot is implemented using Webots simulator. OpenCV and Python
are used to create line detection systems and robot movements. The simulation
displays that the method is implemented properly, and the robot can follow a few path
lines such as zigzag, dotted, and curved line.
2
indicates that the vision-based two-wheel self-balancing (TWSB) robot can trace the
black line on the map perfectly from the real-time experimental results.
3
cannot be seen in its entirety in a single image. As a result, integrating judgements of
vision with fuzzy control methods is required to ensure that the 4WIS4WID vehicle can
conduct the proper motions. The 4WIS4WID vehicle can adjust its velocity in a timely
manner under any condition and successfully navigate a confined and curved lane
utilizing the proposed fuzzy rules. Furthermore, the manual driving system is based on
the classic driving technique, allowing individuals to quickly adapt. An indoor real-time
experiment is done to verify the viability of these uses for the 4WIS4WID vehicle.
[7]Daping Jin presented a method in 2020 for identifying, tracking, and following
a target person in dynamic surroundings that combines a Line-of-Sight sensor (a 2D
laser range finder) and a Nonline-of-Sight sensor (a low-cost Angle-of-Arrival (AOA)
tag). To begin, a Kalman Filter is utilised to fuse person tracking information from AOA
data and laser data in order to obtain a smooth and continuous moving trajectory of
the target person. The laser data is then used to create a real-time robot-centric rolling
grid map.A target potential field is built on top of the rolling grid map using the fast-
marching approach, and then a direction gradient field is created based on the target
potential field. An improved dynamic window algorithm, FMM-DWA, is suggested to
drive the robot to move towards the target using the rolling grid map, the target potential
field, and the direction gradient field. To prevent falling into the local optimum, this
method analyzes not only the distance between the robot and the objective, but also
the difference between the robot's heading and the reference direction provided by the
direction gradient field. A series of person following experiments are carried out in
difficult dynamic circumstances to validate the performance of the suggested
technique. The results of the experiments reveal that the suggested following algorithm
can successfully deal with the occlusion problem and reliably follow the target individual
while avoiding static and dynamic obstacles.
4
monitor acting as the local host. Pedestrians, cars, traffic signs, and signals are
detected, and relevant orders are delivered serially to the Arduino to control the car.
The Raspberry Pi includes features such as traffic signal detection, vehicle detection,
pedestrian detection, and road sign detection, all of which help the suggested system
arrive at the proposed or defined location safely and on time. Every step is carried out
on the Raspberry Pi, which is programmed in C++. Gaussian Blur, CED, and Region
of Interest are the methods utilized to achieve autonomous car movement. Assembled
the robot body by putting together the robot car's chassis and wheels, soldering the
motors, and mounting them in the chassis, and connecting the Raspberry Pi, Arduino
Uno, and motor driver.
5
CHAPTER 3
3.1 AIM
This vehicle is a self-driving car that employs artificial intelligence and computer
vision. In this project, we create a car with a camera that detects the track or path
around it. If the automobile is about to steer into one, it should respond. The "eye" of
self-driving vehicles is computer vision with an AI-based algorithm. The primary goal
of computer vision is to provide a smooth self-driving experience. The foundation of
Artificial Intelligence technology is computer vision. AI assists computers in decoding
and comprehending visual input obtained from diverse sources. It entails employing AI
algorithms to do autonomous visual understanding. The facial recognition technology
is the best example of computer vision. This model employs the Canny edge detection
technique. This variant is mostly utilized in industries to assist in moving and
transferring things from one end to the other. As a result, it reduces the need for human
intervention and makes the work easier.
6
The system uses a microcontroller with an IR sensor to reach the destination. It
follows the desired path or line and moves automatically. The IR sensor senses the and the
information is given to the microcontroller. Microcontroller gives commands to the motor
driver and then the motor works. This system is a basic system which has low features, and it
also has various disadvantages.
The proposed system will move on its own without human assistance to its
destination using Artificial intelligence and Machine learning technology. The model
uses a central processing system as the Raspberry Pi, connected to the Pi camera
module. The camera will give the input images for the processes. The whole process
is completed using the Raspberry Pi and OpenCV with python language. The methods
used to achieve the independent movement of the robot are canny edge detection
algorithm. The robot with Raspberry Pi, Esp32, camera, LCD display, motors and
wheels are being attached to the chassis and the required circuit connections are
made.
7
CHAPTER 4
Artificial intelligence with Canny edge detection algorithm and machine learning
technology is used. Artificial intelligence (AI) is the simulation of human intelligence in
robots that have been trained to think and act like humans. The phrase can also refer
to any machine that demonstrates human-like characteristics like learning and
problem-solving. The ability of artificial intelligence to rationalize and execute actions
that have the best likelihood of reaching a certain goal is its ideal feature. Machine
learning is a subset of artificial intelligence that refers to the idea that computer systems
can learn from and adapt to new data without the need for human intervention. Deep
learning techniques allow for this autonomous learning by absorbing large volumes of
unstructured data including text, photos, and video.
8
learning, unsupervised learning, semi-supervised learning, and reinforcement learning
are the four primary methodologies. The algorithm that data scientists use is
determined by the sort of data they wish to predict.
The Canny edge detector is an edge detection operator that detects a wide
range of edges in images using a multi-stage approach. It was created in 1986 by John
F. Canny. Canny also developed a computational theory of edge detection that
explains how the method works. A multi-stage edge detector is the Canny filter. The
intensity of the gradients is computed using a filter based on the derivative of a
Gaussian. The Gaussian filter decreases the impact of image noise. Then, by deleting
non-maximum pixels of the gradient magnitude, possible edges are reduced down to
1-pixel curves. Finally, applying hysteresis thresholding on the gradient magnitude,
edge pixels are maintained or eliminated. The width of the Gaussian (the noisier the
image, the wider the width), as well as the low and high thresholds for hysteresis
thresholding, are all customizable in the Canny.
1. Edge detection has a low error rate, which indicates that the detection should
catch as many of the image's edges as possible.
2. The edge point recognized by the operator should be accurate in locating the
edge's center.
3. Image noise should not cause spurious edges, and a specific edge in the image
should only be marked once.
1. Raspberry Pi 3 Model B+
2. Raspberry Pi Camera Module
3. Ultrasonic Sensor
4. L298N Motor Driver
5. DC Gear Motor
9
6. Esp32-Wroom
7. 7 - inch HDMI LCD
Model A and Model B are the two different models of the system. The key
distinction between these two is the presence of USB ports. The model A board will
use less power because it does not have an Ethernet port. The type B, which comes
with an Ethernet interface and is made in China. The Raspberry Pi includes a collection
of open-source technologies, including web connectivity and multimedia, as well as the
ability to interface with a microcontroller.
The Raspberry Pi is based on the Broadcom BCM2835 chip and features a 700
MHz ARM1176JZF-S core CPU and 256 MB of SDRAM. The USB 2.0 ports employ
only external data communication methods. A micro-USB converter with a 500 MA
minimum range powers the Raspberry Pi (2.5 watts). The graphics specialist chip is
designed to reduce the time it takes to calculate and manipulate images. It has a
10
Broadcom video core IV cable, which is helpful if you want to utilise your Raspberry Pi
to play games and watch videos.
4.4.2.1 Features
• HDMI (rev 1.3 & 1.4) Composite RCA (PAL and NTSC) Video Out
• 8.6cm*5.4cm*1.5cm dimensions
4.4.3.1 Features
11
• Dual Core Video Core IV Multimedia coprocessor
• HDMI (rev 1.3 & 1.4) Composite RCA (PAL and NTSC) Video Out
• 8.6cm*5.4cm*1.7cm dimensions
• Raspberry Pi 1 model B
• Raspberry Pi 1 model A
• Raspberry Pi 1 model B+
• Raspberry Pi 1model A+
• Raspberry Pi Zero
• Raspberry Pi 2
• Raspberry Pi 3 model B
• Raspberry Pi Zero W
12
Fig: 4.1 Raspberry Pi
Technology has progressed over time with the goal of making people's lives
easier and more convenient. This device was a significant advancement in technology
that made computer learning so simple that anyone could get their feet wet in the
process with minimal effort. The BCM2837B0 system-on-chip (SoC) of the Raspberry
Pi 3 Model B+ contains a 1.4 GHz quad-core ARMv8 64bit processor and a powerful
Video Core IV GPU. Snappy Ubuntu Core, Raspbian, Fedora, and Arch Linux, as well
as Microsoft Windows 10 IoT Core, are among the ARM GNU/Linux distributions that
can be run on the Raspberry Pi. The Raspberry Pi 3 Model B+ boasts significant
performance improvements over the Model B including a faster CPU clock speed (1.4
GHz versus 1.2 GHz), greater Ethernet throughput, and dual-band Wi-Fi. With a Power
over Ethernet HAT, it also enables Power over Ethernet (not included).
The dual-band wireless LAN has modular compliance certification, which allows
the board to be integrated into end devices with much reduced wireless LAN
compliance testing, lowering both cost and time to market. The Raspberry Pi
13
Foundation created the Raspberry Pi to provide a low-cost platform for computer
programming exploration and teaching. The Raspberry Pi can perform many of the
same tasks as a traditional desktop computer, such as word processing, spreadsheets,
high-definition video, games, and programming. The board's four USB ports can be
used to connect USB devices such as keyboards and mice.
14
4.4.6.1 Improvements
In terms of processing speed, the model B+ maintains its lead and adds
increased wireless capabilities. The dual-band Wi-Fi 802.11ac operates at 2.4GHz and
5GHz for improved range in wirelessly difficult areas, while Bluetooth 4.2 with BLE
support is available. Instead of plastic on earlier models, the top side is coated with
metal shielding, which works as a heat sink and drains excess heat if the board is
exposed to high temperatures or pressure. This B+ model is three times quicker than
the Pi 2 and 3, which is a significant advancement in terms of performance, allowing it
to perform a variety of tasks at a reasonable speed. The ethernet port has a speed of
300 Mbit/s, which is significantly faster than the previous version's speed of 100 Mbit/s.
It's called gigabit ethernet since it uses a USB 2.0 interface. On the board near the 40
pin headers, a four-pin header is added. This enables Power over Ethernet (PoE),
which delivers the required electrical current to the device using data cables rather than
power cords. It's really beneficial and cuts down on the amount of cords needed to
install a gadget in a given project. Only in the presence of a PoE hat does PoE work.
• A 40-pin header is utilised to connect the electronic gadget to the outside world. This
is identical to prior versions, making it compatible with any devices that support past
versions.
• Of the 40 pins, 26 are used as digital I/O pins, and 9 of the remaining 14 are
designated as dedicated I/O pins, indicating that they have no other function.
• Pins 3 and 5 have an inbuilt 1.8 kΩ resistor, while Pins 27 and 28 are allocated to the
ID EEPROM.
• The GPIO header has been significantly moved in the B+ variant to make room for
the additional mounting hole.
• Devices that function with the B model may work with the B+ version, however they
may not sit exactly the same as the prior version.
15
Fig: 4.3 Raspberry Pi pin diagram
CPU: The CPU is the little computer's brain, assisting in the execution of a variety of
instructions based on mathematical and logical principles. It has a 64-bit storage
capacity.
Clock Speed and RAM: It has a 1.4 GHz Broadcom BCM2837B0 processor with quad-
core ARM Cortex-A53 processor and 1GB of RAM memory (identical to the previous
version)
GPU: GPU stands for graphics processing unit, which is used to calculate images. The
gadget that is primarily used for playing video games has a Broadcom video core cable
installed.
HDMI and Composite Connection: Both the audio output socket and the video
composite socket have been combined into a single 4-pole 3.5mm socket near HDMI.
In the new B+ model, the power connector has been moved adjacent to the HDMI plug.
All of the power and audio video composite sockets are now on one side of the PCB,
giving it a neat and tidy appearance.
16
USB Hard Drive: The USB hard drive is accessible from the board that is used to boot
the device. It's the same as a typical computer's hard disc, except that Windows is
used to boot the computer's hard drive.
USB Ports: This new version adds two more USB ports, removing the need for an
external USB hub for connecting multiple peripherals to the device.
Micro-USB Power Source Connector: This connector is used to supply the board with
5V power. It consumes 170 to 200 milliamps more than the B model.
PoE: The B+ model has a Power over Ethernet (PoE) function, which is a novel feature
in this device that allows the necessary electrical current to be delivered via data lines.
Other Changes: The B+ version offers little in the way of new functionality and has a
slightly altered layout in terms of component placement. A tiny SD memory card slot
replaces the SD memory slot (works similar to the previous version). The status LEDs
have been relocated to the opposite end of the PCB and are now simply red and green
in colour.
• Gigabit Ethernet
• This device has a crucial feature called PoE (power over Ethernet) that the B
model does not have.
17
• Micro SD socket for expanding the board's memory capacity
• HDMI
• WiFi and Bluetooth capabilities not found in prior Raspberry Pi 1 and 2 models
4.4.6.5 Applications
• Tablet Computer
• Home Automation
• Controlling Robots
• Coffee Projects
• Arcade Machine
• Media Streamer
• Internet Radio
• Cosmic Computer
18
Fig: 4.4 Ultrasonic sensor
A transmitter and receiver are included with the HC-SR04 ultrasonic sensor.
This sensor is used to determine the distance between the target and the sensor. The
distance between the sensor and an object is determined by the amount of time it takes
to transmit and receive the waves. Using non-contact technology, this sensor detects
sound waves. The required distance for the target may be measured without causing
damage using this sensor, and accurate details can be obtained. This sensor has a
range of 2 to 400 centimeters. The HC-SR04 is an ultrasonic sensor that uses sonar
19
to determine the distance between the sensor and the object it detects. It has a wide
range of non-contact detecting capabilities, as well as high accuracy and consistent
readings. Ultrasonic transmitter and receiver are two of the modules included. This
sensor can be found in a wide range of applications, including direction and speed
measurement, intruder alarms, medical, sonar, humidifiers, wireless charging, non-
destructive testing, and ultrasonography.
• Pin1 (Vcc): This pin provides the sensor with a +5V power source.
• Pin2 (Trigger): This is an input pin that is utilised to start the measurement by
emitting ultrasonic waves for 10 seconds.
• Pin3 (Echo): This is an output pin that goes high for a set amount of time,
which is equal to the time it takes for the wave to return to the sensor.
• Pin4 (Ground): This is a GND pin that connects to the system's GND.
4.4.7.2 Features
• Resolution: 0.3 cm
• Accuracy: 3mm
20
4.4.7.3 HC-SR04 Ultrasonic Sensor Working
HC-SR04 has 4 pins: Vcc, Trigger, Echo, and Ground. This sensor is used to
determine the precise distance between the sensor and the target. This sensor is
mostly used to detect sound waves.
When this module is given power, it emits sound waves that travel through the
air and strike the required object. These waves strike and return from the object, which
the receiver module catches. Because the time required to travel a greater distance is
longer, both the distance and the time spent are directly related. When the trigger pin
is held high for 10µs, ultrasonic waves are generated that travel at the speed of sound.
As a result, it generates eight cycles of sound bursts, which are collected within the
Echo pin. This ultrasonic sensor is connected to an Arduino board to determine the
required distance between sensor and object. The following formula can be used to
calculate the distance.
S = (V x t)/2
S - required distance
V - sound’s speed
t - time taken for sound waves to return back after striking the object.
Because the time it takes for the waves to travel and return from the sensor is twice
as long, the real distance can be estimated by dividing the value by two.
21
Fig: 4.6 Ultrasonic sensor description
22
CSI connection. It can record 1080p HD video at 30 frames per second or give a crystal
clear 5MP quality photograph. The Raspberry Pi Camera Board has a 5MP (2592*1944
pixels) Omnivision 5647 sensor in a fixed focus module that was custom designed and
produced by the Raspberry Pi Foundation. The module connects to the Raspberry Pi
via a 15-pin ribbon cable to the unique 15-pin MIPI Camera Serial Interface (CSI),
which was built specifically for camera interface. The CSI bus, which is capable of
exceptionally high data speeds, is used to carry pixel data to the BCM2835 processor
entirely. The board is small, measuring roughly 25mm x 20mm x 9mm and weighing
just over 3g, making it ideal for mobile and other applications where size and weight
are critical. The sensor itself features a fixed focus lens and a native resolution of 5
megapixels. The camera can capture static photographs with a resolution of 2592 x
1944 pixels and can record video in 1080p @ 30fps, 720p @ 60fps, and 640x480p
60/90. Raspbian, the Raspberry Pi's chosen operating system, now includes support
for the camera.
23
Fig: 4.8 L298N Motor Driver Board
24
Fig: 4.9 Details of Motor Driver- L298N
• CSA: This is the current test pin for motor A; it can be wired with a resistor for current
testing or disabled with a jumper.
• CSB: This is the current test pin for motor B; it can be linked with a resistor for current
testing or disabled with a jumper.
• VMS: VMS is the motor's 5V-35V power supply. GND is negative, while VMS is
positive.
• 5V: The logic circuit on the board receives power from this source.
• 5V-EN: Jumper for a 5V source. When the jumper is set, the 78M05 draws 5V from
the VMS port to power the logic circuit on the board (7V <VMS <18V). When this jumper
is turned off, the 5V port supplies power to the board's logic circuit.
• U1/2/3/4: IN1/2/3/4 pull-up resistor When the jumper is on, the microcontroller's pull
up resistor is enabled; when it is off, the microcontroller's draw up resistor is disabled.
• EA/EB: EA/EB is the enable pin for the two motors A/B, and the PWM of this pin can
also regulate the motor speed.
25
• IN1/2/3/4: IN1/2/3/4 is the motor control pin. Motor B is identical to Motor A.
To regulate the rotation direction, however, we just need to reverse the direction
of the current flow through the motor, which is most commonly accomplished using an
H-Bridge. An H-Bridge circuit is made up of four switching devices, such as transistors
or MOSFETs, with the motor in the middle, producing a H shape. We can change the
direction of the current flow and consequently the rotation direction of the motor by
activating two specific switches at the same time. We can have complete control over
the DC motor if we combine these two technologies, PWM and H-Bridge. Many DC
motor drivers have these characteristics, and the L298N is one of them.
4.4.10 DC Motors
26
Fig: 4.11 DC motor
If we stretch out the first, second, and thumb of our left hand perpendicular to
each other, the first finger signifies the magnetic field, the second finger signifies the
current, and the thumb signifies the force experienced by the current carrying
conductor. When armature windings are coupled to a DC supply, they generate an
electric current. Field winding (electromagnetism) or permanent magnets can be used
to generate a magnetic field. As per the above-mentioned principle, current-carrying
armature conductors are subjected to a force by the magnetic field. To achieve
unidirectional torque, the commutator is segmented. Or else, the direction of the force
would have reversed every time the conductor's movement in the magnetic field was
reversed.
27
4.4.10.2 Back Emf
The magnitude of the back emf is related to the motor's speed. Consider a dc
motor whose load is abruptly lowered. The required torque will be little in comparison
to the current torque in this instance. Due to the additional torque, the motor's speed
will begin to increase. As a result, because the back emf is related to the speed, the
magnitude of the back emf will likewise grow. The armature current will start to
decrease as the back emf increases. Because torque is related to armature current, it
will decrease until it is adequate for the load. As a result, the motor's speed will be
regulated. When a dc motor is quickly loaded, however, the load causes the speed to
decrease. Back emf will drop as speed decreases, allowing greater armature current.
To meet the load demand, increased armature current will increase torque. As a result,
the presence of the back emf causes a dc motor to self-regulate.
A gear motor combines a motor and a gearbox into one unit. When a gear head
is added to a motor, the speed is reduced but the torque output is increased. In terms
of gear motors, the most significant criteria are speed (rpm), torque (lb-in), and
efficiency (percent). To choose the best gear motor for your application, you must first
calculate the load, speed, and torque requirements for your application. ISL Products
has a wide range of Spur Gear Motors, Planetary Gear Motors, and Worm Gear Motors
28
to satisfy your needs. Most of our DC motors can be combined with one of our one-of-
a-kind gearheads to create a highly efficient gear motor solution.
4.4.11 Esp32-Wroom
29
management modules. Espressif Systems, a Shanghai-based Chinese firm, designed
and developed the ESP32, which is produced by TSMC using their 40 nm technology.
It is the ESP8266 microcontroller's replacement.
30
Fig: 4.14 Esp32-Wroom pin diagram
31
Fig: 4.15 7-INCH HDMI LCD
The 7-inch HDMI LCD supports a variety of systems, including Raspberry Pi,
Banana Pi, Banana Pro, and BB Black, and can display Lubuntu, Raspbian, and
Angstrom images with a high resolution of 1024x600 pixels and a capacitive Touch
Screen. It can be used on a Raspberry Pi, an HDMI display screen, or any other tiny
PC or computer display. No input and outputs are required for displaying and the driver
is included (works with custom Raspbian directly). Backlight control to reduce power
consumption while maintaining good immersion quality surface coated in gold. It has
HDMI output and is software configurable up to 1920x1080. It works with Raspberry
Pi, Jetson Nano, BB Black, and Banana Pi tiny PCs, as well as standard desktop
computers.
Raspberry Pi supports Raspbian /Ubuntu /Kali /Retropie /WIN10 IoT without the
need for drivers. Supports Windows 10/8.1/8/7, five-point touch, and is driver-free in a
computer monitor. It is compatible with gaming consoles such as Microsoft's Xbox 360,
Sony's PlayStation 4, and Nintendo's Switch, among others. OSD menu with multi-
language options for power management, brightness/contrast adjustments, and more.
4.4.12.1 Specifications
• Frequency: 60Hz
32
• Vcc: 4.7-5v
1. OpenCV
2. Python
3. Embedded C
4.5.1 OpenCV
33
extensively. OpenCV's applications range from stitching street view images together to
detecting intrusions in surveillance tape in Israel, tracking mine machinery in China,
assisting Willow Garage robots in navigating and picking up objects, designed to detect
swimming pool drowning collisions in Europe, running engaging art in Spain and New
York, inspecting airstrips for debris in Turkey, and quick facial recognition in Japan. It
works with windows, Linux, Android, and Mac OS and offers C++, Python, Java, and
MATLAB. When MMX and SSE instructions are accessible, OpenCV tends to rely
toward real-time vision applications. CUDA and OpenCL interfaces with full
functionality are currently being developed. Over 500 algorithms exist, with roughly ten
times as many functions that compose or support them. OpenCV is written in C++ and
provides a templated interface that integrates with STL containers elegantly.
4.5.2 Python
34
method to debug a programme: the fast edit-test-debug cycle makes this simple
approach quite successful.
Python's clear and basic syntax attracts newcomers who desire to learn this
scripting language. From some angles, it may appear logical and predetermined that
Python will become the de facto coding language, rendering all of its competitors
obsolete. Its code is simple to understand, distribute, and update. There is no overuse
of words, and the language is simple to pick up.
Python programmes are text files that provide instructions for the interpreter and
are written in a text editor or integrated development environment (IDE). Text editors
do not generally include IDE functions, but they can be altered. IDEs are full-featured
and include in-built tools such as syntax checks, debuggers, and code browsers.
Python also comes with a plethora of third-party packages, libraries, and frameworks
to help with development. Python is therefore ideal for large-scale applications due to
its optimization capabilities.
Here, we're talking about company speed and the time-to-market statistic.
Python is a dynamic scripting language, which means it's not designed for developing
applications from the ground up, but rather for connecting components. The interfaces
between components and scripts are well-defined, and components are designed to
be reusable. It all helps to speed up software development by making Python a highly
concise and productive language. Despite the fact that Python prioritizes code
simplicity and readability over flexibility, the language nonetheless possesses it. Python
may be used in a variety of projects. It gives programmers the option of using object-
oriented or procedural programming techniques. Python is also versatile when it comes
to data types. Number, String, List, Tuple, and Dictionary are the five root types, and
each sub-data type corresponds to one of them. As a result of Python's versatility,
conducting exploratory data analysis becomes easier.
35
Python was created with portability in mind. Its programmes run on any modern
computer operating system. Python scripts are interpreted because of the high-level
nature of the language, therefore they may be written for further interpretation on Linux,
Windows, Mac OS, and UNIX without requiring any changes. Python applications can
also be used to create portable user interfaces. Python has a constantly rising user
base and exemplifies what a strong community looks like. Python's sophisticated toolkit
has hundreds of contributors — Pythonists. Users have already contributed around
200,000 custom-built software programmes to an online repository. All of this means
that the large supportive community is both the cause and the result of the language's
popularity.
4.5.3 Embedded C
• Simple to comprehend
• Exceptional Reliability
• Portability
• Scalability
36
rigorously regulated. All essential device drivers must be included in the embedded
package at the time of manufacture; therefore device drivers are created specifically
for the hardware. The mainframe and individual chips chosen are very important to the
package. Most embedded package engineers have at least a passing knowledge of
reading schematics and knowledge sheets for components to see how registers and
communication systems are used. Conversion among decimal, hex, and binary is also
advantageous, as is bit manipulation. The ability to communicate between CPUs and
other components is critical. I2C, SPI, serial ports, and USB are all typical protocols in
addition to direct memory access. Firms such as Inter Niche Technologies and CMX
Systems offer closed source communications protocols for embedded systems. uIP,
lwip, and other open-source protocols are examples. A keyword is a word that has a
particular meaning for the compiler (a C Compiler for example, is a software that is
used to convert programme written in C to Machine Code). For example, some of the
keywords in the Keil's Cx51 Compiler (a popular C compiler for 8051 based
Microcontrollers) are as follows:
• bit
• sbit
• sfr
• small
• large
Along with the conventional C Keywords, these are only a few of the many keywords
linked with the Cx51 C Compiler.
37
CHAPTER 5
38
Fig: 5.1 Assembled model
It is required to explore and acquire facts that can be utilised to feed the machine
after creating the problem statement. This is a crucial step in the process of building
an ML model because the amount and quality of data used will determine the model's
effectiveness. Data can be extracted from existing databases or created from scratch.
The data preparation stage involves profiling, formatting, and structuring data in
order to prepare it for model training. This is the point at which the proper data traits
and attributes are chosen. This stage will very certainly have a direct impact on the
execution time and outcomes. This is also the point at which data is divided into two
39
groups: one for training the machine learning model and the other for evaluating it. At
this stage, data is pre-processed by normalising, removing duplicates, and correcting
errors.
The "validation dataset" will be used to test the machine model. This aids in
determining the model's correctness. For justifying correlation, identifying the
measurements of success based on what the model is designed to achieve is crucial.
40
5.3 DECISION TREE IN AI
41
❖ Step 3: Color conversion
❖ Step 8: Integrate
In this step, OpenCV and numpy is imported, then math library is imported for
mathematical calculations. Serial library is also imported for serial communications
between Raspberry Pi and Esp32.
import cv2
import numpy as np
import math
import serial
The Raspberry Pi camera module gives input to the Raspberry Pi. The given
input will be in the form of video, then this video is converted to images and saved.
image = cv2.imread(r'C:\Users\****\Desktop\new1.jpeg')
42
Fig: 5.3 Raspberry Pi camera captured image
The image is in RGB form. This RGB is converted into grayscale image.
Because for a small image it will have high set of values if not converted to Grayscale
image from RGB. There are three color channels and three dimensions in RGB images,
whereas grayscale images are one-dimensional. The RGB photos of 10x10x3 pixels
were used to train the neural article. There will be 300 input nodes in the input layer.
For grayscale photos, however, the same neural network will only require 100 input
nodes. Many algorithms have been tweaked to only function with grayscale photos. In
RGB we will have to compare it for R, G and B. In grayscale we have to compare it
only one time.
43
Fig: 5.4 RGB into grayscale converted image
# given input image, kernel width =5 height = 5, Gaussian kernel standard deviation
k_width = 5
k_height = 5
blurred = cv2.GaussianBlur(gray, (k_width, k_height), 0)
44
Fig: 5.5 Blurred image
45
Step 6: Find lines
In this step it determines whether the robot need to turn left or right according
to the detections made in previous steps. After edge detection and line detection the
robot makes a decision to turn left or right using machine learning technology.
46
Fig: 5.8 Line detection
For taking the coordinate of first line this line of code can be used
47
Fig: 5.9 Deciding whether to turn right or left or straight
Step 8: Integrate
Then the robot moves to the desired destination by these algorithms. It also
detects for any obstacles in its path.
48
Fig: 5.11 Flowchart of Program flow
49
CHAPTER 6
CONCLUSION
The proposed system gives the desired output through AI and ML. The scope
of the proposed methodology lies in achieving an efficient robot that completes the task
effectively. The use of this robot improves workplace safety in a number of ways. For
starters, they can accomplish tasks that humans might consider unsafe. Second, they
run in a smooth, regulated manner, reducing the chances of human-operated vehicles
damaging other workers. Furthermore, improved workplace safety can lower costs and
save money by minimizing the amount of harm that human operators can cause. This
technology is designed to be precise and accurate. Of course, robots can make
mistakes, but when compared to human errors, the chances of making a mistake are
quite low.
50
REFERENCES
[2]Sagar Shetty, Aman Bhavsar, Mahesh Mergu, Ajay Talekar, “Line Following Robot
Using Image Processing”, Third International Conference on Computing
Methodologies and Communication ICCMC, March 2019.
[3]Chun-fei hsu, Chien-ting su, Wei-fu kao, Bore-kuen lee, “Vision-based line-
following control of a two-wheel self-balancing robot”, International Conference on
Machine learning and Cybernetics, China, July 2018,
doi:10.1109/icmlc.2018.8526952.
[7]Daping Jin , Zheng Fang, Jiexin Zeng, “A Robust Autonomous Following Method
for Mobile Robots in Dynamic Environments”, IEEE Access, Vol. 8, pp: 150311 -
150325, August 2020.
[8]Yasir A, Aiman Salim, Arya Dileep, Anjana S, “Autonomous Car using Raspberry
PI and ML”, International Journal of Recent Technology and Engineering (IJRTE),
Vol. 9 No. 2, July 2020.
51