Infrasonic Pixel Necklace

This pixel necklace was definitely my favorite project, mostly because it has quite a few design tricks up its sleeve.

First, as far as connected necklaces go, it has a pretty small pendant with a powerful processor. The trick is that the microcontroller controlling the tri-color LED pendant is actually hid behind my neck, and controls the LED via the super-thin wires in a headphone cable. The clasp for the necklace is a headphone cable jack; I close the necklace by snapping the headphone cable jack into its socket, which also serves as a switch for the necklace. You can read about how I worked with headphone cables in the Instructable.

My end goal in making this necklace was to have it alert me when my cellphone rang. I didn’t want to deal with convincing my phone to send out a bluetooth signal when I received a call, though, so I decided to have the LED light up when my phone emitted a high-frequency, ultrasonic pulse. This was a pretty cheap solution, since it meant I only had to have a microphone connected to my microcontroller. I also gave my pixel necklace a mode in which it lit up in response to distinct freqeuncy progressions (i.e. like those in Seven Nation Army).

The code below, written for a Teensy 3.0 (which has a more powerful processer than Arduino’s), computes the FFT of the input audio and lights up if the given sound transitions through notes in the desired way (i.e. in this case, plays Seven Nation Army). There are more intelligent ways to do this than hard-code some upper and lower bounds for the tones, as you’ll see below (todo: use Hidden Markov Models to train and recognize songs?). In any case, it works pretty well! Code to

The following code lights up an LED when a tone of 19.23khz (just above the audible range for most people). In the
last example, I used a FFT to identify peak frequencies in audio input.
Unfortunately, I found the Arduino Uno wasn’t beefy enough to run an FFT fast enough to identify
a frequency as high as 20khz. Instead, I found a great post by Rob B explaining how to use
the Goertzel Algorithm for detecting a single frequency.
Rob also discovered a neat trick about the Goertzel algorithm, which is that if one chooses
the coefficients of the alogrithm to be 0 (making the Goertzel transform much faster,
since we need not compute multiplication by 0), the frequency it detects is 19.23khz, just above
the audible range. Check out the implementation below: