Ultrasonic Trilateration (TDOA)

Hello arduinofolks!
I've decided to take up an old project of mine which interested me a lot, ultrasonic trilateration.

I'm thinking of using four microphones, which can detect ultrasonic waves, in each corner of a room and then a mobilephone or some kind of transciever to send the signal.

According to this Article I think I can figure out the calculations from data but I have a couple of questions:

  1. What hardware should I use that can sample signals quick enough? Arduino might be to slow.
  2. When I manage to receive a signal it will probably be quite unclean, how do you filter or handle that sort of signal?

Thanks for the help, Best regards
Archelon

Archelon:
Hello arduinofolks!
I've decided to take up an old project of mine which interested me a lot, ultrasonic trilateration.

I'm thinking of using four microphones, which can detect ultrasonic waves, in each corner of a room and then a mobilephone or some kind of transciever to send the signal.

According to this Article I think I can figure out the calculations from data but I have a couple of questions:

  1. What hardware should I use that can sample signals quick enough? Arduino might be to slow.
  2. When I manage to receive a signal it will probably be quite unclean, how do you filter or handle that sort of signal?

Thanks for the help, Best regards
Archelon

Speed of sound is quite slow compared to the speed of an arduino.

I think the easiest would be to use ultrasonic distance sensors as microphones. I can not guarantee it will work, but I assume their echo-listener is active independently of the trig pin, so the echo-line would be operational even without sending a trig pulse first, but this would have to be tested. Your movable object (robot in my mind) should probably have multiple of these connected to the same pin, to trigger sound in all directions at once, or possibly getting some with wider angle outputs, to cover the entire circle with fewer.

Probably this solution will also suffer from sound waves bouncing of surfaces. If there is direct line of sight between sender and receiver(s), then its just a matter of calculating time for first signal, otherwise it'll be a bit more difficult, since the first signal will not have taken a direct line.

Very interesting concept! :slight_smile:

Now, if we imagine four robots, each with ultrasonic sensors covering the entire circle, used for listening while the robot is stationary, and used for pinging the others, when (single) robot is moving, it starts getting really interesting.

Robots would need to communicate wirelessly to determine which one should move at any time. They would also need to maintain a common clock, which will be an issue also with stationary sensors.

Robots navigating as swarms would be really nice. Of course the problem of moving robots, contrary to fixed listening stations, is that errors would accumulate.

I'd like to build a robotic swarm one day, not to take over the world exactly, but to autonomously navigate any indoor environment.

:slight_smile:

Thanks for a quick reply, fun! I think I failed to explain thoroughly. I want to start with four stationary microphones with known distance between them and then just like the picture in the Article the source will be inside the square. Se included picture:)

Rupert909:
Speed of sound is quite slow compared to the speed of an arduino.

According to arduino.cc it takes around 100 microseconds to read an analog input. I suppose I would need to read all four of them in each cycle because of the fact that I dont know which microphone will be closest to the source of sound. This would give me 400 microseconds for each cycle. In this time the sound travels 0.0004*340=0.136 m.
Wouldn’t the soundwave have time to pass through the sensor in this time? Making it undetectable?

Rupert909:
I think the easiest would be to use ultrasonic distance sensors as microphones. I can not guarantee it will work, but I assume their echo-listener is active independently of the trig pin, so the echo-line would be operational even without sending a trig pulse first, but this would have to be tested. Your robot should probably have multiple of these connected to the same pin, to trigger sound in all directions at once, or possibly getting some with wider angle outputs, to cover the entire circle with fewer.

Interesting concept! :slight_smile:

Soo I could possibly use these Standard Ultrasonic Distancesensor. Is it possible to just read the microphones and not send a signal with those?
Is there not any sensor or transciever which can detect in all directions?

Thanks once again! (My dream is to triangulate a small quadcopter, but I’m aware of how distant that is)

trilateration.PNG

You don't need to sync clocks all the time (no pun intended), you could use another optical event, like a flashgun or IR pulse emitted at the same time as the ultrasonic pings.
The flight time of anything optical will be negligible compared to the audio.

AWOL:
You don’t need to sync clocks all the time (no pun intended), you could use another optical event, like a flashgun or IR pulse emitted at the same time as the ultrasonic pings.
The flight time of anything optical will be negligible compared to the audio.

The thing is that the microphones will be connected with wires to a microcontroller so no Timesync is needed. (:

You better have a close look at the transducers before you start designing a system. They are highly resonant, which is why a burst or gated sinewave is usually used, not a rectangular pulse.

aarg:
You better have a close look at the transducers before you start designing a system. They are highly resonant, which is why a burst or gated sinewave is usually used, not a rectangular pulse.

Okay, could you please specify a litle bit more what you mean by that?

Archelon:
Okay, could you please specify a litle bit more what you mean by that?

Find the actual specifications and read them?

Regards part (2) of your original post, yes, you will certainly need some good signal conditioning on the input. Like a preamplifier, limiter and bandpass filter.

Look up sonar on wikipaedia, there's a lot of good stuff there.

aarg:
Find the actual specifications and read them?

Of course, according to the datasheet you just get the information that it’s working at 40 kHz, Datasheet. According to the common distancesensor it should have a measuringangle of 15 degrees and they use square waves. Apart from that I cant get much information out of them. Any suggestions what to do next? Just buy a few of those cheap receivers and test? Perhaps with just one receiver and one transmitter on a straight line at first?

That's just hobbyist level stuff. Look somewhere like http://www.senscomp.com/

aarg:
That's just hobbyist level stuff. Look somewhere like http://www.senscomp.com/

That was a good point but for just trying out if it might work those products seem a litle bit pricey.. I want to be able to do a quick and not too expensive test to know if there's any idea to pursue it further. :slight_smile:
I already have a Maxsonar-EZ 1 that I could use to test the concept I guess.
thanks once again!

It's just that there are better places to get good answers for this than this forum. Also it really does make a difference how much money you want to spend, and whether you just want to put together a system to use, or do research and development. Are you a scientist or an engineer, by any chance?

In other words, an end in itself, or means to some other end?

aarg:
It's just that there are better places to get good anwers for this. Also it really does make a difference how much money you want to spend, and whether you just want to put together a system to use, or do research and development. Are you a scientist or an engineer, by any chance?

Okay, hmm.. you're right. Of course I should seek information and answers from the experts of the hardware I might use. I'll contact senscomp right away.

Well dear Aarg (sounds like a pirate), I'm actually just a first year electroengineer-student who think this electronics and right now this triangulatingtechnique are really interesting and fun. (:

Well, then you could probably handle the electronics. You need both drivers for the transmitters, and amplifier/signal conditioners for the receivers. If you had really, really fast A/D you might be able to do a lot of it in the digital domain, but not with an Arduino as it is too slow for that kind of work.

You could also hack an HC-04, but it works with proprietary firmware in an on board microprocessor. So you can use it to transmit a pulse, but you need something else to receive because it's expecting an echo.

aarg:
Well, then you could probably handle the electronics. You need both drivers for the transmitters, and amplifier/signal conditioners for the receivers. If you had really, really fast A/D you might be able to do a lot of it in the digital domain, but not with an Arduino as it is too slow for that kind of work.

  1. “Both drivers” what do you mean by that?

  2. I understand I might have to amplify the signal from the receivers to get the voltages to the right level for the Microcontroller but what is a signal conditioner?

  3. Is it not enough to do constant readings and start a clock when one of the receivers gets a signal over a certain threshold? And then just note the time when it reaches each receiver?
    But I realize now when I’m writing that what I’m writing is a dreamscenario where no processing of the raw signal is needed to realize it’s the pulse we’re waiting for, right? BUT if thats the case, HOW ON EARTH am I to be able to process the signal and then start the clock in time?.. exciting…

aarg:
You could also hack an HC-04, but it works with proprietary firmware in an on board microprocessor. So you can use it to transmit a pulse, but you need something else to receive because it’s expecting an echo.

Okay thanks for the hint, I’ll skip that part then. Is there any soundtransmitter that transmits a more spherical wavefront than those transducer, a normal spherical speaker?

1 “both” == You need drivers to power the transmitters and amplifiers and signal conditioning for the receivers.

I can’t think of any device that’ll transmit a spherical front, except maybe a plasma tweeter.

AWOL:
1 "both" == You need drivers to power the transmitters and amplifiers and signal conditioning for the receivers.

I can't think of any device that'll transmit a spherical front, except maybe a plasma tweeter.

So you just mean I need something to power the components?
Okay it doesnt have to be perfectly spherical but something that gives out a wavefront in a middle of a room that propogates equally in all direction if laying on the floor.

No, not just "power the components".
The usual piezo transmitters work best at voltages much higher than an Arduino's supply voltage, sometimes in excess of 100 V, so you need a circuit with very high slew rates to maintain sharp edges at 40 kHz.
You also need to amplify and condition the received signal (which may be as low as a few microvolts at the receiver), to make it suitable for presentation to an Arduino.

Archelon:
Thanks for a quick reply, fun! I think I failed to explain thoroughly. I want to start with four stationary microphones with known distance between them and then just like the picture in the Article the source will be inside the square. Se included picture:)

According to arduino.cc it takes around 100 microseconds to read an analog input. I suppose I would need to read all four of them in each cycle because of the fact that I dont know which microphone will be closest to the source of sound. This would give me 400 microseconds for each cycle.

[...]

These ultrasonic sensors respond with a "ping", which is to say, does not involve analog reading. At any rate you would probably need some embedded electronics doing signal processing, and notifying a listening Arduino with a digital signal, which you use HWINT (hardware interrupts) to catch.

The Uno only has two pins for this, pins 2 and 3. Using an atmega2560, however, you have access to six such pins.

From Arduino Mega 2560 Rev3 — Arduino Official Store :

"External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low level, a rising or falling edge, or a change in level. See the attachInterrupt() function for details."