Intro: Ultrasonic Geocache #UltraCache
What inspired the project:
Sound waves surround us every day from the annoying noise of banging pipes or the garbage truck to the bliss of our favorite album. Most people are aware that we can only hear certain frequencies, some say the hearing range of humans is 20 Hz - 20 kHz, though it's difficult to say specific frequencies because human hearing varies a lot. Some people are able to hear tones at frequencies as high as 24 kHz if the level is above 90 dB (re: 20 micropascals). Others can't hear tones above 14 kHz. The band above the average human range of hearing, as if that is well defined, is getting used much more recently. It is easy to buy online pest deterrents that broadcast high amplitudes at frequencies between 15 kHz and 25 kHz. I have been working with a group of researchers looking into the Health Effects of Ultrasound In Air (HEfUA). While working with this team I learned a lot and even found out that many supermarkets and malls in the UK use signals at 20 kHz to test whether their emergency address speakers are working throughout the day. I wanted to make something that would raise awareness of loud sources that we can't hear.
So, at a meeting of HEfUA, I generated a signal that would spell out letters in the frequency domain and played it over my laptop speakers. I asked if anyone heard anything suspect in the room and as I expected many of them loaded up their spectrograms on their smartphone. They found the secret message and were surprised. From there I wanted to make stand-alone units that could be used in Geocaching.
Step 1: Bill of Materials
There are many ways to approach this project so I am going to outline both the generic concept and the specific instructions to duplicate the device I made.
If you don't want a stand-alone unit and just want to use your phone/tablet/pc to broadcast the signal please skip to Step 4. Otherwise, you will need to following components:
- Audio player: I wanted to reduce the per-unit cost as much as possible so I chose an integrated audio-player and amplifier. I used the DFPlayer Mini which is a PCB device that has a micro-SD card reader, MP3 player, and 3 W amplifier all on one 2 cm by 2 cm board. I've attached the manual to this step.
- I cheated here because the DFPlayer Mini has a built-in 3 W amplifier. An amplifier is important because a typical signal for headphones won't be powerful enough to drive the speakers.
- For my first take at the device, I used 3 AA batteries in series to supply the DFPlayer mini with its required 3.2 V - 5 V requires supply, but have since moved to a 9V battery with a voltage regulator. I am using an LM7805c voltage regulator. You can see the details in the wiring diagram below.
- I used standard 1 W micro-speakers of varying dimensions. You can see a couple pictured together. For my final device, I used four 40 mm diameter 1 W, 8 Ω speakers per box.
- I 3D Printed my housing. You can find the instructions in step 3, however, you could use anything from a generic project box to a cardboard box for this.
After that is done only two steps remain:
- The next step is programming the device. I cover two methods in Step 4.
- Assemble everything and test the device!
Step 2: The Electronics
I've attached a diagram of the required electronics. There are two options, one for using three AA batteries and one for using a 9V battery.
To complete this step, you will need a bit of soldering experience. I am not covering soldering or reading the circuit diagram in this Instructable, but if you want some guidance see the Intro to Soldering Instructable. If you're a real pro, you can get a PCB board printed and I've included my final design (see geocachePCB.RBR). Otherwise, you can use DIY solder-board to make the circuit. I've included pictures of both approaches.
The device works for me with one speaker, but I wanted to get better directivity and to spread the 3W amp signal over four 1 W speakers. Therefore I wired two speakers in series with two speakers in parallel as shown in the speaker options graphic.
Step 3: Housing
The housing for the device can be anything from a cardboard box to a plastic project box to a paper mache monster. The last one sound like a lot of fun. My first prototype was a small project box that housed the batteries, circuits, and one speaker. For my later version, I ended up 3D printing a housing.
The only prerequisites are that it:
- Hold the batteries
- Hold the circuit board
- Has holes for the speakers
I found some really useful brass inserts that can be melted into 3D prints. I used them to create M3 threads to hold the lid on my housing.
I've attached the solid works model for the box and the 3D Printer STL file, though you should take care even if you buy the exact same "8Ω 1W Miniature Speaker 40mm Dia. 40 x 6.7mm" minature speakers I did they may not have the same dimensions so the design may need to be modified.
Once you have your housing and holes cut for your speakers, just stick it all together.
Step 4: Programming
Now we have a nifty little speaker. You can put your favorite songs on a micro-SD card and jam out. But that's not what we are here for. We need to encode ultrasonic messages that we can pick up with a spectrogram. There are two methods for doing that.
Using a programming language to do dot matrix printing
The first is only helpful if you know Matlab or can translate it to another programming language. I've attached my script to this step. If you want to duplicate it with your programming of choice, the code performs dot-matrix printing in the frequency domain. Every row in the seven rows of dot-matrix printing is assigned a frequency. A tone burst is generated to represent a filled dot and a zero signal represents an empty dot. I taper the tone bursts with Tukey windows to prevent an audible click. The signals for each row are added up in time and then normalized to the maximum level is 1. I then export it to a .wav file and convert that to an .mp3 file.
For those less into coding
Fortunately, there is an image synth program called Coagula Light. It allows you to include an image file and turn it into a spectral representation. I've included a test image "#Ultracache" so you can try it yourself. After you have loaded the image into Coagula you will need to change a few settings. Under Options -> Sound Card -> Sample Rate, up the sample rate to 48000 and decrease the buffer size to 2048. Under Tools -> Render Options change the High pitch to 22000 and the low pitch to 20500. Also, slide the noise bandwidth all the way to the left. Now you should be able to render the image. Now when you hit render... you should hear nothing. That said your computer speakers should be able to play the ultrasound so open a spectrogram app and see if you can detect the signal.
For everyone using the DFPlayer Mini
Once you have an .mp3 files you need to name it "001.mp3" and place it in a folder named "01" on a micro-SD card. Once you have the device powered and everything wired up, pressing the button should activate the device and start playing the signal on loop.
Step 5: Deploy
Here's a photo of my assembled device. Place them around and see if others can find them. If the battery gets low the device does start emitting an audible and rather annoying noise, so don't leave them too long unattended. I get about 8-10 hours of use from one 9V battery.