Ultrasonic Sensing with 2 Arduinos

Hello all,

I have two Arduinos. I would like to have just an ultrasonic transmitter send a pulse from my first arduino to an ultrasonic receiver on my second arduino. Is this possible? Does anyone make a separate transmitter and a separate receiver that are compatible with arduino? If so can you point me in the right direction please?

Thanks!

Such a setup is possible, but what would you do with it? It would not be useful for ranging.

There's a thread somewhere where a guy did that, but at the instant he sent the ultrasound pulse he also sent a radio pulse. Since the speed of radio >> speed of sound, the time of receipt of the radio pulse was taken as the time at which it was sent, so the receiving Arduino could thus determine the time of flight of the ultrasound and hence determine the distance.

That would be a different setup. The OP needs to explain what he/she wants to do.

Hey guys thanks for the replies. Sorry I have been away.

I want to use it for ranging but I will time stamp the transmission from arduino 1 and then the receive stamp from arduino 1. My plan is to use the speed of sound to then calculate the range.

I have coded this successfully with individual IR transmitters and receivers but it turns out the speed of light is waaaaaay to fast for an arduino to process. The speed of sound will be within its capabilities however. I am just having trouble finding suitable ultrasonic sensors to make it happen.

Your thoughts?

Thanks again for your help

I will time stamp the transmission from arduino 1 and then the receive stamp from arduino 1.

How will this information be transmitted and received, and how long will this process take?

tpasaro5:
I want to use it for ranging but I will time stamp the transmission from arduino 1 and then the receive stamp from arduino 1. My plan is to use the speed of sound to then calculate the range.

Time stamp? You're never going to get the two Arduinos sufficiently in sync for that. You'll have to send a "now!" kind of message from one to the other (preferably at light speed), so the other can start timing until it receives the ultrasound ping.

both arduino 1 and arduino 2 will have an individual transmitter and receiver wired up.

transmission from arduino 1 will begin with a push button. The pulse will then be received by arduino 2 and then immediately a transmission will be sent back to arduino 1. I believe that answers your question. Like I said i was able to get it to work with ir sensors but the results were way off because it happened way too fast. I am simply looking for an individual ultrasonic transmitter and receiver. every one that I have found come in a transmitter/receiver pair. Thats not what im looking for.

I am not trying to sync the two arduinos. I already have the concept proved out, I am just looking for a capable sensor. I just need an ultrasonic transmitter to send a single pulse whenever I want, and a receiver to be able to sense and receive the pulse. Its a really simple concept I think. Just need to find the right sensors. IR sensors are available as individual which is why I was able to make it work but I need that for Ultrasonic.

How about this:
Take two cheap HC-SR04 sensors.
Remove/disable the transmitter on the receiving side.
Then send a signal from one to the other, and at both sides at the same time do the standard HIGH/LOW sequence on trig, then listen for the pulseIn() on the receiving side.You may increase this time at the sender side a little to correct for the time it takes receiver to process the message, if needed. It's probably so fast you can't measure the difference.
The idea is that you pretend on both sides that you're actually operating them normally, just that at the receiving side it doesn't send out its own ping, instead listens to the ping of of the other sensor. The sender may also receive an echo but you just don't listen for that, unless you want to use it as control.

Do us all a favour and draw a picture of this and a timing line. I'm very confused about how this will work. What are these "timestamps" of which you speak?

I have a feeling your thinking is fundamentally flawed but that might be because I'm not picturing how this all hangs together.

wvmarle:
How about this:
Take two cheap HC-SR04 sensors.
Remove/disable the transmitter on the receiving side.
Then send a signal from one to the other, and at both sides at the same time do the standard HIGH/LOW sequence on trig, then listen for the pulseIn() on the receiving side.You may increase this time at the sender side a little to correct for the time it takes receiver to process the message, if needed. It's probably so fast you can't measure the difference.
The idea is that you pretend on both sides that you're actually operating them normally, just that at the receiving side it doesn't send out its own ping, instead listens to the ping of of the other sensor. The sender may also receive an echo but you just don't listen for that, unless you want to use it as control.

I understand what you are getting at but how would I code just a transmission and just a receive?

Trigger both units with the same pulse?

kenwood120s:
There's a thread somewhere where a guy did that, but at the instant he sent the ultrasound pulse he also sent a radio pulse. Since the speed of radio >> speed of sound, the time of receipt of the radio pulse was taken as the time at which it was sent, so the receiving Arduino could thus determine the time of flight of the ultrasound and hence determine the distance.

wvmarle:
How about this:
Take two cheap HC-SR04 sensors.
Remove/disable the transmitter on the receiving side.
Then send a signal from one to the other, and at both sides at the same time do the standard HIGH/LOW sequence on trig, then listen for the pulseIn() on the receiving side.You may increase this time at the sender side a little to correct for the time it takes receiver to process the message, if needed. It's probably so fast you can't measure the difference.
The idea is that you pretend on both sides that you're actually operating them normally, just that at the receiving side it doesn't send out its own ping, instead listens to the ping of of the other sensor. The sender may also receive an echo but you just don't listen for that, unless you want to use it as control.

I did what is described above a year or so ago, using radios as mentioned by kenwood..., and using the NewPing library (not pulseIn). It works.

Ben Heck did something similar for the human-following robot luggage project.

If the units can be connected with wires, so much the easier to trigger the sending and receiving units at the same time.

The 2 units will not be wired together at all.

Using the HC-SR04 Ultrasonic Sensor I can program a transmission with this code if Im not mistaken:

digitalWrite(trigPin, HIGH);

When this triggers, I need to somehow disable the connected receiver. The pin that the echo is connected to is setup as an INPUT not an output so I dont think I can just do a digitalWrite LOW on it. Any thoughts on how I can disable the attached receiver?

I want to use it for ranging but I will time stamp the transmission from arduino 1 and then the receive stamp from arduino 1.

The 2 units will not be wired together at all.

Then the two units must be communicating wirelessly. Please explain.

arduino 1 will send an ultrasonic pulse and arduino 2 will receive it with a different but identical sensor

Where is the time stamp, and how will you keep the clocks on the two Arduinos perfectly synchronized?

Time will start when the transmission from arduino 1 will trigger. Arduino 2 will receive it and immediately send a transmission back to arduino 1. Once arduino 1 receives the transmission by arduino 2 the time will stop.

That I have figured out already. I just need help on how to code just a transmission and just a receive with those sensors.

tpasaro5:
Using the HC-SR04 Ultrasonic Sensor I can program a transmission with this code if Im not mistaken:

digitalWrite(trigPin, HIGH);

Then keep it high for at least 10 microseconds and the moment the signal drops to low, it's triggered.

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

Any thoughts on how I can disable the attached receiver?

Just remove the receiving transducer.