0% found this document useful (1 vote)
2K views28 pages

Pothole Detection

The document discusses a proposed pothole detection and warning system for vehicles in India. It aims to reduce road accidents caused by potholes, especially during monsoons when they can be difficult to see. The system would use ultrasonic sensors to detect the distance to potholes and alert drivers with visual displays and audible warnings before they reach the potholes. The system is intended to improve road safety and reduce the number of accidents.

Uploaded by

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

Pothole Detection

The document discusses a proposed pothole detection and warning system for vehicles in India. It aims to reduce road accidents caused by potholes, especially during monsoons when they can be difficult to see. The system would use ultrasonic sensors to detect the distance to potholes and alert drivers with visual displays and audible warnings before they reach the potholes. The system is intended to improve road safety and reduce the number of accidents.

Uploaded by

Swati Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

ABSTRACT

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.

 Origin of the proposal

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

The design may bring the change in following ways:-

 It will alert the driver prior to the approach of pothole


 It will reduce the number of road accidents during monsoon
 It will direct a safe driving in low light areas

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

1.1 Block Diagram

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.

The hardware used in this project are:

1. Arduino UNO R3
2. Ultrasonic Sensor
3. 16*2 LCD display
4. Buzzer
5. Bread board
6. Jumper Wires
7. Potentiometer

The software used is:

 Arduino IDE

A detailed description of the components is given below:

2.1 Arduino UNO R3

The Arduino UNO is an open-source microcontroller board based on


the Microchip ATmega328P microcontroller and developed by Arduino.cc. The board is equipped
with sets of digital and analog input/output (I/O) pins that may be interfaced to various expansion
boards (shields) and other circuits. The board has 14 Digital pins, 6 Analog pins, and
programmable with the Arduino IDE (Integrated Development Environment) via a type B USB
cable. It can be powered by a USB cable or by an external 9 volt battery, though it accepts
voltages between 7 and 20 volts. It is also similar to the Arduino Nano and Leonardo. The
hardware reference design is distributed under a Creative Commons Attribution Share-Alike 2.5

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.

2.1.1 TECHNICAL SPECIFICATIONS

 Microcontroller: Microchip ATmega328P


 Operating Voltage: 5 Volt
 Input Voltage: 7 to 20 Volts
 Digital I/O Pins: 14 (of which 6 provide PWM output)
 Analog Input Pins: 6
 DC Current per I/O Pin: 20 mA
 DC Current for 3.3V Pin: 50 mA
 Flash Memory: 32 KB of which 0.5 KB used by bootloader
 SRAM: 2 KB
 EEPROM: 1 KB
 Clock Speed: 16 MHz
 Length: 68.6 mm
 Width: 53.4 mm
 Weight: 25 g

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.

2.1.2.1 General pin functions

 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.

2.1.2.2 Special Pin Functions

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.

In addition, some pins have specialized functions:

 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.

2.1.4 Automatic (Software) Reset

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.

2.2 Ultrasonic Sensor

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:

1. High level signal is sent for 10us using Trigger.


2. The module sends eight 40 KHz signals automatically, and then detects whether pulse is
received or not.
3. If the signal is received, then it is through high level. The time of high duration is the time gap
between sending and receiving the signal.

Distance= (Time x Speed of Sound in Air (340 m/s))/2

Fig. 2.3 : ULTRASONIC SENSOR HC-SR04

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

Distance= (time x speed)/2.

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

2.3 16*2 LCD display


An LCD is an electronic display module which uses liquid crystal to produce a visible image.
The 16×2 LCD display is a very basic module commonly used in DIYs and circuits.

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:

 Display Mode: STN, BLUB


 Display Format: 16 Character x 2 Line
 Viewing Direction: 6 O’clock
 Input Data: 4-Bits or 8-Bits interface available
 Display Font : 5 x 8 Dots
 Power Supply : Single Power Supply (5V±10%)
 Driving Scheme : 1/16Duty,1/5Bias
 Backlight(Side):LED(Yellow)

Fig 2.4 : 16*2 LCD pin out diagram

12
Fig 2.5 :16*2 LCD Display

2.4 Buzzer

A buzzer is a mechanical, electromechanical, magnetic, electromagnetic, electro-acoustic or


piezoelectric audio signalling device. A piezo electric buzzer can be driven by an oscillating
electronic circuit or other audio signal source. A click, beep or ring can indicate that a button has
been pressed .Piezo speakers (buzzers) A "piezo buzzer" is basically a tiny speaker that you can
connect directly to an Arduino. "Piezoelectricity" is an effect where certain crystals will change
shape when you apply electricity to them. From the Arduino, you can make sounds with
a buzzer by using tone. Typical uses of buzzers and beepers include alarm devices, timers, and
confirmation of user input such as a mouse click or keystroke.

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

2.4.2 Working of 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 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

 Alarming Circuits, where the user has to be alarmed about something


 Communication equipments
 Automobile electronics
 Portable equipments, due to its compact size

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.

Fig. 2.7 : Breadboard

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.

2.6 Jumper Wires

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.

Fig. 2.8: Jumper Wire

2.7 Potentiometer

A potentiometer is a three-terminal resistor with a sliding or rotating contact that forms an


adjustable voltage divider. If only two terminals are used, one end and the wiper, it acts as a
variable resistor or rheostat. Potentiometers are commonly used to control electrical devices such
as volume controls on audio equipment. Potentiometers operated by a mechanism can be used as
position transducers, for example, in a joystick. Potentiometers are rarely used to directly control

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.

2.7.2 Types of Potentiometer

There are two major types:

 Rotary: The most common of variable resistor or potentiometer is a rotary version.


 Slider: Slider controls are those variable resistors that slide in a linear fashion, i.e. in a straight
line

Fig 2.9: Potentiometer

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.

2.8 Arduino IDE

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

 Developer(s): Arduino Software

 Stable release: 1.8.7 / 11 September 2018;

 Written in: Java, C, C++

 Operating system: Windows, macOS, Linux

 Platform: IA-32, x86-64, ARM

 Type: Integrated development environment

The Arduino integrated development environment (IDE) is a cross-platform application


(for Windows, macOS, Linux) that is written in the programming language Java. It originated

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

3.1.1 Ultrasonic sensor and Arduino Board

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.

3.1.2 LCD display and Arduino Board

 VSS and RW pin of display is connected to GND pin of Arduino


 VDD is connected to 5V pin of Arduino
 RS is connected to 1st digital out pin of Arduino
 EN is connected to 2nd digital out pin of Arduino
 D4 is connected to 4th digital out pin of Arduino
 D5 is connected to 5th digital out pin of Arduino
 D6 is connected to 6th digital out pin of Arduino
 D7 is connected to 7th digital out pin of Arduino
 A is connected to 5V pin of Arduino
 K is connected to GND pin of Arduino

3.1.3 Potentiometer and LCD display

VO pin of LCD is connected to middle leg of potentiometer. The other two legs of
potentiometer are connected to 5V and GND.

3.1.4 Buzzer and Arduino

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.

3.1.4 Arduino Code

#include <LiquidCrystal.h>

LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6,
d7)

const int trigPin = 9;

const int echoPin = 10;

const int speakerPin = 11;

long duration;

int distanceCm, distanceInch;

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);

duration = pulseIn(echoPin, HIGH);

distanceCm= duration*0.034/2;

//distanceInch = duration*0.0133/2;

if(distanceCm>0 && distanceCm< )

lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be
displayed

lcd.print("Distance of car: "); // Prints string "Distance" on the LCD

//lcd.print(distanceCm); // Prints the distance value from the sensor

//lcd.print(" cm");

//delay(10);

lcd.setCursor(0,1);

lcd.print("from road ");

lcd.print(distanceCm);

lcd.print("Cm");

delay(10);}

if( distanceCm > ){

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

UTILIZATION AND FURTURE ASPECTS

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

You might also like