Eddie's Lounge room sonar project.
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. |
|
|
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. |
|
|
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).