Distance measurement using ultrasonic sensor
Distance measurement using ultrasonic sensor
The advantages of this sensor when interfaced with arduino which is a control and
sensing system, a pro per distance measurement can be made with new techniques.
Ultrasonic sensors are first rate gear to degree distance without real touch and used at several
places like water degree measurement, distance dimension etc. this is an efficient manner
to measure small distances exactly. on this assignment we've got used an Ultrasonic
Sensor to determine the space of an obstacle from the sensor.
1
INDEX
CONTENTS
Page Numbers
1 INTRODUCTION
1.1 Introduction 3
1.2 Present status in India 3-4
1.3 Status in other countries 4-5
1.4 Novelty of the work 5-6
2 CONFIGURATION Of THE SYSTEM
2.1 Circuit diagram 7
2.2 Components used in the system 7-24
2.3 Working principle 24-25
3 APPLICATIONS OF THE SYSTEM
3.1 Advantages 26-27
3.2 Disadvantages 27-29
3.3 Applications
3.4 32
29-31
4 HARDWARE IMPLEMENTATION
4.0
4.1
5 CONCLUSION
2
CHAPTER – 1
1.0 INTRODUCTION
1.1 INTRODUCTION
Distance measurement of an object in front or by the side of the moving entity is
required in large number of devices. These devices may be small or large and can be quite
simple or complicated. Distance measurement has important applications in automotive and
industrial applications.
The distance measurement through sensors is useful in detecting obstacles. It uses
ultrasonic waves to search an object same as Bats uses sonar technique to communicate with
other bats. Bats are wonderful creatures. Blind from the eyes but the vision is sharper than
Ultrasonic ranging is the technique used by bats. Ultrasonic sensor provides an easy way in
distance measurement. The sensor is perfect for distance measurements between moving or
stationary objects. Ultrasonic Sensor measure the distance of the objects in air through non-
contact technique. They measure distance without damage and are easy to use and reliable.
[5] In order to calculate the distance between the sensor and the object, the sensor measures
the time it takes between the emissions of the sound by the transmitter to its contact with the
receiver. The formula for this calculation is D = ½ T x C (where D is the distance, T is the
time, and C is the speed of sound ~ 343 meters/second). For example, if a scientist set up
an ultrasonic sensor aimed at a box and it took 0.025 seconds for the sound to bounce back,
the distance between the ultrasonic sensor and the box would be,
D = 0.5 x 0.025 x 343 or about 4.2875 meters.
An ultrasonic sensor emits sound waves toward an object and determines its
distance by detecting reflected waves Ultrasonic sensor diagram. (Robo Galaxy)Ultrasonic
sensors are used primarily as proximity sensor
3
Terrestrial Distance Measurement Technologies:
India has adopted a range of distance measurement technologies to enhance precision and
efficiency across different industries:
Laser Distance Sensors: Companies like Baumer India offer laser distance sensors
capable of measuring distances from micrometers up to 60 meters. These sensors are
utilized in applications such as factory automation and the processing of electronic
components.
Ultrasonic and Inductive Sensors: These sensors are employed for precise
measurements of distances, widths, heights, positions, and diameters of objects,
serving various industrial applications.
Laser Displacement Sensors: Offered by companies like KEYENCE India, these
sensors provide high-speed, accurate, and precise measurements of distance and
position, suitable for applications requiring high precision.
Laser Distance Sensors: Micro-Epsilon India provides laser distance sensors
designed for non-contact measurements, with ranges up to 270 meters, used in
machine building and handling equipment.
India has developed its own regional satellite navigation system, NavIC (Navigation
with Indian Constellation), which provides accurate position information over India and
the surrounding region. NavIC is intended to offer an all-weather absolute position
accuracy of better than 7.6 meters throughout India and within a region extending
approximately 1,500 km around it.
The Indian Institute of Surveying & Mapping (IISM) in Hyderabad plays a pivotal
role in advancing surveying and mapping technologies. Established in 1967, IISM offers
training in modern surveying systems, including GPS, electronic distance measurement, and
laser scanning, contributing to the development of spatial data collection methodologies.
4
Terrestrial Distance Measurement Technologies:
Laser Distance Sensors: Companies like Baumer USA provide laser distance sensors
capable of measuring distances from micrometers up to 60 meters. These sensors are
utilized in applications such as factory automation and the processing of electronic
components.
Ultrasonic Distance Sensors: Migatron Corp. offers ultrasonic sensors that can
detect distances to a variety of objects, ranging from small spheres to large rolls of
steel. These sensors are used in industries like petroleum, chemical, and
manufacturing.
Laser Displacement Sensors: KEYENCE America provides laser displacement
sensors designed for non-contact measurements, offering high-speed, accurate, and
precise measurements of distance and position.
The United States utilizes the Global Positioning System (GPS) for distance measurement
applications:
In summary, the United States has established a robust infrastructure for distance
measurement, integrating advanced technologies and research institutions to support various
applications across multiple sectors.
1.4 NOVELTY
The novelty of using an ultrasonic sensor for distance measurement lies in its ability to
accurately measure distances to objects without physical contact by sending out ultrasonic
waves and measuring the time it takes for the echo to return, making it ideal for applications
where non-contact detection is crucial, like obstacle avoidance in robots, liquid level
5
monitoring, and proximity sensing in various environments, all while being relatively
inexpensive and easy to implement compared to other technologies.
a. Non-contact Measurement:
Ultrasonic sensors measure distance by emitting sound waves and measuring the time
it takes for the waves to bounce back from an object. Since there is no physical
contact, this makes them ideal for situations where contact could damage the object or
alter the measurement (e.g., fragile or moving objects).
With advances in technology, modern ultrasonic sensors can provide very precise
measurements, with some systems offering accuracy within millimeters over a
considerable range of distances (e.g., up to 10 meters or more).
These sensors are robust, making them suitable for various environments, including
dusty, dirty, or humid locations. They can be used in a wide range of industries, such
as manufacturing, robotics, and automotive applications, where traditional sensors
might struggle.
d. Cost-Effective:
Ultrasonic sensors are relatively easy to set up and integrate into systems, making
them popular for DIY projects, educational purposes, and industrial automation.
6
g. High Sensitivity to Various Materials:
Ultrasonic sensors can measure the distance to a wide range of materials, including
metals, plastics, and liquids, unlike some other sensors (such as infrared) that are
limited to specific surfaces.
CHAPTER – 2
7
The Uno R3 also adds SDA and SCL pins next to the AREF. In addition, there are
two new pins placed near the RESET pin. One is the IOREF that allow the shields to adapt to
the voltage provided from the board. The other is a not connected and is reserved for future
purposes. The Uno R3works with all existing shields but can adapt to new shields which use
these additional pins.
"Uno" means one in Italian and is named to mark the upcoming release of Arduino
1.0. Preferred quality and originals are made in Italy. The Arduino Uno and version 1.0 will
be the reference versions of Arduino, moving forward. The Uno is the latest in a series of
USB Arduino boards, and there ference model for the Arduino platform.
· Operating Voltage: 5V
· Input Voltage(limits):6-18V
· Analog InputPins:6
· DC Currentfor3.3VPin:50mA
· SRAM: 2KB(ATmega328)
· EEPROM: 1KB(ATmega328)
8
The ATmega328 on the Arduino Uno comes pre burned with a boot loader that allows
you to upload new code to it without the use of an external hardware programmer. It
communicates using the original STK500 protocol (reference, C header files). You can
also by pass the boot loader and program.
This setup has other implications. When the Uno is connected to either a computer
running Mac OS X or Linux, it resets each time a connection is made to it from
software(via USB).For the following half-second or so, the boot loader is running on the
Uno. While it is programmed to ignore malformed data (i.e. anything besides an upload
of new code), it will intercept the first few bytes of data sent to the board after a
connection is opened. If a sketch running on the board receives one-time configuration or
9
other data when it first starts, make sure that the software with which it communicates
waits a second after opening the connection and before sending this data.
Once you have downloaded /unzipped the arduino IDE, you can Plug the Arduino
to your PC via USB cable.
Now you’re actually ready to “burn” your first program on the arduino board. To select
“blinkled”, the physical translation of the well known programming “hello world”, select
>Examples> Digital>Blink
Once you have your sketch you’ll see something very close to the screenshot on the right.
10
In Tools>Board select
Now you have to go to
Tools>Serial Port and select the right serial port, the one arduino is attached to.
LCD DISPLAY
Nowadays, we always use the devices which are made up of LCDs such as CD players,
DVD players, digital watches, computers, etc. These are commonly used in the screen
industries to replace the utilization of CRTs. Cathode Ray Tubes use huge power when
compared with LCDs, and CRTs heavier as well as bigger. These devices are thinner as
well power consumption is extremely less. The LCD 16×2 working principle is, it
blocks the light rather than dissipate. This article discusses an overview of LCD 16X2,
pin configuration and its working.
What is the LCD 16×2?
The term LCD stands for liquid crystal display. It is one kind of electronic display
module used in an extensive range of applications like various circuits & devices
like mobile phones, calculators, computers, TV sets, etc. These displays are mainly
preferred for multi-segment light-emitting diodes and seven segments. The main
benefits of using this module are inexpensive; simply programmable, animations,
and there are no limitations for displaying custom characters, special and even
animations, etc.
16X2 LCD
• Pin1 (Ground/Source Pin): This is a GND pin of display, used to connect the
GND terminal of the microcontroller unit or power source.
11
• Pin2 (VCC/Source Pin): This is the voltage supply pin of the display, used to
connect the supply pin of the power source.
• Pin3 (V0/VEE/Control Pin): This pin regulates the difference of the display,
used to connect a changeable POT that can supply 0 to 5V.
• Pin4 (Register Select/Control Pin): This pin toggles among command or data
register, used to connect a microcontroller unit pin and obtains either 0 or 1(0 =
data mode, and 1 = command mode).
• Pin5 (Read/Write/Control Pin): This pin toggles the display among the read or
writes operation, and it is connected to a microcontroller unit pin to get either 0
or 1 (0 = Write Operation, and 1 = Read Operation).
• Pin 6 (Enable/Control Pin): This pin should be held high to execute Read/Write
process, and it is connected to the microcontroller unit & constantly held high.
• Pins 7-14 (Data Pins): These pins are used to send data to the display. These pins
are connected in two-wire modes like 4-wire mode and 8-wire mode. In 4-wire
mode, only four pins are connected to the microcontroller unit like 0 to 3,
whereas in 8-wire mode, 8- pins are connected to microcontroller unit like 0 to
7.
• Pin15 (+ve pin of the LED): This pin is connected to +5V
• Pin 16 (-ve pin of the LED): This pin is connected to GND.LCD-16×2-pin-
diagram
12
• Is display can work on two modes like 4-bit & 8-bit
• These are obtainable in Blue & Green Backlight
Registers of LCD
A 16×2 LCD has two registers like data register and command register. The RS (register
select) is mainly used to change from one register to another. When the register set is
‘0’, then it is known as command register. Similarly, when the register set is ‘1’, then it
is known as data register.
Command Register
The main function of the command register is to store the instructions of command
which are given to the display. So that predefined tasks can be performed such as
clearing the display, initializing, set the cursor place, and display control. Here
commands processing can occur within the register.
Data Register
The main function of the data register is to store the information which is to be
exhibited on the LCD screen. Here, the ASCII value of the character is the
information which is to be exhibited on the screen of LCD. Whenever we send the
information to LCD, it transmits to the data register, and then the process will be
starting there. When register set =1, then the data register will be selected.
13
• For Hex Code-C0, the LCD command will be Force cursor to the beginning
( 2nd line)
• For Hex Code-38, the LCD command will be 2 lines and 5×7 matrix
ULTRASONICSENSOR
Basics
The Arduino analog input is limited to a 5 VDC input. If you wish to
measure highspeed, you will need to resort to another means. One way is to use a
speed divider. The one discussed here is found all over Amazon and eBay.
Keep in mind, you are restricted to voltages that are less than 25 volts. More than that and
you will exceed the voltage limit of your Arduino input.
Basic Connection
Fig:ULTRASONIC sensor
Inputs
GND – This is where you connect the low side of the voltage you are
measuring. Caution! : This is the same electrical point as your Arduino
ground.
14
VCC: The is where you connect the high side of the voltage you are measuring
Outputs
Trig (Trigger): Sends a short pulse to initiate the ultrasonic wave emission.
o Echo: Receives the reflected ultrasonic wave, with the pulse width
proportional to the distance of the detected object
In this Arduino Project, you will learn how to build an Arduino IR sensor
which can measure the speed of the motor This works as a DC voltmeter with
maximum 12V. As you all know Arduino and few other microcontroller can
measure up to 5V directly from the analog pins, but if you want to measure
the voltage beyond 5V, it is not possible and even if you connect more than
5V the chip may get damaged or burnt. So, with the help of this Voltage
sensor we can measure up to 25V from Arduino Analog pins.
So, in this article we teach you, the principle of this voltage sensing module,
how it works and how to interface it with Arduino and display the voltage
values on 16X2 LCD display with I2C adapter and where it is useful. Required
components:
• Arduino Microcontroller
• Voltage sensor module
• 16X2 LCD display with I2C
• Few connecting wires
Speed Detection sensor Module overview:
This IR sensor is small and low cost module whose principle is based on
With the help of it the two lightes. Arduino AVR chips have 10-bit ADC,
so this module simulates a resolution of 0.00488V (5V/1024),so the
minimum voltage of input voltage detection module is 0.00488Vx5(for
25v)=0.02440V.
• For 5V systems the input voltage should not be greater than 12V
15
• For 3.3V system the input voltage should not be greater than 16.5v as
3.3X5=16.5.Related: Measure AC current by interfacing ACS712 sensor with
ESP32
Technical specifications:
• Voltage input range: DC 0-12V
• Output signal type: Analog
• Distance Analog Resolution: 30 cm
16
Fig: Ultrasonic sensor with arduino circuit
As you can see from the above circuit diagram the Ultrasonic sensor module signal
pin OUT is connected to Analog pin A0 of Arduino. The – pin of sensor is connected to
GND pin of Arduino. On the other side the distanceto be measured whose +ve and -ve pins
are connected to VCC and GND respectively.
I2C MODULE
An I2C LCD1602 is a device that can display text and characters on a
16x2 (16 columns and 2 rows)liquid crystal display (LCD) using the I2C
protocol. You can use an I2C LCD1602 to show information from your
Arduino projects, such as sensor readings, messages, menus, etc. The I2C
module has a built-in PCF8574 I2C chip that converts I2C serial data to
parallel data for the LCD
17
Fig: I2c module
Principle.
An I2C LCD1602 consists of a normal LCD1602 and an I2C module that is attached to the
back of theLCD. The I2C module is a chip that can expand the I/O ports of the Arduino
using the I2C protocol.
The I2C protocol is a serial communication protocol that uses two wires: SDA
(serial data) and SCL(serial clock). The I2C protocol allows multiple devices to
communicate with each other using only two wires and unique addresses.
Fig:12c LCD1602
The I2C module converts the signals from the Arduino into commands for the LCD.
The LCD has 16x2 cells that can display characters or symbols. Each cell consists of
5x8 dots that can be turned on or off by applying voltage. The LCD can display
different characters or symbols by turning on or off different combinations of dots.
Backlight/Contrast
18
Backlight can be enabled by jumper cap, un plugg the jumper cap to disable the
backlight. The blue potentiometer on the back is used to adjust the contrast (the
ratio of brightness between the brightest white and the darkest black).
Shorting Cap: Backlight can be enabled by this cap on plugg this cap to disable
the backlight.
Potentiometer: It is used to adjust the contrast (the clarity of the displayed text),
which is increased in the clockwise direction and decreased in the counterclockwise
direction.
After wiring the LCD, you should turn on the Arduino and adjust the
contrast by rotating the potentiometer on the I2C module until the first row of
rectangles appear to ensure proper LCD operation.
At the heart of the adapter is an 8-bit I/O expander chip – PCF8574. This chip
converts the I2C data from an Arduino into the parallel data required for an LCD
display.
19
There is a jumper on the board that provides power to the backlight. To control the
intensity of the backlight, you can remove the jumper and apply external voltage to
the header pin labeled ‘LED’.
If you have multiple devices on the same I2C bus, you may need to set a different
I2C address for the LCD adapter to avoid conflicting with another I2C device.
For this purpose, the adapter comes with three solder jumpers/pads (A0, A1, and
A2). The address is set when a jumper is shorted with a blob of solder.
The I2C LCD Display has only four pins. The following is the pin out:
20
Fig: 12c LCD display pin out
GND is a ground pin.
VCC is the power supply pin. Connect it to the 5V output of the Arduino or
an external 5V power supply.
In the dynamic realm of DIY electrical projects, the humble jumper wire emerges
as a silent hero, facilitating seamless connections and unlocking the potential for
innovation. This introduction aims to shed light on the pivotal role these
unassuming components play in the world of electronics.
21
making them indispensable in the creation and modification of electrical
setups.
Fig:male-to-female dynamics
22
Male-to-Female Dynamics: This setup enables the connection of male pins to
female receptacles, offering flexibility in interfacing with a range of components.
Fig:female-to-female flexibility
Head shapes play a pivotal role in the functionality and applicability of jumper
wires. Delve into the nuances of square and round heads to make informed
choices.
23
Fig: 9v battery
9V Battery
The nine-volt battery, or 9-volt battery, is an electric battery that is typically composed of
6 x 1.5V alkaline cells. Therefore, it supplies a nominal voltage of 9 volts. Actual voltage
measures 7.2 to 9.6 volts, depending on battery chemistry. Batteries of various sizes and
capacities are manufactured; a very common size is known as PP3 (Power Pack – 3). The
PP3 has a rectangular prism shape with rounded edges and two polarized snap connectors
on the top.
This type is commonly used for many applications including household uses such as smoke and gas
detectors, clocks, and toys.
24
“zinc-carbon” is slightly misleading as it implies that carbon is acting as the reducing
agent rather than the manganese dioxide.
NiMH batteries. A nickel metal hydride battery, NiMH, is a rechargeable battery with a
positive electrode made of nickel hydroxide and a negative electrode made of a metal
hydride (a hydrogenabsorbing alloy). The NiMH battery was commercially introduced
in 1989 and was mainly used as a power source in portable personal computers. Since
then, the NiMH battery system has become very popular in electric hybrid vehicles and
makes up 10% of the total market for rechargeable batteries. Compared to the NiCd
battery, the NiMH provides 40 percent higher specific energy resulting in about two
times higher capacity. NiMH batteries are also less affected by voltage depression, but
the main advantage is the absence of toxic cadmium. The memory effect of NiMH
batteries is much less than nickel-cadmium batteries.
today have been mostly replaced by more efficient and safe alkaline batteries. It
produces a voltage of about 1.5 volts between the zinc anode, which is typically
constructed as a cylindrical container for the batterycell, and a carbon rod surrounded
by the cathode that collects the current from the manganese dioxide electrode. The
name “zinc-carbon” is slightly misleading as it implies that carbon is acting as the
reducing agent rather than the manganese dioxide.
NiMH batteries. A nickel metal hydride battery, NiMH, is a rechargeable battery with
a positive electrode made of nickel hydroxide and a negative electrode made of a
metal hydride (a hydrogenabsorbing alloy). The NiMH battery was commercially
introduced in 1989 and was mainly used as a power source in portable personal
computers. Since then, the NiMH battery system has become very popular in electric
hybrid vehicles and makes up 10% of the total market for rechargeable batteries.
Compared to the NiCd battery, the NiMH provides 40 percent higher specific energy
resulting in about two times higher capacity. NiMH batteries are also less affected by
voltage depression, but the main advantage is the absence of toxic cadmium. The
memory effect of NiMH batteries is much less than nickel-cadmium batteries.
25
legs, arms or hands of robots, move sensors etc. with high precision. Servo motors are
small in size, and because they have built-in circuitry to control their movement, they
can be connected directly to an Arduino. Arduino reads the time between
triggering and Received ECHO. We know that speed of sound is around 340m/s. so
we can calculate distance by using given formula:
Distance= (travel time/2) * speed of sound Where speed of sound
around 340m per second. A 16x2 LCD displaying distance.
CHAPTER – 3
Affordability: Ultrasonic sensors like the HC-SR04 are very inexpensive, and when combined
with an Arduino Uno (which is also cost-effective), this makes for a budget-friendly solution
for distance measurement.
Affordable for Prototyping: Since both components are low-cost, they are ideal for rapid
prototyping and learning purposes without a large financial commitment.
User-Friendly Setup: The combination of an Arduino Uno and an ultrasonic sensor is easy to
set up and use, even for beginners. The Arduino IDE (Integrated Development Environment)
makes programming simple with minimal coding experience required.
Clear Documentation and Tutorials: There are abundant resources and tutorials available
online for integrating ultrasonic sensors with Arduino, which makes it highly accessible for
hobbyists and students.
c. Non-contact Measurement:
Safe and Accurate: Ultrasonic sensors measure distances without needing to physically
touch the object, reducing the risk of damage or distortion. This is particularly useful for
measuring delicate objects or in applications like robotics where contact-based sensors
could interfere with performance.
Ideal for Various Surfaces: Ultrasonic sensors work well with various materials (like metals,
plastics, or liquids) and surface textures that might affect other types of sensors like infrared
or laser.
26
d. Accuracy and Precision:
e. Versatile Applications:
Obstacle Detection and Avoidance: You can use an ultrasonic sensor and Arduino Uno in
robotics for obstacle detection and navigation, making it a great solution for autonomous
robots or vehicles.
Object Proximity Sensing: This combination can be used for proximity sensing in various
automation systems, such as smart doors, parking systems, or inventory management
systems.
Liquid Level Sensing: By measuring the distance to the surface of a liquid in a tank or
container, you can use it for monitoring liquid levels without requiring direct contact.
Immediate Response: The Arduino Uno can process sensor data in real time, making the
system responsive and capable of immediate actions based on distance measurements. For
example, it can trigger alarms or motors when an object is detected within a certain range.
Simple Data Output: The Arduino can easily display measured distance on an LCD screen,
send it to a computer via serial communication, or use the data for further processing in
embedded systems.
Expand the System: You can expand this setup by integrating multiple ultrasonic sensors
with the Arduino Uno, allowing you to measure distances in multiple directions or in more
complex applications (e.g., 3D mapping in robotics).
Integration with Other Components: The Arduino Uno can be easily interfaced with other
components like servos, motors, LEDs, and wireless modules to create more advanced
systems based on the ultrasonic distance measurements.
i. Educational Value:
Learning Tool: This setup is often used in educational projects to teach students about
sensors, electronics, programming, and distance measurement principles. It offers hands-on
experience with sensors and microcontrollers, helping students understand concepts in a
practical and engaging way.
27
j. Compact Size:
Small and Lightweight: Both the Arduino Uno and ultrasonic sensor are compact, making it
easy to integrate them into small systems and devices. This is particularly useful for
wearable devices, small robots, or portable distance measurement systems.
3.2 DISADVANTAGES
a Limited Range:
Shorter Effective Range: Most ultrasonic sensors (like the HC-SR04) have a limited range of
around 2 cm to 4 meters. Beyond this range, the sensor’s accuracy and reliability
significantly drop. This can be restrictive for applications requiring longer-distance
measurements.
Limited Precision at Long Distances: As the distance increases, the precision of the sensor
tends to degrade, and errors can become more pronounced, especially for distances near
the sensor's maximum range.
Sensitive to Weather Conditions: Ultrasonic sensors rely on sound waves, and their
performance can be affected by environmental factors like temperature, humidity, or wind.
For example, temperature changes can affect the speed of sound, leading to inaccuracies.
Interference from External Noise: Ultrasonic sensors can be influenced by background noise
or other ultrasonic sources. High levels of noise in the environment (e.g., from machinery)
can distort the sensor readings, making them less reliable.
Reduced Accuracy at Close Range: Ultrasonic sensors may not provide highly accurate
measurements when very close to the target (i.e., under 2 cm). In such cases, the sensor's
resolution may be insufficient.
Angle Sensitivity: Ultrasonic sensors generally have a wide beam and are sensitive to the
angle of the surface they are measuring. The angle at which the sensor hits an object can
lead to a distorted or inaccurate measurement, especially for irregular or angled surfaces.
Line of Sight Requirement: Ultrasonic sensors require a clear line of sight to the object being
measured. If there are obstacles in the path, or if the object is soft or highly absorbent (like
cloth or foam), the sound waves may not reflect back properly, causing inaccurate or failed
measurements.
Soft Materials: Objects like fabric, foam, or irregularly shaped materials can absorb sound
waves, making it hard for the ultrasonic sensor to get a reliable reading.
Slower Response Time: The process of emitting sound waves, waiting for the echo, and
calculating the distance can be relatively slow compared to other types of sensors, like
infrared sensors or lasers. This could limit the use of ultrasonic sensors in applications
requiring real-time or high-speed measurements.
28
f. Limited Precision in Complex Environments:
Multiple Reflectors: In environments with multiple surfaces or highly reflective objects, the
ultrasonic waves might bounce off unintended surfaces, leading to false readings or multiple
echoes, making it difficult to determine the true distance to the target.
Difficult in Complex Geometries: When trying to measure distances to irregularly shaped
objects or in complex environments, the sensor may struggle to get an accurate reading due
to the sound wave reflection being scattered in various directions.
Power Requirements for Continuous Measurement: If you are using an ultrasonic sensor
continuously or in real-time applications, it can consume more power than some other
sensors, which could be a concern in battery-powered or energy-sensitive systems.
Correct Alignment Needed: Ultrasonic sensors require careful alignment to ensure accurate
measurements. If the sensor is not aligned properly with the target, the distance
measurement may be off or completely incorrect.
Varying Measurements with Surface Angle: The angle at which the sound waves hit the
object can affect the measurement. If the object is angled away from the sensor, the
reflected waves may not return to the sensor properly, leading to errors.
j. Limited to 2D Measurements:
Cannot Measure Height or Depth: Ultrasonic sensors can typically only measure distance in one
dimension. For 3D measurement applications (e.g., detecting the exact position of objects in
space), multiple sensors would need to be employed, or other types of sensors (e.g., LiDAR) may
be more suitable.
3.3 APPLICATIONS:
Robots and Autonomous Vehicles: Ultrasonic sensors paired with an Arduino Uno are
commonly used in robots or autonomous vehicles for obstacle detection and avoidance.
The sensor helps measure the distance to nearby objects, allowing the robot to navigate
around obstacles by adjusting its path in real-time.
Examples:
o Self-driving robots
o Drones for automatic navigation
29
o Automated guided vehicles (AGVs) in warehouses
Industrial Automation: Ultrasonic sensors are widely used in automated systems to detect
the presence or absence of objects in a particular area. This is crucial in manufacturing lines
for process control or product handling.
Examples:
o Automatic door openers (proximity sensors to detect people walking by)
o Conveyer belt systems for detecting product position
o Automatic bin fillers in material handling
Water or Liquid Tanks: Ultrasonic sensors can be used to measure the level of liquids in
tanks, silos, or containers without contact. By calculating the distance between the sensor
and the liquid surface, you can determine how much liquid is in the container.
Examples:
o Monitoring water levels in tanks
o Fuel tank level monitoring in industrial systems
o Chemical storage and level monitoring
Automobile Parking Sensors: Ultrasonic sensors are used in parking assistance systems for
automobiles. The sensor detects how far an object (e.g., a wall, another car, or a curb) is
from the vehicle, and feedback is provided to the driver to assist with parking.
Examples:
o Car parking sensors (beeping or visual display for parking assistance)
o Smart parking solutions (integrated with mobile apps to show available parking
spaces)
Positioning and Alignment in Manufacturing: Ultrasonic sensors are used in CNC (Computer
Numerical Control) machines for accurate measurement and alignment of parts or tools.
They help ensure that the machines perform precise operations by measuring distances
accurately.
Examples:
o Alignment of machine parts or tools
o Distance monitoring to ensure precision during CNC machining
3D Mapping: By using multiple ultrasonic sensors in a grid-like setup, it's possible to create
3D distance maps of environments. This application can be useful for creating detailed
topographic maps or modeling spaces.
Examples:
30
o 3D scanning for room or object mapping
o Environmental mapping for robotic navigation
Height or Elevation Detection: Ultrasonic sensors can be used to measure the height or
elevation of an object from the ground or another reference point. This is useful in various
applications where height precision is required.
Examples:
o Measuring the height of vehicles in automated toll systems
o Height monitoring for material handling equipment or forklifts
Smart Appliances: Ultrasonic sensors can be integrated with smart home systems to
automate and control appliances or lighting systems. For instance, when someone
approaches, the sensor detects their presence and turns on lights or adjusts heating
systems.
Examples:
o Smart lighting systems (lights turn on when you approach)
o Motion sensors in security systems
o Automated curtain systems that open when someone enters the room
Inventory and Object Tracking: Ultrasonic sensors can count objects or track their positions
within a specific area. For instance, sensors can be used to count the number of objects
passing through a conveyor or track their position in a storage system.
Examples:
o Automated inventory management
o Object tracking in warehouses
STEM Education: The Arduino Uno and ultrasonic sensor are popular choices for educational
projects, as they offer hands-on experience with basic principles of electronics,
programming, and sensors. Students can learn how sensors work and how data from real-
world environments can be processed by microcontrollers.
Examples:
o Educational robot building projects
o DIY distance measurement systems
o Science experiments related to physics and sound waves
Field and Crop Monitoring: Ultrasonic sensors can be used in agriculture for monitoring the
height of plants, checking soil levels in irrigation systems, or measuring the distance from
the ground to crops in automated farming setups.
31
Examples:
o Crop height measurement in precision farming
o Monitoring the level of soil moisture in irrigation systems
CHAPTER – 4
32
Fig: distance measurement circuit
The working of the project is explained here: First of all we need to trigger the
ultrasonic sensor module to transmit signal by using arduino and then wait for receive
ECHO.This technique of distance measurement using ultrasonic in air includes continuous
pulse echo method, a burst of pulse is sent for transmission medium and is reflected by an
object kept at specific distance. The time taken for the sound wave to propogate from
transmitter to receiver is proportional to the distance of the object. In this distance
measurement system we had ultrasonic sensor HC-SR04 interfaced with Arduino UnoR3.
Programming and hardware part of ultrasonic sensor interfacing with Arduino UnoR3.servo
motors are used to control the position of objects, rotate objects, move legs, arms or hands of
robots, move sensors etc. with high precision. Servo motors are small in size, and because
they have built-in circuitry to control their movement, they can be connected directly to an
Arduino. The rest of the calculations are made in the programming part of the Arduino UNO
Components used:
33
Inout Voltage (limit): 6-20V
Digital I/O Pins: 14 (of which 6 provide PWM output)
PWM Digital I/O Pins: 6
Analog Input Pins: 6
DC Current per I/O Pin: 20 mA
DC current for 3.3V Pin: 50 mA
Flash Memory: 32 KB (ATmega328P) of which 0.5 KB used by bootloader
SRAM: 2 KB (ATmega328P)
EEPROM: 1 KB (ATmega328P)
Clock Speed: 16 MHz
LED_BUILTIN: 13
Length: 68.6 mm
Width: 58.4 mm
Weight: 25 g
The Arduino Uno board can be powered via a USB connection or with an external
power supply. The power source is selected automatically. External (non-USB) power can
come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected
by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery
can be inserted in the GND and Vin pin headers of the POWER connector. The board can
operate on an external supply from 6 to 20 volts. If supplied with less than 7V, however, the
5V pin may supply less than five volts and the board may become unstable. If using more
than 12V, the voltage regulator may overheat and damage the board. The recommended
range is 7 to 12 volts.
Vin. The input voltage to the Arduino/Genuino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated power sources).
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 - 12V), the USB connector (5V), or
the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the
regulator, and can damage your board. We don't advise it.
3V3. A 3.3 volt supply generated by the on-board regulator. The maximum current draw is 50
mA. 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
GND. Ground pins.
IOREF. This pin on the Arduino/Genuino board provides the voltage reference with which
the
34
Custom Characters Support
Works in both 8-bit and 4-bit Mode
RG 1602 ,16x2 LCD Display in a captivating blue hue, perfect for your electronics
projects. This versatile and reliable LCD screen features a 16x2 character layout, allowing
for clear and crisp text display. Its compact design and easy-to-use interface make it ideal
for a wide range of applications. Whether you're a hobbyist or a professional, this high-
quality LCD display with a soothing blue backlight will enhance your projects and
captivate your audience. Explore the possibilities today
This 16x2 Blue Jumbo Display, featuring the same captivating blue color but with a
larger font size for enhanced visibility. This display offers 2 lines, each with 16
characters, capable of displaying both alphanumeric characters and numbers. Its versatile
functionality makes it perfect for applications such as data scanners and meters, providing
clear and easy-to-read indications of critical information
Power Supply: DC 5V
Working Current: 15mA
Working Frequency: 40Hz
Ranging Distance : 2cm – 400cm/4m
Resolution : 0.3 cm
Measuring Angle: 15 degree
Trigger Input Pulse width: 10uS
Dimension: 45mm x 20mm x 15mm
One of the most popular ultrasonic sensors would be the HC-SR04. The configuration pin of HC-
SR04 is VCC (1), TRIG (2), ECHO (3), and GND (4). The supply voltage of VCC is 5V and you
attach TRIG and ECHO pin to any Digital I/O in your Arduino Board to power it.
35
CODE:
long distance;
long distanceInch;
long duration;
void setup(){
lcd.init();
lcd.backlight();
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
lcd.setCursor(0,0);
lcd.print(" EEE B.Tech");
lcd.setCursor(0,1);
lcd.print("2rd YEAR STUDENTS");
delay(2000);
}
void loop() {
ULTRASONIC();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("DISTANCE CM:");
lcd.print(distance);
lcd.setCursor(0,1);
lcd.print("DISTANCE INCH:");
lcd.print(distanceInch);
// lcd.setCursor(0,1);
// lcd.print("DISTANCE MM:");
// lcd.print(distanceInch);
}
void ULTRASONIC(){
36
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration*0.034/2;
distanceInch = duration*0.0133/2;
}
CHAPTER – 5
CONCLUSION:
Distance measurement using ultrasonic sensors and Arduino is a popular research area
with various applications. The results of this review indicate that ultrasonic sensors and Arduino
are widely used in the development of electronic projects related to distance measurement.
Further research is needed to explore the potential of these technologies in various other
applications
Distance =speed*time
The human audible range can be converted measure the distance precisely manner
FUTURE SCOPE:
1.Using temperature adjustable devices, it can be used over wide temperature range.
2. Using High Range Ultrasonic sensors to extend the range of distance measurement.
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65