Introduction: Twin Audio Visualizer
This Spectrum Analyzer project is nothing other than amazing. It includes a Teensy microcontroller board that drives 2 displays simultaneously at a very high speed. Combined with a Teensy Audio Board, it is capable of doing a frequency analysis of the Audio in realtime to create a Stereo spectrum analyzer of 69 Channels.
Yep you understood me correctly! 69 channels in stereo…so that’s actually 138 frequency bins. On top of that, we will be displaying a stereo VU meter on the second display. So more or less we are really dealing with 140 channels.
Best of all: It's open source!
You will need:
- PCB with all components ( buy it pre-assembled or buy PCB only and add your own components)
- Buy it at my Tindy store
- Use the gerbers to manufactor your own PCB. I suggets to use PCBWAY.COM
- Two Displays type: ILI9341 this is the 2.8" version. You can also use the 3.2" version
- Teensy Audio Board ( min rev. d)
- Teensy 4.1 microcontroller Board
- External Ram for the Teensy ( you need to solder that on to the teensy board)
- Fuse 2AT TR5 if you are using the onboard PSU ( you can use USB on teensy instead )
- Some headers and socket to mount the Teensy and Audio board onto the PCB
- One electret microphone if you'r using mic input
- Two push buttons to operate
- One IR sensor if you want to use a remote control ( optional )
Step 1: Add External RAM to Your Teensy
We will be using two display and each display will use a few screen buffers. As the buffers are rather large in size, with the number of buffers we need, the internal memory is not enough. We need to add extra memory. Lukely for us, the Teensy 4.1 had the possibility to add an extra memory Chip.
I bought the Teensy 4.1 here: https://opencircuit.nl/product/teensy-4-1
You will need to add PSRAM on the intended socket as shown in the photo.
I used this chip: 8MB PSRAM64 I bought here: https://opencircuit.nl/product/8-MB-PSRAM-chip-voor-Teensy-4.1
Step 2: Mount the Basic Components on the PCB
If you bought a PCB with pre-assembled components, you can skip this step.
Attached you'll find a list of all components you'll need to assemble the PCB.
The assembly picture will show you where to put what component.
Remember to start with the smallest components first; trust me, it will make your soldering life easier.
Step 3: Add the OEM Components
I recommend using headers and sockets to mount the Teensy and Audio Board onto the PCB. That way you can take them off again if needed.
I used these:
Two Displays type: ILI9341 this is the 2.8" version. You can also use the 3.2" version
Take note: The displays are the only components that are mounted on the bottom side of the PCB!
Step 4: Connecting a Few Wires
Since most components are directly connected to the pcb, the number of needed wires are kept to a minimum
Step 5: Adding the TEENSY Board Plugin to Arduino
I used Arduino IDE with Teesyduino:
- Arduino IDE 1.8.15
- Teensyduino, Version 1.54
You can download ARduino here: ARduino IDE Download
Make sure you use the Arduino IDE and not the windows app ( incompatible with the Teensyduino )
You can download Teensyduino here: Download TeensyDuino
Step 6: Adding the Needed Libraries
I did a succesful compilation using the following library versions:
- Using library Wire at version 1.0
- Using library Audio at version 1.3
- Using library SPI at version 1.0
- Using library SD at version 2.0.0
- Using library SdFat at version 2.1.0
- Using library SerialFlash at version 0.5
- Using library ILI9341_T4-main at version 0.1
- Using library tgx-main at version 0.5
- Using library EEPROM at version 2.0
- Using library OneButton at version 2.0.4
- Using library IRremote at version 3.6.1
- Using library TeensyID-main at version 1.3.3
- Using library ILI9488_t3 at version 1.0
Some of the mentioned library are part of the Arduino and/or Teensy framework but others need installing:
- TGX - a tiny/teensy graphics library: <https://github.com/vindar/tgx>
- Arduino OneButton Library: <https://github.com/mathertel/OneButton> (install via the Arduino library manager)
- IRremote Arduino Library: <https://github.com/Arduino-IRremote/Arduino-IRremote>
- TeensyID: https://github.com/sstaub/TeensyID
- Optimized ILI9341 screen driver library for Teensy 4/4.1, <https://github.com/vindar/ILI9341_T4>
Step 7: Programming
First you'll need to download the sketch here:
Now, the actual sketch you need to open is in de firmware/1.0Dual folder., look for the AudioVisualizer.ino file.
However, pay attention. best way to proceed is to copy all the files in that folder to a new folder named AudioVisualizer.
It is important that all files stay together so if your Arduino want to rename the folder after opening, fine,,but make sure you copy all the other files to that folder. If you don't, compiling will give you error's like "not found"..
Compile and upload the sketch.
In case the upload to the Teensy will not start, you can press the button on the Teensy to help you.
Step 8: Operating the Unit
To operate the unit and how to use the IR remote etc. Let me refer you to the orginal sketch by DIY-lab. You can find all info on the github here: original sketch and info
It also included more info on the ConfigTool. The config tool allows you to changes colors and layout of the display without having to change the sketch.
Pay attention.. everything you change in the ConfigTool, only applies to the main display at this time.
The Second display remains unchanged at all times and cannot be changed without changing the sketch.
Maybe this is something for a future update.
You can use the ConfigTool ( it's in the github repository that you downloaded in step 7) to change the looks of the main display. It also gives you the possibility to change the number of bands, colors and to do a calibration. Some examples are shown in the photo's. Let me say it again...the ConfigTool is part of the first release by DIYlab. They did an amazing job, check out there website here: Website DIYLab
Now, in addition to the orginal sketch, a few functionalities where added:
- Second display that always shows a Black Analog Stereo VU meter
- Extra Switch to toggle the input between microphone and line-in
Step 9: Future Plans
I designed the hardware in a way that I can use it for future plans. The pcb included connectors for 4 external potentiometers that can be used in future update's to control things like sensitivity, delay, color etc. I also included to connections for Pixelled matrixes. The idea is that I can use one pixelled output for dring some WS2812 leds to add an external display, for example an Acryllic Spectrum Analyzer display. The other pixelled output will be used to drive a few pixelled in rainbow mode and can be used to illuminate a acryllic housing.
However, at this time, the ideas above are not implemented but will be in the very near future.
Step 10: Show and Tell
Did you build this Twin Audio Visualizer? Let me know in the comments and show us your results. We love to see it!
Remember, you worked on it for hours and the result is something to be proud off!
I know I am :-) Here is my result, enjoy the show and don't forget to click "like" and feel free to subsribe to my channel.
Participated in the
Colors of the Rainbow Contest