El Cheapo Phased-Array Sonar

Sonar is a great sensor to add to any small-scale robot project. And for a couple bucks, the ubiquitous HC-SR04 modules make it easy to do. If you’ve ever used these simple sonar units, though, you’ve doubtless noticed that you get back one piece of information only — the range to the closest object that the speaker is pointing at. It doesn’t have to be that way. [Graham Chow] built a simple phased-array using two SR04 modules, and it looks like he’s getting decent results.

PB211200The hack starts out by pulling off the microcontroller and driving the board directly, a hack inspired by [Emil]’s work on reverse engineering the SR04s. Once [Graham] can control the sonar pings and read the results back, the fun begins.

[Graham] uses TI’s Cortex M4F LaunchPad eval kit to generate a ping and receive the reflections. With normal sonar, the time between the ping being sent and its reception is determined by the range to the target. In a phased array, in this case just the two modules, the difference in the times it takes for the ping to return to each module is used to determine the angle to the target.

phased_array_sonar_tableau

If you’re DSP-savvy, [Graham] is using a phase-shifted square wave signal so that the correlations of the sent and returned signals have better peaks. This also helps the peaks in correlation across the two SR04s in the array. We think it’s pretty awesome that [Graham] is resolving a couple of degrees in angular separation when he moved his wine bottle. With a couple more SR04 units, [Graham] could start to get height information back as well.

For not much scratch, [Graham] has himself an experimental setup that lets him play with some pretty heavy signal processing. We’re impressed, and can’t wait to see what’s next. Special thanks to [Graham] for posting up the code.

And thanks [João] for the tip!

14 thoughts on “El Cheapo Phased-Array Sonar

  1. Yep that’s the way to do it. Medical ultrasonic imaging works that way too. If this evolves into something usable for 2D or 3D SLAM Hobby robotics got a new cheap alternative to LIDAR and Neato spinning laser triangulation.

    1. As do many other ultrasonic tools, such as those used for inspection of structures and pressure vessels. Nice to see it done at this scale. Phased array directional microphones are a pretty well developed, if not widely known, technology, as well.

  2. The big issue with this is that to minimize sidelobes in the the array, you need to have your sensors at about 0.7 lambda (the wavelength) apart- at 40KHz and assuming the speed of sound to be 1100 ft/s, that means the sensors need to be at a spacing of about 1/3 of an inch, or about 8mm. This is bigger than every ultrasonic sensor I know of. For kicks, I did an array of 4 sensors, spaced about 1.4 lambda apart (which is about as close as you can get the sensors I could find), and there were lobes to the beam, the center being the biggest response, but about 45 degrees from boresight (along the axis of the array), the sidelobes were about 3dB down.

    I’ll try to add a link to my project as the link to my website. Otherwise, just look for my project at hazmat dot com.

        1. If you want to get decent resolution with regular 40KHz sensors, About the only way I know of would be to 1) externally focus the beam with a parabolic reflector (which has some significant issues with self interference) or 2) to use a Synthetic Aperture method, where you ping, collect, move the sensor a fraction of the wavelength, ping again, and so forth- once you have all these pings collected, then you can focus the image- takes longer, but you can get some really insanely good resolution. There are a number of ways to focus SAR- it really is not all that difficult, just maybe a bit time intensive.

          And yes, the link to the project (I admit, very old, but the principles are still sound) is the link on my name on this comment.

          1. Hi,
            Is it possible to have good resolution with a SAR RADAR made with just a speaker and a micrphone of a PC, and moving it arround?
            In principle it should work the same way that ultrasounds work but at a lower frequency and with a more wide beam.
            Best regards,

          2. Using lower frequencies is difficult, but not impossible, basically because you end up having too much of the outgoing ping in the signal you’re receiving- you want to stop transmitting before you need to start listening, otherwise you swamp out your receiver. You start to get into requiring some pretty fancy cancellation techniques.

    1. FYI: There are MEMS mics some of them goes out to ultrasonic. Most of the datasheet do not characterize them beyond the usual 20kHz.

      http://www.knowles.com/eng/Products/Sensors/Ultrasonic
      This one with analog output peaks at around 25kHz, but datasheet shows it all the way out to 80kHz. Being tiny (3.76mm x 3mm x 1.1mm), they can be placed at the type of distance you talk about. 8mm is doable.

      You do need to provide your bandpass filter.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.