Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 17

“ULTRA SONIC DISTANCE METER”

Mini Project-I Report

Submitted in Partial Fulfillment of the Requirements for the


Degree of

BACHELOROF TECHNOLOGY
IN
ELECTRONICS & COMMUNICATION ENGINEERING

By
NIKHIL RAJPUT (16bec172)

Department of Electronics & Communication Engineering


Institute of Technology
NIRMA UNIVERSITY
Ahmedabad 382 481

November 2019
CERTIFICATE
This is to certify that the Major Project Report entitled “ULTRA SONIC DISTANCE METER”
submitted by MR. NIKHIL RAJPUT (16BEC172) towards the partial fulfillment of the requirements
for the award of degree in Bachelor of Technology in the field of Electronics & Communication
Engineering of NIRMA University is the record of work carried out by him/her under our supervision
and guidance. The work submitted has in our opinion reached a level required for being accepted for
examination. The results embodied in this major project work to the best of our knowledge have not
been submitted to any other University or Institution for award of any degree or diploma.

Date:

Name of Guide
Prof. BHUPENDRA FATANIYA

Head of Department
Dr. DHAVAL PUJARA

Department of Electronics & Communication Engg.


Institute of Technology NIRMA University
Ahmedabad

2
Undertaking for Originality of the Work (for all students)

I, NIKHIL RAJPUT, Roll No.(16bec172), give undertaking that the Major Project entitled
“Ultra sonic distance meter” submitted by me, towards the partial fulfillment of the requirements for
the degree of Bachelor of Technology in ELECTRONICS AND COMMUNICATION of Nirma
University, Ahmedabad, is the original work carried out by me and I give assurance that no attempt of
plagiarism has been made. I understand that in the event of any similarity found subsequently with any
other published work or any project report elsewhere; it will result in severe disciplinary action.

Signature of Student

Date:

Place: Ahmedabad

Endorsed by:

(Signature of Internal Guide)


CONTENTS

Chapter Title Page


No. No.
Acknowledgement i
Abstract ii
Index iii
List of Figures Iv

1 Introduction
1.1 Introduction 5
1.2 Necessity of contactless measurement 5

2 Literature Review

2.1 Hardware Description 6

2.2 Circuit Description 11

3 Code Of Ultra Sonic distance measurement

3.1 Code for measurement 12

3.2 Code for different modes of measurement 13


4 Results
Example-1 Distance Measurement 15

Example-2 Additional features 15

Conclusions 16

References 17

LIST OF FIGURES

Fig. No. Title Page


No.
2.1 ARDUINO PIN CONFIGURATION 9

2.2 ULTRASONIC SENSOR PIN OUT 10

2.3 16*2 LCD PIN OUT 11

2.4 CIRCUIT DIAGRAM 11

2.5 RESULT 15
ACKNOWLEDGEMENT

It is indeed a matter of great pleasure and proud privilege to be able to Present this
project on “Ultrasonic Distance Measurement “ The completion of the project work is a
millstone in student’s life and its Execution is inevitable in the hands of guide. I am
highly grateful to Prof. Bhupendra Fataniya Sir for his invaluable guidance and
appreciation and motivation.
ABSTRACT

The project is designed to develop distance measurement system Using ultra sonic waves
and interfaced with arduino .We know that human Audible ranges 20hzto20khz. We can
utilize this frequency range wave through ultrasonic sensorHC-SR04.Theadvantages of
this sensor when interfaced with arduino which is a control and sensing system, a proper
distance measurement can be made with new techniques .This distance measurement
systems can be widely used as range meters and as proximity detectors in industries.
Introduction

1.1 Introduction

The project is designed to develop distance measurement system using ultrasonic waves
and interfaced with arduino .As we know that human audible range is between
20hzto20khz. Hence the system utilizes this frequency range waves through ultrasonic
sensor (HC-SR04). This system is applicable in inaccessible areas wherein traditional
means of measurement cannot be implemented, such as high temperature and pressure
zones. The system is designed as specially for the employed in civil work for the purpose
of measurement which is reliable and accurate.

1.2 Necessity of contactless measurement :-

Conventional Distance measurement systems are highly inefficient as these systems used
IR sensors.IR sensors are very unreliable when they are subjected to different light
condition i.e. low light and under water applications. Hence precise and
fix measurement of low range distance, is the main objective for this project.
2 LITERATURE REVIEW

2.1Hardware Component:-

1 Arduino

Arduino is an open-source hardware and software company, Project and user community
that design and manufactures single board microcontroller s and microcontroller kits for
building digital Devices and interactive objects that can sense and control objects in the
Physical and digital world.

Features
Operating voltage : 5V
Input Voltage (recommended):7-12V
Input Voltage(limits):6-20V
Digital I/OPins:14
AnalogInputPins:6
DC Current per I/OPin:40mA
DCCurrentfor3.3VPin:50mA
2 Ultrasonic Module :-

 HC – SR04 Ultrasonic Module works on the principle of SONAR and is designed


to measure the range of the object in small embedded projects.
 It offers excellent range detection with high accuracy and stable readings. The
operation of the module is not affected by the sunlight or black material

3 16*2 lcd display :-

The LCD dicussed in this section has14pins.The function of each pin is Given above
diagram.

LCD pin Description:-

VCC, VSS and VEE:


While VCC and VSS provide +5V and ground, respectively, VEE is used
For controlling LCD contrast.
RS-Register Select:
There are two important registers inside the LCD. The RS pin is used for Their selection
as follows .If RS=0,the instruction command code Register is selected, allowing the user
to send a command such as clear Display , cursor at home etc. If RS=1 the data registers
is selected, Allowing the users to send data to bed is played on the LCD.
R/W-read/write:
R/W input allows the user to write information to the LCD or read
Information from it .R/W=1whenreading;R/W=0whenwriting.

E-enable:
The enable pin use by the LCD to latch information presented to its data pins ,a high to
low pulse must be applied to this pin in order for the LCD To latch in the data present at
the data pins. This pulse must be a minimum of450nswide.

D0-D7:-
The 8 bit data pins,D0-D7,areusedtosendinformationtotheLCDor
Read the contents of internal registers.
To display letters and numbers ,we send ASCII codes for the letters A-Z,a-z and numbers
0-9 to these pins while making RS=1.

2.3 Circuit diagram

The circuit diagram for the interfacing arduino with


Hardware applicable is shown in the fig.
Code for Ultrasonic Distance Measurement

This code is executed in an open source Arduino IDE software

#include<LiquidCrystal.h>
#definetrigger18
#defineecho19
Liquid Crystal (2,3,4,5,6,7);
Float time=0,distance=0;
Void setup()
{
lcd.begin(16,2);
pinMode(trigger,OUTPUT);
pinMode(echo,INPUT);
lcd.print("Ultrasonic");
lcd.setCursor(0,1);
lcd.print("DistanceMeter");
delay(2000);
lcd.clear();
lcd.print("RangeFinder");
delay(2000);
}
voidloop()
{
lcd.clear();
digitalWrite(trigger,LOW);
delayMicroseconds(2);
digitalWrite(trigger,HIGH);
delayMicroseconds(10);
digitalWrite(trigger,LOW);
delayMicroseconds(2);
time=pulseIn(echo,HIGH);
distance=time*340/20000;
lcd.clear();
lcd.print("Distance:");
lcd.print(distance);
lcd.print("cm");
Page10
lcd.setCursor(0,1);
lcd.print("Distance:");
lcd.print(distance/100);
lcd.print("m");
delay(1000);
}
Code for additional features :-

#include <hcsr04.h>
#include<LiquidCrystal.h>
#define trigPin 18
#define echoPin 19

LiquidCrystal lcd(2,3,4,5,6,7);
float time=0,distance=0,distance2=0,Area=0;

void setup()
{ lcd.begin(16,2);

pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
lcd.print("NIKS CREATION");
delay (2000);
lcd.clear();
lcd.print("Lets measure");
delay(8000);
}
void loop()
{ digitalWrite(trigPin,LOW);
delayMicroseconds(2);

digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
delayMicroseconds(2);

time=pulseIn(echoPin,HIGH);

distance= time*0.034/2;

lcd.clear();
lcd.print("Distance ");
lcd.print(distance );
lcd.print ("cm");
lcd.setCursor(0,1);
lcd.print("Distance:");
lcd.print(distance/100);
lcd.print("m");
delay(10000);

{
digitalWrite(trigPin,LOW);
delayMicroseconds(2);

digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
delayMicroseconds(2);

time=pulseIn(echoPin,HIGH);

distance2 = time*0.034/2;

lcd.clear();
lcd.print("Distance");
lcd.print(distance2 );
lcd.print ("cm");
lcd.setCursor(0,1);
lcd.print("Distance:");
lcd.print(distance/100);
lcd.print("m");
delay(5000);

Area=distance*distance2;
lcd.clear();
lcd.print("Area");
lcd.print(Area);
lcd.print("cm sq");
lcd.setCursor(0,1);
lcd.print("Area");
lcd.print(Area/100);
lcd.print("m sq");
delay(10000);
}
}
Results using serial print

RESULT ON DISPLAY (REAL TIME)


Conclusion

The project gives a comprehensive learning of how a sonar system works besides from
this project we can have hands on arduino. Other than this it helps to learn basic concepts
like interrupt routine of microcontroller and role of different pins of microcontroller
.Besides it also gives a brief learning of ultrasonic sensor and interfacing different in/op
device with arduino.
REFRENCES

[1] www.circuitdigest.com

[2] Ultrasonic Instruments and devices by Emmanuel


P.Papadakis, EISevier academic press

[3]http://www.ndted/EducationResource/CommunityCollege/Ultraso
nic/Introduction?history.html

[4]http://electronics-manufacturing.com/info/Sensorsanddetectors/
Ultrasonic sensor.html

You might also like