What Technology Is Used In Ultrasonic Rangefinder Demonstrator? – Detailed Guide

People often ask, what technology is used in ultrasonic rangefinder demonstrators?

Let’s find out!

What Technology Is Used in Ultrasonic Rangefinder Demonstrator?

Ultrasonic rangefinders are a type of distance-measuring equipment that uses sound waves to determine the distance between two objects. The basic principle behind this device is based on the fact that sound travels faster through some materials than others.

For example, water and air travel at different speeds, which means that when an object emits a sound wave it will reach another object at a slightly different time.

Ultrasonic Sensor HC-SR04 and Arduino – Complete Guide

An ultrasonic sensor detects objects by using sound waves. Ultrasonic Sensing is commonly found in Robotics, Security Systems, and Automotive Applications. It is also useful for Detect Obstacle such as Walls, Furniture, Etc.

HC-SR04 Hardware Overview

It’s inexpensive and easy to use. Its range goes up to 13ft.

The sensor consists of two ultrasonic transducer elements. One transmits ultrasound signals and the other receives them. It’s basically a sonar system used by submarine crews to detect underwater obstacles.


  • Operating Voltage 5V DC
  • Operating Current 15mA
  • Operating Frequency 40KHz
  • Minimum range: 2 cm/1 inch
  • Max range: 400 cm/13 ft
  • Accuracy3mm
  • Measuring Angle<15°
  • Dimension 45 x 20 x 15mm

How did the HC-SR04 Ultrasonic Distance Sensor Work?

It emits ultrasound at 4000 Hz which travels through the atmosphere and bounces off objects and obstacles. By measuring the time it takes for the signal to return to the module we can determine the range.

To generate the ultrasound, we first must set the Trig pin high for 10 microseconds. Then, we will transmit an eight-cycle ultrasonic pulse that travels at the speed of light.

After sending out an 8-cycle ultrasonic pulse, the Echo pin goes high immediately and then waits for the echo to come back before starting its next task.

If there is no heartbeat detected within 38 milliseconds, the Echo pin will go into a low state.

If we receive a reflection of the sound waves, the Echo button will be pressed earlier than if there were no reflections. By measuring the length of the period when the Echo button is pressed, we can calculate the distance between the sensor and the object.

To calculate the distance between two points, we use the following basic formula:

Distance = Speed x Time

We actually know both these values. The time is when the Echo pin was high, and the distance is the length of the string from the pin to the speaker.

We need to add an extra step before calculating the distance traveled by the sound waves. And that’s because we’re trying to measure the time it takes for the sound waves to reach the object and then return to our ear.

Let’s say the echo pin was high for two milliseconds. If we want the distance result in centimeters, we can convert the velocity of sound value from 340 meters per second to 3.4 centimeters per millisecond.

Distance = (Speed x Time) / 2 = (34cm/ms x 1.5ms) / 2 = 25.5cm.

If the echo pin was high for two milliseconds, then the distance between the object and the ultrasonic rangefinder is 34 centimeters.

What Technology Is Used In Ultrasonic Rangefinder Demonstrator?

What Technology Is Used In Ultrasonic Rangefinder Demonstrator?

How to Connect HC-SR04 Ultrasonic Sensor to Arduino

We’re going to use the HC-SR04 temperature/humidity sensors to measure the room temperature and humidity.

Connect the Ground and the VCC (5V) wires from the module to the ground and 5V wires on the Arduino board. Also, connect the Trig and Echo lines to any digital input line on the Arduino board.

You can get the components needed for this

  • Ultrasonic Sensor HC-SR04
  • Arduino Board
  • Breadboard and Jump Wires

Improving HC-SR04 Distance Sensor Accuracy with DHT22 Temperature Sensor

The HC-SR05 sensor is quite accurate, but accuracy relies on the speed of the object being measured. In order to get an accurate reading, the distance between the sensor and the object must be known.

Since the speed of the object varies based on the surrounding conditions (temperature, pressure), so does the distance.

To account for these variables, the sensor measures the time it takes for a pulse of ultrasonic waves to travel through the medium. By measuring the difference in time, the distance can be calculated.

So, if we use this sensor to measure distances at various temperatures we should implement temperature compensation, and we can do that with the following formula:

Velocity = 331.4 + 0.6 x Temperature + 0.0124 x Relative_Humidity

Here’s an example:

We will be using an ultrasonic sensor (HC-SR04) to detect when the robot has reached its destination, and then we will be using two sensors (DHT11/DHT22) to measure the temperature and relative air pressure of the room.


We’ve discussed almost every aspect of working with the HC-SR04 ultrasonic sensor with Arduino. If you’re looking for an easy way to detect when something is near or far away from you, then this is the right tutorial for you!

We hope that this guide has been useful. If you have any questions please let us know in the comment box below.


  • Herman Riggs

    Herman is a writer, researcher, and product reviewer here at The Outdoor Stores. His knowledge and expertise in firearms are immense. He knows well which gun is suitable for which purpose and how to handle it correctly. You can benefit from his passion by reading his posts on this website.

You Might Be Interested In...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Might Be Interested In!