Friday, March 3, 2017

Tracking with Ultrasonic Sound

If dolphins can find fish with sound reflecting off the fish, it should be possible to find a person swimming with a sonic transmitter, right? Right???

Building a beacon

The reason modern 5.1 stereos have only one woofer is that low-frequency sound is omni-directional - you can't tell where it's coming from. The higher the frequency, the easier it is to determine where it came from.

Speakers and microphones must be sized in proportion to the wavelength of the sound they handle. Since I'd eventually need to build an array of receivers to determine the direction the sound came from, each sensor unit needed to be small, so ultrasonic seemed like the right choice.

Fortunately, there are lots of ultrasonic transducers on the market that should work. I decided to use the one pictured below, which is waterproof and made of aluminum.
40KHz Transducer
These pick up sound in a cone of 80+-15 degrees, so can be placed on a spherical surface to determine the direction of the sound based on intensity at each sensor - no need to build a complex circuit to calculate the differential time of arrival for the signal. They can also handle 140Vpp, so I have some headroom if I need more power to work in the water.

It turns out driving these is really easy - just set up a series of pulses with the right voltage. I accomplished this with a Netduino Mini microcontroller, some transistors, an makeshift underwater housing, and a reed switch to control the power. The Netduino (and most similar microcontrollers) supports pulse width modulation (PWM) in hardware, so it can provide a very accurate 40KHz driving signal.

Transducer in the housing

Netduino Mini and circuit
I even experimented with a 10:1 transformer which I used to get 90Vpp out of my 9V battery, but it turned out to be unnecessary, so I decided to reduce the risk of stopping my heart by accident and stuck with 9V directly from the transistor.

That was the easy part.

Building a receiver

The fun part about piezoelectric transducers is that they produce voltages when they encounter a change in mechanical energy, and sound is just such a change. The complicated part is that they produce very little voltage. In order to see the voltage being produced, I needed to amplify the output, which led me to learn a little about op-amps (Operational Amplifiers). 

Amplifying the signal

Op-amps come in different types for different applications. Since I need to amplify sound, I chose the LM386N audio amplifier. Well, actually two of them, along with some resistors & capacitors that set the amplification ratio and implemented a high-pass frequency filter. During development, I was wrangling with a lot of stray noise being amplified, which inspired the filters. In the end, I realized that the ballast in the fluorescent light on my magnifying desk lamp was emitting an EM field with was creating voltage (via induction) in the wires on my prototype. I made the wires lay flat and switched to a different light, but I never got around to seeing if the filters could be eliminated.

Reading the signal

The Netduino has analog inputs that can read 0-3.3V, so I set the gains on the op-amps to give me a maximum amplitude such that, after passing through a half-wave rectifier and a capacitor, I got out a stable voltage that was in the range the Netduino would handle.

Display

My goal was to take this thing out to the water and test it, so I needed an indicator for the signal strength. In the end I used a 7-segment LED numerical display to show a scaled value from 0-9.
Receiver circuit (numerical display not shown, and my pet parrot stole a capacitor)

Testing

First step was in air, and it worked exactly as intended - I got a gradual ramp of signal as I moved in from 20 feet to 0 feet.

The next step was in water. I wanted to see how the signal strength was affected by the density of water. So, I took the transmitter and receiver to a large koi pond where I worked. The signal was even stronger! I got good signal strength and directionality at 40 feet distance.

The final step was in the ocean, SCUBA diving. Again, it worked perfectly a few feet below the surface. But as we descended, the signal began to reduce until it was negligible. The signal returned as we ascended. My conclusion was that it must be due to pressure on the transducer. My theory is that the metal face is deformed inward by the water pressure and responds to/transmits sound energy less the further it is deformed. I repeated the experiment driving the transmitter at 90Vpp with the same results.

Next steps

I have some crazy ideas about using CO2 canisters and pneumatic controls to balance the internal and external pressure, but since my purpose is to learn, I've decided to set this approach aside for the moment to see if I can do something with computer vision. Since I always use a dive light, even during the day, it should be possible to track the light itself.

I'm glad I didn't think of this approach sooner - I had a lot of fun putting this part together!

No comments:

Post a Comment