A Miniature Spectrum Analyser
I've been into spectrum analysers for a bit. There's something neat about seeing what frequencies are peaking as you hear different sounds. I've made a big 32x8 WS2812b analyser. It lives on the wall. I've made a little 32x8 hi-fi sized square LED matrix-based analyser, it lives by the TV. What about my desk though? After eyeing those little Microdot displays and I finally decided on a project using them. Another spectrum analyser of course!
How to make it a reality? I really liked the audio framework of the Teensy, which is what I used for the hi-fi LED matrix (code: TeensyGFXAudioVisualiser). @ZodiusInfuser had recently produced (hand soldered!) some demo ToZero boards to give the Teensy the Raspberry Pi 40-pin GPIO connector, so it seemed fairly straight forward to use a Teensy for the Microdots.
On the software side, I had the previous TeensyGFXAudioVisualiser code as a starting point. What I needed was a way to control the Microdot panels from the Arduino IDE. The Pimoroni hat uses the IS31FL3730 I2C matrix driver. I couldn't find a library for it that worked the way I wanted, so I ended up writing my own based on Pimoroni's code. At the end of the day I had a test program going proving the display worked. It was then a matter of writing an AdafruitGFX wrapper on top of that, and then I could use my previous spectrum analyser code virtually untouched. (I'll get around to uploading this code eventually?)
The next step was back to hardware, getting the audio signal in. On my previous project I used the Teensy Audio Adapter Board, but I didn't really have the space for it this time, nor the inclination to spend that much again. I've had some minor issues with analogue audio noise before so the S/PDIF digital audio capabilities of the Teensy were appealing - I could use that for bit perfect audio! The Teensy expects a TTL level signal though, so an adapter circuit was needed. I found a circuit using 74HC04 inverters that worked perfectly.
With working hardware and code I wanted to put my brand new miniature spectrum analyser to use, but the usual prototype issue remained: bare PCBs and breadboards are not the most pretty. While I know several 3D printing aficionados who I'm sure could print something for me if I designed it, I wasn't feeling going through the 3D printed case design process. I had great luck with a Hammond enclosure for some previous projects though, and enough hunting led me to a perfectly sized Pi Zero box, the RP1035C. So, now to tidy up the breadboard onto a bit of strip-board and put it in the box!
Yes, that putting it in a box. I needed jacks for the S/PDIF and micro USB, so one standard RCA jack and one small micro USB panel mount adapter I was ready to drill some holes and file to perfection. As usual this a bit of a slow process, but satisfying when finished.
Fitting everything in was a tight squeeze. The stack of components from ToZero to Microdot hat is tall and takes up most of the space in the box. The panel jack extension was too long and the micro USB plug end too big, so I ended up cutting it off and soldering on a DIY micro USB plug, which was much shorter. I positioned the heights of the RCA and USB panel to fit in the empty spaces between PCBs and I was pleased to find it all fit. Everything is held roughly in place inside the case using card paper from a frozen pizza - recycling at it's finest!
So the grand reveal has already been revealed by the video showing it in action at the top of the page, but here's a nice photo of my brand new analyser lit up in action!