Eddie's Lounge room sonar project. This page will be a bit basic for some but hopefully most people wanting to play with sonar will get something from it. Almost every PC has a sound card and many also have a microphone but I've never heard of anyone using them to build a sonar system. Most people associate sonar with ultra-sound – even though the "Red October" ping was clearly audible. Echo-localing bats mostly use ultra-sound as does most marine sonar and sonar range finders. There are also sonars which use lower frequencies. Lower frequencies are useful for penetrating deeper and are largely used for "looking" thru the ocean floor for tens of meter or more. The PC program I am writing uses a sweep frequency chirp and some very basic signal processing to detect echos off complex targets. I think the performance I've achieved from a $30 (second hand) sound card and a $13 mic is amazing. This photo shows my test setup. The multi-media speaker is clearly visible to the right of the mouse. Less obvious is the mic which is near the front of the box and in some yellow-tack. The white broom stick laying on top of the monitor is one of my test targets. |
The Chirp. |
Auto-correlation. |
This is a chirp and echo off my ceiling. The top trace shows the waveform recorded by the PC mic. It is plotted in with two scales because the dynamic range is too high to display the both the large and small signals with one trace. On the left you can see the direct wave – straight from speaker to mic. Just after this ends the reflection arrives. For close targets the direct and reflected chirps overlap. This isn't a problem in current setup but is a limitation if the same transducer is used as both a speaker and mic. It is somewhat difficult to interpret the raw signal by eye. For such a simple target you can see what's happening but any subtle echo would be lost. |
|
Knowing what the auto-correlation function looks like lets me do some more (crude but effective) processing. I simply look for the largest peak and subtract the auto-correction function from the data at that region and replace it with a single spike – then repeat the process till I'd done them all (its faster than you might expect). This is what the "sharpen" feature does. |
Here is the the proof of the pudding. This is a "depth sounder" type screen. The time axis runs from left to right and the distance axis runs top to bottom. The maximum range here is a meter or so but the system does works over much longer distances. On the left you can see where I turned off the "sharpen" function so you can see the difference. The wiggly line is the echo off a broomstick (the same one that is in the top photo). I moved the this up and down and it has left a very bright trace and some dim ghosts. |
The next fun thing to do will be to try some synthetic aperture processing. The basic gist is take lots of recordings from different positions to try to work out what the targets look like. To give some feel for what the raw data will look like I set up two targets (call them broom sticks) and slowly moved the mic/speaker combo to take 150 or so recordings. I was only pushing the combo by hand so the speed varied a bit. You can see the classic parabolic arcs which are trivial to decode by eye. The point of the parabola is the location of the target. However with some smart software you could possibly see the shape of the target and see them amongst clutter (useful in my house). |
You can download my program and play with it. It doesn't work on all PCs. It runs on most win2000 boxes but is unhappy on my NT box. It requires working sound drivers and mmsystem.dll. IT IS BUGGY, it hasn't done anything nasty but it gets the odd divide by zero error and that sort of thing. It is not even to the "beta test" stage yet. Save your files before you run it just in case. |
Also check out Daniel's pocket-pc sonar on my wiki - http://nerdipedia.com/tiki-index.php?page=Sonar
2014.
Bob Lansdorp has some labview code doing chirp at http://boblansdorp.blogspot.com/2012/10/microphone-and-speaker-based-sonar.html (page dated October 2012).