How To Measure Distance Between Two Ultrasonic Sensors

Ultrasonic sensor (HC-SR04) is commonly used to find the distance of an object from one particular point. It has been fairly easy to do this with the Arduino and the code is also pretty simple. But in this article we are going to try something different with these popular HC-SR04 sensors. We will try calculating the distance between two Ultrasonic sensors that is, we will make one sensor to act as transmitter and the other sensor to act as receiver. By doing this we can track the location of one transmitter using many ultrasonic receivers this tracking is called triangulation and can be used for automatic docking robots luggage followers and other similar application. Finding the distance between two US sensors might sound to be a fairly simple task but I faced few challenges which are discussed in this project.

How To Measure Distance Between Two Ultrasonic Sensors

The technique discussed in this article is not fairly accurate and might not be useful in any real systems without modifications. During the time of this documentation I did not find anyone getting results as close as mine so I have just shared my views on how I got it to work so that people who are trying this need not re-invent the wheel.

Materials Required:

  1. Arduino (2Nos) – Any model
  2. HCSR04 Module (2Nos)

Even though we are going to make one US (Ultrasonic) sensor to work as transmitter and the other as receiver it is mandatory connect all the four pins of the sensors with the Arduino. Why should we? More of that will be discussed later.

As you can see the circuit diagram for both Transmitter and receiver are both identical. Also check: Arduino Ultrasonic Sensor Interfacing

How HC-SR04 module actually works:

Before we proceed any further let us understand how the HC-SR04 sensor works.

The sensor has two pins Trigger and Echo which is used to measure distance as shown in the timing diagram. First to initiate measurement we should send an Ultrasonic wave from the transmitter, this can be done by setting the trigger pin high for 10uS. As soon as this is done the transmitter pin will send 8 sonic burst of US waves. This US wave will hit an object bounce back and will be received by the receiver.

Here the timing diagram shows that once the receiver receives the wave it will make the Echo pin go high for a duration of time which is equal to the time taken for the wave to travel from US sensor and reach back to the sensor. This timing diagram does not seem to be true.

I covered the Tx (transmitter) part of my sensor and checked if the Echo pulse got high, and yes it does go high. This means that the Echo pulse does not wait for the US (ultrasonic) wave to be received by it. Once it transmits the US wave it goes high and stays high until the wave returns back. So the correct timing diagram should be something like this shown below (Sorry for my poor writing skills).

How To Measure Distance Between Two Ultrasonic Sensors Schematic

Read More: How To Measure Distance Between Two Ultrasonic Sensors

Leave a Comment

= 3 + 4

(Spamcheck Enabled)

Read previous post:
A new form of retina implant returns sight to the blind
A new form of retina implant returns sight to the blind

What if you could cure blindness as easily as turning on the lights? That’s what one doctor and his team...

Scroll to top