Pothole Detection
Pothole Detection
In India, road accidents are majorly caused due to potholes , mainly in monsoon. Potholes can
cause heavy damage to vehicle due to collisions and vibrations in the vehicle. These accidents can
be prevented by the pothole detection and warning system .The proposed system distance from
the vehicle of the potholes and it will generate the alarm through the warning system to alert the
driver . The system will give all the information on LCD display.The proposed project will help in
improving the condition of roads in the country. It will also decrease the number of accidents
which occur mostly when people in high speed take their bike into a pothole.
1
Chapter 1
INTRODUCTION
A pothole is a structural failure in a road surface, usually asphalt pavement, due to water in the underlying
soil structure and traffic passing over the affected area. Water first weakens the underlying soil; traffic then
fatigues and breaks the poorly supported asphalt surface in the affected area. Continued traffic action ejects
both asphalt and the underlying soil material to create a hole in the pavement.
Potholes are depressions on the roads or the structure failure in the road which may cause mishappening.
During monsoon, the roads can be completely filled with water. As the result people are unable to locate
the pothole. This eventually ends into heavy traffic jams and accidents. To prevent this we have proposed
the design of pothole detection and warning system.
Definition of problem
Potholes can be either dry or filled with water. Potholes are usually invisible during monsoon and at night
or in low light and are one of the main reasons for severe accidents. Prior designs of pothole detection
could only detect either the dry potholes or the wet ones. Also they were not capable of warning the driver
in advance. With the proposed design, thedriver’s safety will increase a lot. Hence, this system will help
in preventing fates.
OBJECTIVES
2
WORK PLAN
The project is made in following steps:-
Sensor selection and connection with microcontroller(arduino UNO)
Connection of external buzzer and lcd display on vehicle
Programming of arduino to measure distance of pothole from vehicle.
Display of all the information about pothole on the LCD display screen .
Final calibration and testing of the system
16*2 LCD
DISPLAY
ULTRASONIC ARDUINO
SENSOR UNO
REV3 BUZZER
In our project there are four main components , they are : ultrasonic sensor , arduino UNO rev3 , a
seven segment LCD display and a buzzer. These components work on the instructions given by
the microcontroller .
3
Chapter 2
COMPONENTS’ DESCRIPTION
The project constitutes of the ultrasonic sensor as the main component that detects the distance of
pothole from the vehicle. The Arduino microcontroller UNO Rev3 acts as an interface between
the sensor, LCD display and buzzer. It is programmed in such a way that it gets the value of
distance from the sensor and displays it on the LCD display. If the pothole is detected the buzzer
also alerts the driver.
1. Arduino UNO R3
2. Ultrasonic Sensor
3. 16*2 LCD display
4. Buzzer
5. Bread board
6. Jumper Wires
7. Potentiometer
Arduino IDE
4
license and is available on the Arduino website. Layout and production files for some versions of
the hardware are also available.
"Uno" means one in Italian and was chosen to mark the release of Arduino Software (IDE)
1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference versions of
Arduino, now evolved to newer releases. The Uno board is the first in a series of USB Arduino
boards, and the reference model for the Arduino platform. The ATmega328 on the Arduino Uno
comes pre-programmed with a bootloader that allows uploading new code to it without the use of
an external hardware programmer. It communicates using the original STK500 protocol.
The Uno also differs from all preceding boards in that it does not use the FTDI USB-to-serial
driver chip. Instead, it uses the Atmega16U2 (Atmega8U2 up to version R2) programmed as a
USB-to-serial converter.
5
Fig.2.1 Arduino UNO R3 Board
2.1.2 PINS
A typical microcontroller can have between 6 and 60 pins on it, to which you’re expected to
attach power connections, input and output connections, and communications connections. Every
microcontroller has different configurations for its pins, and often one pin will have more than
one function. This combining of functions on one pin is called pin multiplexing.
Every microcontroller has names for the pins specific to its hardware, but the Arduino application
programming interface (API) provides a set of names for pins and their functions that should work
across all microcontrollers that are programmable with the API. So, for example, A0 will always
be the analog input pin 0, whether you’re on an Uno, 101, MKRZero, MKR1000, or other
Arduino-compatible board. When you connect to the pin with the same function on another board,
your code should operate the same, even though the physical layout of pins is different.
6
Fig. 2.2 General Pin Diagram for Arduino UNO R3 Board
Along with ATmega328P, UNO consists other components such as crystal oscillator, serial
communication, voltage regulator, etc. to support the microcontroller. Arduino Uno has 14 digital
input/output pins (out of which 6 can be used as PWM outputs), 6 analog input pins, a USB
connection, A Power barrel jack, an ICSP header and a reset button.
LED: There is a built-in LED driven by digital pin 13. When the pin is HIGH value, the LED
is on, when the pin is LOW, it's off.
VIN: The input voltage to the Arduino board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You can
supply voltage through this pin, or, if supplying voltage via the power jack, access it through
this pin.
5V: This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 - 20V), the USB connector (5V), or the
VIN pin of the board (7-20V). Supplying voltage via the 5V or 3.3V pins bypasses the
regulator, and can damage the board.
7
3V3: A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50
mA.
GND: Ground pins.
IOREF: This pin on the Arduino board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage and
select the appropriate power source or enable voltage translators on the outputs to work with
the 5V or 3.3V.
Reset: Typically used to add a reset button to shields which block the one on the board.
Each of the 14 digital pins and 6 Analog pins on the Uno can be used as an input or output, using
pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can
provide or receive 20 mA as recommended operating condition and has an internal pull-up
resistor (disconnected by default) of 20-50k ohm. A maximum of 40mA is the value that must not
be exceeded on any I/O pin to avoid permanent damage to the microcontroller. The Uno has 6
analog inputs, labelled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024
different values). By default they measure from ground to 5 volts, though is it possible to change
the upper end of their range using the AREF pin and the analogReference() function.
Serial: pins 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial
chip.
External Interrupts: pins 2 and 3. These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value.
PWM (Pulse Width Modulation) 3, 5, 6, 9, 10, and 11 Can provide 8-bit PWM output with
the analogWrite() function.
SPI (Serial Peripheral Interface): 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins
support SPI communication using the SPI library.
TWI (Two Wire Interface): A4 or SDA pin and A5 or SCL pin. Support TWI communication
using the Wire library.
8
AREF(Analog REFerence): Reference voltage for the analog inputs.
2.1.3 Communication
The Arduino Uno has a number of facilities for communicating with a computer, another Arduino
board, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial
communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the
board channels this serial communication over USB and appears as a virtual com port to software
on the computer. The 16U2 firmware uses the standard USB COM drivers, and no external driver
is needed. However, on Windows, a .inf file is required. The Arduino Software (IDE) includes a
serial monitor which allows simple textual data to be sent to and from the board. The RX and TX
LEDs on the board will flash when data is being transmitted via the USB-to-serial chip and USB
connection to the computer (but not for serial communication on pins 0 and 1). A SoftwareSerial
library allows serial communication on any of the Uno's digital pins.
Rather than requiring a physical press of the reset button before an upload, the Arduino Uno board
is designed in a way that allows it to be reset by software running on a connected computer. One
of the hardware flow control lines (DTR) of the ATmega8U2/16U2 is connected to the reset line
of the ATmega328 via a 100 nanofarad capacitor. When this line is asserted (taken low), the reset
line drops long enough to reset the chip.
Ultrasonic sensors are great tools to measure distance without actual contact and used at several
places like water level measurement, distance measurement etc. This is an efficient way to
measure small distances precisely. In this project we have used an Ultrasonic Sensor to
determine the distance of an obstacle from the sensor. Basic principal of ultrasonic distance
measurement is based on ECHO. When sound waves are transmitted in environment then waves
are return back to origin as ECHO after striking on the obstacle. So we only need to calculate the
travelling time of both sounds means outgoing time and returning time to origin after striking on
the obstacle. As speed of the sound is known to us, after some calculation we can calculate
the distance.
9
Ultrasonic sensor HC-SR04 is used here to measure distance in range of 2cm-400cm with
accuracy of 3mm. The sensor module consists of ultrasonic transmitter, receiver and the control
circuit. The working principle of ultrasonic sensor is as follows:
The module works on the natural phenomenon of ECHO of sound. A pulse is sent for about 10us
to trigger the module. After which the module automatically sends 8 cycles of 40 KHz ultrasound
signal and checks its echo. The signal after striking with an obstacle returns back and is captured
by the receiver. Thus the distance of the obstacle from the sensor is simply calculated by the
formula given as
10
Here we have divided the product of speed and time by 2 because the time is the total time it took
to reach the obstacle and return back. Thus the time to reach obstacle is just half the total time
taken.
2.2.1 Working
The Ultrasonic Sensor sends out a high-frequency sound pulse and then times how long it takes
for the echo of the sound to reflect back. The sensor has 2 openings on its front. One opening
transmits ultrasonic waves, (like a tiny speaker), the other receives them, (like a tiny
microphone). Based on velocity and time thickness can be calculated. For sending sound waves
and receiving echo, ultrasonic sensors, normally called transceivers or transducers will be used.
They work on a principle similar to radar that will convert electrical energy into mechanical
energy in the form of sound, and vice versa.
Ultrasonic sensors can measure the distance to a wide range of objects regardless of shape, color
or surface texture. They are also able to measure an approaching or receding object. By using
“non-contact” ultrasonic sensors, distances can be measured without damage to the object.
2.2.2 Specifications:
Supply voltage- 5 v
Global Current Consumption- 15 mA
Ultrasonic Frequency- 40k Hz
Maximal Range- 400 cm
Minimal Range -3 cm
Resolution -1 cm
Trigger Pulse Width- 10 μs
Outline Dimension -43x20x15 mm
11
The 16×2 translates a display 16characters per line in 2 such lines. These modules are preferred
over seven segments and other multi segment LEDs.
Liquid crystal display screen works on the principle of blocking light rather than emitting
light. LCD's requires backlight as they do not emits light by them. Cathode ray tube draws more
power compared to LCD's and are also heavier and bigger.
2.3.1 Features:
12
Fig 2.5 :16*2 LCD Display
2.4 Buzzer
The vibrating disk in a magnetic buzzer is attracted to the pole by the magnetic field. When an
oscillating signal is moved through the coil, it produces a fluctuating magnetic field which
vibrates the disk at a frequency equal to that of the drive signal
2.4.1 Features
13
Rated Voltage: 6V DC
Operating Voltage: 4-8V DC
Rated current: <30mA
Sound Type: Continuous Beep
Resonant Frequency: ~2300 Hz
Small and neat sealed package
Breadboard and Perf board friendly
There are two types are buzzers that are commonly available. The one shown here 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
14
Fig. 2.6 Buzzer
2.4.2 Applications of Buzzer
2.5 Breadboard
A breadboard is a solderless device for temporary prototype with electronics and test circuit
designs. Most electronic components in electronic circuits can be interconnected by inserting their
leads or terminals into the holes and then making connections through wires where appropriate.
A breadboard is used to build and test circuits quickly before finalizing any circuit design.
The breadboard has many holes into which circuit components like ICs and resistors can be
inserted.
The top and bottom rows (the rows indicated by the blue) and are usually the (+) and (-) power
supply holes and these move horizontally across the breadboard, while the holes for the
15
components move vertically Each hole is connected to the many metal strips that are running
underneath.
A jump wire (also known as jumper, jumper wire, jumper cable, DuPont wire, or DuPont cable –
named for one manufacturer of them) is an electrical wire, or group of them in a cable, with a
connector or pin at each end (or sometimes without them – simply "tinned"), which is normally
used to interconnect the components of a breadboard or other prototype or test circuit, internally
or with other equipment or components, without soldering.
Individual jump wires are fitted by inserting their "end connectors" into the slots provided in a
breadboard, the header connector of a circuit board, or a piece of test equipment. There are
different types of jumper wires. Some have the same type of electrical connector at both ends,
while others have different connectors.
2.7 Potentiometer
16
significant power (more than a watt), since the power dissipated in the potentiometer would be
comparable to the power in the controlled load.
A potentiometer has 3 pins. Two terminals (the blue and green) are connected to a resistive
element and the third terminal (the black one) is connected to an adjustable wiper.
The potentiometer can work as a rheostat (variable resistor) or as a voltage divider.
2.7.1 Principle
The principle of the potentiometer is that: For a wire having uniform area of cross section and
uniform composition, the potential drop is directly proportional to the length of wire. The
above principle is valid when potentiometer is used in comparing the EMF of two cells. the
potential dropped across a segment of a wire of uniform cross-section carrying a constant current
is directly proportional to its length. The potentiometer is a simple device used to measure the
electrical potentials.
17
2.7.3 Applications of Potentiometer
Potentiometers are rarely used to directly control significant amounts of power (more than a watt
or so). Instead they are used to adjust the level of analog signals (for example volume controls
on audio equipment), and as control inputs for electronic circuits. For example, a
light dimmer uses a potentiometer to control the switching of a TRIAC and so indirectly to
control the brightness of lamps.
Preset potentiometers are widely used throughout electronics wherever adjustments must be made
during manufacturing or servicing.
User-actuated potentiometers are widely used as user controls, and may control a very wide
variety of equipment functions. The widespread use of potentiometers in consumer electronics
declined in the 1990s, with rotary encoders, up/down push-buttons, and other digital controls now
more common. However they remain in many applications, such as volume controls and as
position sensors.
A program for Arduino hardware may be written in any programming language with compilers
that produce binary machine code for the target processor. Atmel provides a development
environment for their 8-bit AVR and 32-bit ARM Cortex-M based microcontrollers: AVR Studio
(older) and Atmel Studio (newer).
2.8.1 IDE
18
from the IDE for the languages Processing and Wiring. It includes a code editor with features
such as text cutting and pasting, searching and replacing text, automatic indenting, brace
matching, and syntax highlighting, and provides simple one-click mechanisms to compile and
upload programs to an Arduino board. It also contains a message area, a text console, a toolbar
with buttons for common functions and a hierarchy of operation menus. The source code for the
IDE is released under the GNU General Public License, version 2.
The Arduino IDE supports the languages C and C++ using special rules of code structuring. The
Arduino IDE supplies a software library from the Wiring project, which provides many common
input and output procedures. User-written code only requires two basic functions, for starting the
sketch and the main program loop, that are compiled and linked with a program stub main() into
an executable cyclic executive program with the GNU toolchain, also included with the IDE
distribution. The Arduino IDE employs the program avrdude to convert the executable code into a
text file in hexadecimal encoding that is loaded into the Arduino board by a loader program in the
board's firmware.
Sketch:
A program written with the Arduino IDE is called a sketch. Sketches are saved on the
development computer as text files with the file extension .ino. Arduino Software (IDE) pre-1.0
saved sketches with the extension .pde.
19
Chapter 3
DESIGN PROCEDURE
3.1 CONNECTIONS
The sensor probe is connected to the electronic board that accompanies it. There are four pins on
the board namely: VCC, GND, D9 and D10.
The VCC pin of sensor is connected to the 5 V pin on the Arduino board, GND is connected to
GND pin and the trigger pin of sensor is connection to digital 9th pin and the echo pin is
connected to digital 10th pin of the Arduino board.
VO pin of LCD is connected to middle leg of potentiometer. The other two legs of
potentiometer are connected to 5V and GND.
The positive wire of buzzer is connected to 10th digital out pin of Arduino and the negative wire is
connected to the GND pin of Arduino board.
20
Once all the connections are done, the Arduino UNO R3 board is connected to the computer (or
laptop) for programming.
The programming is done on the Arduino IDE software including the necessary libraries.
#include <LiquidCrystal.h>
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6,
d7)
long duration;
void setup() {
//Serial.begin(9600);
lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width
and height) of the display
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(speakerPin,OUTPUT);
void loop() {
digitalWrite(trigPin, LOW);
21
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
distanceCm= duration*0.034/2;
//distanceInch = duration*0.0133/2;
lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be
displayed
//lcd.print(" cm");
//delay(10);
lcd.setCursor(0,1);
lcd.print(distanceCm);
lcd.print("Cm");
delay(10);}
lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be
displayed
22
lcd.print("POTHOLE at: ");
//delay(10);
lcd.setCursor(0,1);
lcd.print("Distance ");
lcd.print(distanceCm);
lcd.print("Cm");
delay(10);
digitalWrite(speakerPin, HIGH);
else{
digitalWrite(speakerPin, LOW);
23
Fig. 3.1 Screenshots of the code written on Arduino IDE
24
Chapter 4
CIRCUIT DIAGRAM
25
Chapter 5
Working of code
First define the Trig and Echo pins. In this case they are the pins number 9 ,10 and 11 on the
Arduino Board and they are named trigPin, echoPin and speakerPin. Then define a Long variable,
named “duration” for the travel time that will get from the sensor and an integer variable for the
distance.
In the setup you have to define the trigPin and speakerPIN as an output and the echoPin as an
Input and also start the serial communication for showing the results on the LCD screen.
If the object is 10 cm away from the sensor, and the speed of the sound is 340 m/s or 0.034 cm/µs
the sound wave will need to travel about 294 u seconds. But what you will get from the Echo pin
will be double that number because the sound wave needs to travel forward and bounce backward.
So in order to get the distance in cm we need to multiply the received travel time value from the
echo pin by 0.034 and divide it by 2.
26
Chapter 6
The outcome of the system helps the society to be more aware and smart. By using the system a
person can be smart enough while driving on the road. The person will drive safely which is
beneficial for everyone including the driver, passengers, people on foot, municipal authorities etc.
In future , the device can be installed on any vehivle for the safety of vehivle as well as the driver
.
the information gathered by the device could also be saved in a database and can be send to
municipal corporation or road maintenance department so that they could take care of roads more
easily and effectively.
It will eventually bring up the standard of road and will boost up road transport. It also helps in
reducing the number of accidents as stated above.
27
Chapter 7
CONCLUSION
The device made is a smart device which can be very useful for the society. The software used is
the future of the world and in near future this microcontroller as well as software will be a major
contributor towards the construction of the smart society.
28