0% found this document useful (0 votes)
12 views14 pages

Report

The document outlines the design and implementation of a Distance Measurement System using an Arduino Uno and an ultrasonic sensor (HC-SR04). It details the project objectives, hardware and software descriptions, and the methodology for both simulation and practical implementation. The system aims to measure distances accurately and display the results on an LCD, with applications in various fields such as robotics and obstacle detection.

Uploaded by

groupkvrn
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 (0 votes)
12 views14 pages

Report

The document outlines the design and implementation of a Distance Measurement System using an Arduino Uno and an ultrasonic sensor (HC-SR04). It details the project objectives, hardware and software descriptions, and the methodology for both simulation and practical implementation. The system aims to measure distances accurately and display the results on an LCD, with applications in various fields such as robotics and obstacle detection.

Uploaded by

groupkvrn
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

CONTENTS

SL No. Heading Page No.

1 Notations 3

2 List of Figures 4

3 Abstract 5

4 Objectives 6

5 Project Summery 6

6 Introduction 7

7 Block diagram of Proposed System 7

8 Components Required 8

9 A. Hardware Description
9-20
Description of Hardware And Software
B. Software Description 21

10 Project Development A. Simulation Project 22-25

(Methodology --- Code , Circuit


Diagram/View ,Implementation) B. Practical Project 26-30

1 Application 30

12 Conclusion 31

13 Future Scope 31

14 References 32
Abstract
Distance measurement of an object in the path of a person, equipment, or a vehicle, stationary or moving is
used in a large number of applications such as robotic movement control, vehicle control, blind man’s walking
stick, medical applications, etc. Measurement using ultrasonic sensors is one of the cheapest among various
options. In this project Distance Measurement System is made using ultrasonic transmitter, receiver and a
microcontroller is presented. This sensor can be easily interfaced with Arduino or NodeMCU or any other
microcontroller and requires only 8 to 10 line code to measure the distance through air.

Key Words -Distance Measurement , Ultrasonic Sensor, Arduino, Obstacle detection


Objectives
In this project I am going to design a distance measurement system using Arduino Uno and a Ultrasonic Sensor
HC [Link] will see how it can be implemented and how it will measure the distance . Here we will do the
simulation part on the tinkercad online platform and also do the practical implementation with hardwares. we
will display the measured distance by using a crystal display.

Project Summery
Here we will do the simulation part on the tinkercad online platform and also do the practical implementation
with hardwares to make a Distance Measurement System. We will write the program and accordingly we will
make the circuits connections and finally measured distance will be shown on the crystal display . Finally we
will see the various practical field where this project can be used.
1. Introduction
Distance measurement of an object in front or by the side of a moving entity is required in a large number of
devices. These devices may be small or large and also quite simple or complicated. Such distance measurement
systems are available. These use various kinds of sensors and systems. Low cost and accuracy as well as speed is
important in most of the applications. In this paper, we describe such a measurement system which uses
ultrasonic transmitter and receiver units mounted at a small distance between them and microcontroller based
system. This microcontroller is very easily available at low cost. A correlation is applied to minimize the error in
the measured distance. Ultrasound sensors are very versatile in distance measurement. They are also providing
the cheapest solutions. Ultrasound waves are useful for both the air and under-water . Ultrasonic sensors are
also quite fast for most of the common applications. In simpler system a low cost version of 8- bit
microcontroller can also be used in the system to lower the cost.

2. Block Diagram of the Proposed System

Power supply

Figure -2.1
3. Components Required
Sl No. Name Specification Quantity Price(Rs.)

1 Arduino Uno Board ATmega328 microcontroller 1 400

2 Ultrasonic Sensor HC-SR04 1 75

3 LCD Module 16*2 display / ic2 interface 1 300

4 Bread Board 5*17 cm2 1 70

5 Jumper wires Male to Male 8 20

Table-01 –Components Specifications

Figure-3.1
4. Description of Hardware And Software

A. Hardware Descpription

1. Arduino Uno Board

Introduction
Arduino refers to an open-source electronics platform or board and the software used to program it. An
Arduino board can be purchased preassembled or, because the hardware design is open source, built by hand .
A pre-assembled Arduino board includes a microcontroller, which is programmed using Arduino programming
language and the Arduino development environment. Arduino programming language is a simplified from of
C/C++ programming language based on what Arduino calls "sketches," which use basic programming
structures, variables and functions. These are then converted into a C++ program.

Hardware
Arduino is open-source hardware. Most Arduino boards consist of an Atmel 8-bit
AVR microcontroller (ATmega8, ATmega168, ATmega328, ATmega1280, ATmega2560) with varying amounts of
flash memory, pins, and features. We have arduino with ATmega 328.

ATmega328
The ATmega328 is a single-chip microcontroller created by Atmel in the megaAVR family.

Specification
The Atmel 8-bit AVR RISC-based microcontroller combines 32 kB ISP flash memory with read-while-write
capabilities, 1 kB EEPROM, 2 kB SRAM, 23 general purpose I/O lines, 32 general purpose working registers,
three flexible timer/counters with compare modes, internal and external interrupts, serial programmable
USART, a byte-oriented 2-wire serial interface, SPI serial port, 6-channel 10-bit A/D converter (8-channels
in TQFP and QFN/MLF packages), programmable watchdog timer with internal oscillator, and five software
selectable power saving modes. The device operates between 1.8-5.5 volts. The device achieves throughput
approaching 1 MIPS per MHz.
Figure-4.A.2

More Details About Arduino uno- Click

2. Ultrasonic Sensor(HC SR-04)

Introduction

The HC-SR04 Ultrasonic Distance Sensor is an inexpensive device that is very useful for robotics and test
equipment projects. This tiny sensor is capable of measuring the distance between itself and the nearest solid
object. An ultrasonic sensor is a device that is generally used to measures the distance to an object and object
detection using ultrasonic sound waves. The sensor head transmits an ultrasonic wave and receives the wave
reflected from the object. Ultrasonic Sensors measure the distance to the object by calculating the time
between the transmission and reception.

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

The HC-SR04 can be hooked directly to an Arduino or other microcontroller and it operates on 5 volts.
This ultrasonic distance sensor is capable of measuring distances between 2 cm to 400 cm. It’s a low current
device so it’s suitable for battery powered devices. This device is widely used in SONAR systems.
The illustration below shows the dimensions of the HC-SR04 Ultrasonic Distance Sensor as well as the
effective angle of operation. As you can see the sensor is most accurate when the object to be detected
is directly in front of it but you do get a response from objects within a 45 degree “window”. The
documentation recommends confining that window to 30 degrees (15 degrees on either side) for
accurate readings.

Figure-4.A.7
More details about HC SR04- Click

3. LCD Module
Figure-4.A.8 Top View

The I2C 16×2 Arduino LCD Screen is using an I2C communication interface. It is able to display 16×2 characters
on 2 lines, white characters on blue [Link] display overcomes the drawback of LCD 1602 Parallel LCD
Display in which you’ll waste about 8 Pins on your Arduino for the display to get working. Luckily in this product,
an I2C adapter is directly soldered right onto the pins of the display. So all you need to connect are the I2C pins,
which shows a good library and little of coding.

The I2C is a type of serial bus developed by Philips, which uses two bidirectional lines, called SDA (Serial Data
Line) and SCL (Serial Clock Line). Both must be connected via pulled-up resistors. The usage voltages are
standard as 5V and [Link] you already have the I2C adapter soldered onto the board like in this product, the
wiring is quite easy. You should usually have only four pins to hook up. VCC and GND of course. The LCD display
works with 5 Volts. So we go for the 5V Pin.

Figure-4.A.9 Back Side

The values shown on the display can be either a simple text or numerical values read by the sensors, such as
temperature or pressure, or even the number of cycles that the Arduino is performing.
pins. The color of all four wires will be different but the exact color might vary from that of the
picture. These male to male jumper wires are of good quality, reusable and has an approximate length of 20cm.

Specifications of Male to Female Connecting Wires

 1 x 20cm male to female breadboard connecting wires

 Easy to plug in

 Durable, Flexible

 Multiple Colours

 Jumper wire size : 26 AWG


 Current Rating : up to 1 A
 Insulation Type: PVC

Figure -4.A.11
B. SOFTWARE DESCRIPTION

Arduino IDE

Introduction
Arduino consists of both a physical programmable circuit board (often referred to as a microcontroller) and a
piece of software, or IDE (Integrated Development Environment) that runs on your computer, used to write and
upload computer code to the physical board.

Programming Language used

First, the Arduino compiler/IDE accepts C and C++ as-is. In fact many of the libraries are written in C++. Much of
the underlying system is not object oriented, but it could be. Thus, "The arduino language" is C++ or C.

Getting started with Arduino ide

Figure-4.B.1

1. Open arduino 1.8.13


2. Go to file menu and select new page.
3. Write program.
4. Compile
5. Upload program to arduino.
5. Project Development

A. Simulation Project-

First the code is written for this project and then the circuit connection is made accordingly on Tinkercad
online simulation platform.

Methodology-

 Simulated Code

*/

#include <LiquidCrystal.h> // includes the LiquidCrystal Library

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;

long duration;

int distanceCm, distanceInch;

void setup() {

[Link](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);

}
void loop() {

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distanceCm= duration*0.034/2;

distanceInch = duration*0.0133/2;

[Link](0,0); // Sets the location at which subsequent text written to the LCD will be displayed

[Link]("Distance: "); // Prints string "Distance" on the LCD

[Link](distanceCm); // Prints the distance value from the sensor

[Link](" cm");

delay(10);

[Link](0,1);

[Link]("Distance: ");

[Link](distanceInch);

[Link](" inch");

delay(10);

}
 Schematic Diagram

Figure-5.A.1 -- Simulated System

Simulated Circuit in Tinkarcad

Name Quantity Component


U1 1 Arduino Uno R3
U2 1 LCD 16 x 2
R1 1 1 kΩ Resistor
DIST1 1 Ultrasonic Distance Sensor

 Implementation

 Now for the simulation part first we take a wire and connect it with 5V pin and connect the other end
to the positive rail of breadboard.
 Next we take another wire and connect it to the ‘GND’ pin of Arduino and we connect the other port to
negative rail of the breadboard.
 After that we connect ‘Vcc’ and ‘GND’ pin of both ultrasonic sensor and display module to the positive
and negative rail of the breadboard respectively.
 Next we connect the trigger pin of ultrasonic sensor to ‘pin 9’ of Arduino board and we connect the
echo pin of ultrasonic sensor pin of ultrasonic sensor to ‘pin 10’ of Arduino board. And hence the
connection of Arduino is completed.
 Next we write the code under CODE section on the tinkercad simulator and run it over this platform.
 We find the measured distance on the LCD display in cm as well as in inch. .

You might also like