I want to use the direct time of flight method to measure the distance between a person carrying an arduino and a certain part of the room. I have come across many different boards which can easily be connected to the arduino to measure distance using the reflecting time of flight method, but because of the nature of my project, these boards won't work for me.

I have sourced these sensors: Pair Aluminum Housing 40KHz Ultrasonic Transducer Transmitter Receiver. I am considering buying them, but first, I need to be sure that they will work. I have spent hours searching for instructions on how I can connect them to my arduino, but have had no luck.

Can someone please give me some simple instructions on how to connect this thing to my arduino? I basically need one of them on one arduino, which will transmit the ultrasonic wave at certain intervals, and another one on a separate arduino, which will listen for the ultrasonic waves.

  • 2
    \$\begingroup\$ You do realize that if you use separate arduinos for transmit and receive, that they will need to be precisely synchronized in order to measure time of flight? In other words, the receiver will need to know when the pulse left the transmitter. \$\endgroup\$ – Tut Dec 12 '13 at 11:12
  • \$\begingroup\$ And I would add that due to the oscillators drifts, you cannot sync them and forget. After a while they will by out of sync. As already mentioned, you have to find a way to resync periodically. \$\endgroup\$ – Blup1980 Dec 12 '13 at 11:49
  • 1
    \$\begingroup\$ I will use an RF link to keep them in sync. It does need to be two separate arduinos because I'm measuring the distance between two specific objects. \$\endgroup\$ – Ben Ramcharan Dec 13 '13 at 0:59

See Kerry Wong's article

You'll need to create something like the following circuits

enter image description here enter image description here

Personally I'd buy one of the pre-built modules that are much easier to use

enter image description here

As others have noted, using separate Arduinos for transmit and receive will make the project much more complex and less accurate.

I haven't tried any of the above and can't vouch for it.

Polarity is given in the datasheets. sometimes the +ve leg is longer.

enter image description here

  • \$\begingroup\$ That's not what I'm trying to do. This example will get the distance between the transceiver and any random object. I need to get the distance between the transceiver and another specific object (i.e. a person walking around the room). \$\endgroup\$ – Ben Ramcharan Dec 12 '13 at 12:55
  • \$\begingroup\$ @Ben: The driver circuitry will be the same. \$\endgroup\$ – RedGrittyBrick Dec 12 '13 at 14:21
  • \$\begingroup\$ Ok. This may sound like a stupid question but I'm really new to this stuff. I'm guessing that the big rectangles in the circuit diagrams are the ultrasonic transducers. Does it matter which way round they go? Does each pin need to go on a certain side or can I just put them in either way round? \$\endgroup\$ – Ben Ramcharan Dec 13 '13 at 1:22
  • \$\begingroup\$ @Ben: The transducers are polarized, one pin is connected to the body of the transducer. From what I've read, that pin should be connected to the low side (-ve, gnd). \$\endgroup\$ – RedGrittyBrick Dec 13 '13 at 10:14
  • \$\begingroup\$ Ok. Thanks. I'll give that a try once my components have arrived. \$\endgroup\$ – Ben Ramcharan Dec 16 '13 at 2:43

One way to wire it would be to have the "random object" have a transducer that receives and transmits act as an active reflector. It could be done in analog or digital hardware. When a beep is received it would transmit back a beep.

The main unit would almost be a standard distance finder but modified to reduce the sensitivity of the receiver so only the signal from the active reflector triggers the end of the timing, not a passive reflection.


Why not have the speaker and the microphone trigger after a radio pulse. Radio travels at speed of light so pretty much instantaneous.

Then program the difference between the heard radio wave and the heard ultrasonic wave to be calculated by multiplying the time it takes for the second arduino to hear the sound wave by the speed of sound in air. Gives distance.

Will be a much much simpler circuit.

  • 1
    \$\begingroup\$ This is actually what was proposed in the question, as clarified by the poster's comment. The complication is that the ultrasonic transducers are a little more complicated to work with than ordinary audio elements. \$\endgroup\$ – Chris Stratton Jun 3 '16 at 1:58
  • \$\begingroup\$ Ah sorry. There was a lot to read by the time I chimed in. \$\endgroup\$ – Garion Bracken Jun 24 '16 at 23:48
  • \$\begingroup\$ He doesn't suggest introducing a radio transmitter. I was suggesting a workaround to having to have them perfectly synched/them falling out of sync. \$\endgroup\$ – Garion Bracken Jun 24 '16 at 23:50
  • \$\begingroup\$ Untrue. As I carefully said, the poster raises this in a comment on their own question which includes: "I will use an RF link to keep them in sync." \$\endgroup\$ – Chris Stratton Jun 25 '16 at 0:55

Since you already proposed using a radio link for synchronization I suspect the easiest solution for the rest of the system would actually be to just get two of the common inexpensive transmitter/receiver modules that integrate the transmit and receive transducers with driver and receiver circuitry.

Make one transmit coincident with (or perhaps better a millisecond or so after) a radio reference pulse. You can simply ignore the receiver output of this one.

The other one effectively needs to receive without transmitting. It probably won't do that without modification, so it may be easiest to trigger it to transmit (and thus start receiving) on receipt of the radio pulse. To avoid accidentally registering a reflection of the unnecessary transmission from this one, you would want to disable it from actually transmitting - for example by removing circuitry around the RS232 level shifter used as a voltage boost, or perhaps simply by removing the transmit transducer or cutting one of the traces going to it. Even putting a lot of tape over the transmit transducer might do the job.

This should work, because these modules aren't sophisticated enough to tell their own transmissions apart from others occurring within the receive time window - they use a simple burst of several pulses at ultrasonic frequency, and the detector has only a gentle (and allegedly badly mistuned) frequency response, nothing more specific or correlated to the transmission. Really your only challenge in the ultrasonic part of the system itself would be starting a receive window without transmitting, which faking a transmission should accomplish.


protected by Nick Alexeev Aug 23 '16 at 16:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.