Thursday, July 31, 2014
Over the last few months I've been looking at building a sonar sensor for underwater robotics. I've been mostly focused on learning some basic signal processing to detect the echos. As documented in a previous post, I've gotten it working in air on a PC using the sound card, and have also recently gotten a TI-Launchpad based version working in air. (More on that later).
However, since the HC-SR04 is so inexpensive and works so well in the air, I could not resist trying to make it work in water. It would be cheaper, easier, and use less power if I could make it work.
Previous reading on making hydrophones indicated that simply dunking a microphone in a film canister full of mineral oil would effectively couple it to the water around it, and let you hear the sounds in the water. That's what I intend to do with the Launchpad based digital sonar. Since mineral oil is non-conductive, I figured it was worth a try to seal a HC-SR04 in a container of mineral oil and see what it did.
The HC-SR04 emits a short pulse of ultrasound and then waits for the first echo. It then outputs a pulse with a length corresponding to the time it took to hear it. From that, you can calculate the distance to the target.
This has some advantages and disadvantages. It's really easy to use and process the data. However, you only get one data point - you only hear one echo. The digital sonar approach gives you all the echoes back, not just one, with relative intensity information, like this:
I figured that the HC-SR04 must be waiting a small amount of time after sending the initial pulse to prevent it from triggering on the ringing of the sending transducer. If I could get the pulse out of the pill bottle before that window, it should work.
I first got the HC-SR04 working in air with a Stellaris Launchpad. I then sealed up the HC-SR04 in a medicine container full of mineral oil.
The module worked in the oil, but didn't return data that I could correlate in any useful way with distance to target.
With the sensor out of the water, it repeatedly returned a very small value (100 or so).
With the sensor in the water, it alternated between sending an extremely small value (~50) and a very large one (600,000+). It did this pretty much regardless of what it was pointed at, and quite regularly. 50, 600000, 50, 600000, 50..... I'm not sure what was happening, exactly.
I've decided to give up on this approach and return to the Stellaris Launchpad-based digital signal processing approach. That will give me a lot more information since I can look at all the echoes graphically. Bummer. It would have been really cool if it worked.