This Spectrum Analyzer Sputnik Shines a Light on the Sounds Around
Looking like something straight out of a sci-fi film, this steampunk Sputnik sculpture shines out in response to the sound around it.
Mohit Bhoite is back again, and this time with a "stellar" example of his circuit crafting skills, in the form of a satellite-inspired spectrum analyzer sculpture.
Looking like something straight out of a sci-fi film, this steampunk Sputnik has something of a Dark Side of the Moon vibe as pictured above, and perhaps that's in part down to the dazzling light show it is capable of putting out.
Not content with pre-programmed pixel patterns, Bhoite has taken an interesting direction, in giving this sculpture the ability to listen to the noise around it, and respond in its own unique way.
In the previous photo with the lights out, some of you may have noticed that felt-faced, silver cylinder at the center of the triplet of WS2812 armatures.
If you've ever taken on a project with sound-reactive capabilities, you'll recognize that as an electret microphone, a device that produces an output voltage that varies proportionally with ambient noise levels.
Within the central spire of this creation are all the parts needed to take this signal, produce the corresponding WS2812 bitstreams to drive the three pixel strands.
Looking at the labels down the left hand side of the above diagram, we can see the electret mic output is fed into a dead-bugged BJT Amplifier, which boosts the low amplitude AC signal from the microphone into a range that can be read by the built-in ADC of the ATSAMD21 uC on the Adafruit Trinket M0.
Varying sound levels can be handled by tweaking the sensitivity pot; the grey rectangle at the center of the sculpture.
Only a few years ago, this would have likely been a fully analog project. These days, we have 32-bit, Cortex M0-M7 processors on boards the size of a sick (or even piece) of gum, so we can do some really neat things with the bitstream of this analog signal, once it's been digitized by the ADC.
The firmware running on the Trinket M0 is a mixture of the usual Adafruit NeoPixel, and WS2812FX libraries but where things get interesting, is with the inclusion of the Adafruit_ZeroFFT library.
FFT? It's as easy as 1-2-3!
The best way of wrapping your head around what an FFT actually does, is to first take a quick run through this great primer on sound and waveforms.
The main takeaway should be that every sound we hear, from a chord strummed on an instrument, to the human voice, is made up from a number of harmonic overtones of a fundamental frequency. The following GIF, (with a lot of credit due to @swaroopkml96 on Medium!) does a beautiful job of showing a complex signal with 3 different frequency components.
An FFT algorithm allows us to break down the complex signal heard by the electret microphone, and output the frequency components observed, binned by frequency range and magnitude, and theAdafruit_ZeroFFT library greatly simplifies the task of integrating this functionality into your next audio or lighting project.
Below, we can see the most common use of an FFT that many of us will recognize, a VU meter, displaying the intensity of a desired frequency range on the WS2812 pixel arrays.
A GIF does no justice here, so be sure to take a look at the video from which is is taken, to get a feel for how responsive this code is to a real-world signal.
Adafruit have a guide on getting familiar with the FFT library and using it in a practical context to drive some Flora pixels here. While it's targeting a Teensy 3.0 in that guide, a lot of the content and method is directly applicable to the M0 library!
It's absolutely phenomenal that we have hardware available for the price of a good beer that can perform this sort of signal processing without breaking much of a sweat.
Given most of us likely have one, if not several ATSAMD21 boards to hand, this looks like a fun project to play with during the ongoing weeks we find ourselves encouraged to stay indoors!
Milling around, but still doing a lot!
While it might not be getting much use milling PCBs, we can certainly see the appeal and flexibility of the Bantam Tools mill in Bhoite's workshop, with it being put to good work in milling out a fixture to hold the WS2812 LEDs in place during assembly.
Not only that, but the mill also takes up duties in quickly churning out some hexagonally shaped bits of copper clad FR4, to act as some structural elements and bring some rigidity to the mass of the brass and solder.
That extra rigidity makes a lot of sense when you look at where the USB port of the trinkt is located. These bits of FR4 mean that there isn't undue stress applied to the fragile brass framework when plugging and unplugging the USB cable. That same captive force that has saved your smartphone from being dropped to the floor at least once, is more than enough to distort these delicate structural spars.
This is the sort of circuit sculpture that makes a great interactive installation. The audio reactive element is great fun, and sure to get some interesting noises out of whoever it is bestowed upon, and the fact it runs on such a simple, low-cost MCU board means that it's a function that any of us can afford to roll into out next lighting projects!
Be sure to follow along with Bhoite on Twitter, or check out some of his other great circuit sculptures on his website!