Introduction: Twin Display Pixel Matrix Analyzer
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. With it's onboard audio chip, 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.
But there is more: It can drive up to 3 pixel led matrixes at the same time.. so that adds another 768 LEDS
Best of all: It's open source!
Supplies
You will need:
- PCB with all components ( buy it pre-assembled or buy PCB only and add your own components)
- But it at my tindy store, all you need to add is displays, a fuse and a teensy controller 4.1 : BUY PCB HERE
- Use the gerbers to manufactor your own PCB. I suggets to use PCBWAY.COM You can download the needed gerber files here: DOWNLOAD GERBER FILES
- Two Displays type: ILI9341 this is the 2.8" version. You can also use the 3.2" version
- 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 or connectors to connect the wires, or solder directly onto to board.
- Headers
- Sockets
- One electret microphone if you'r using mic input
- Three push buttons to operate ( Two if you're not using the pixelled matrix )
- Three Potmeters, I use 10K versions ( only needed when you add the pixelled matrix)
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: Solder the 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: Adding the Remaining Components
There are only a few components you need to add.
There is the Teensy Module with the added extra RAM
Two Displays
A fuse of 2A if you are planning to use the onboard powersupply. If you are using the Teensy USB connector, you don't have to add that fuse.
You have to add some headers and sockets to install the displays and the Teensy. I wouldn'r recommend to leave those out. At some point, you might want to change some of those components and soldering those directly to the board will make that hard.
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
You can look at the schematic for details, however in short, it comes down to this:
Potmeters ( brightness, peak delay, input gain) only if you are using a led matrix wil go to connectors CN5,CN6 and CN10. Connect the center of each potmeter to the center pin of the connector. connect the other 2 pins of the potmeter to the remaining pins of each connector. If your potmeter is reacting CCW instead of CW, or vise versa, simply swop the outer two pins of that potmeter.
Switches:
switch 1: CN2
Switch 2: CN4
Switch 3: CN12 pins labeled (- and s )
Microphone goes to connector CN11
Line in goes to connector CN3; the two outher pins are ground and the two inner pins are channel L and R
Power in goed to U1, pay attention to the markings on the board: + and - use 8-12VDC
Ledmatrix ( I used 3 matrixes in series. each matrix has 16 x 16 leds ) Connector CN10, look at the markings on the pcb to see the +,- and L ( L = data line )
Step 5: Entering the World of the Matrix
I used a matrix of pixelleds that you can buy pre-assembled.
The one i used is this: 16 x 16 matrix I put three of those in series.
You could use other matrixes as well, even ledstrips could work but you wil have to adjust the firmware of this project.
Also, if you are using different kind of matrix, leds or ledstrip, you might have to change those settings in the firmware as well:
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(kMatrixWidth, kMatrixHeight, LED_PIN,
NEO_MATRIX_BOTTOM + NEO_MATRIX_RIGHT +
NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG,
NEO_GRB + NEO_KHZ800);
Step 6: 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
Click here for a tutorial about installing Arduino
Make sure you use the Arduino IDE and not the windows app ( incompatible with the Teensyduino )
You can download Teensyduino here: Download TeensyDuino
Step 7: 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
- Using library Adafruit_NeoMatrix at version 1.2.0
- Using library Adafruit_NeoPixel at version 1.7.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 8: Programming
First you'll need to download the sketch here:
Best way to proceed is to copy all the files to a new folder.
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 9: Operating the Unit
You don't need a manual to operate this unit.
It's straight forward.
Use the mic or hook up an audio source. There is one push button to select what input you are using
Another push button select the screen that is showing on the right display
The last switch is to select what pattern is displayed on the pixelled matrix
There are also 3 potmeters. ( 10....50K will do the job )
potmeter 1: Leddisplay intensity
potmeter 2: led display gain
potmeter 3: Peak delay time. ( how long before peak falls down to stack)
Step 10: A Nice Housing for This Unit
Step 11: Show and Tell
What better example then a video: https://youtu.be/MJjbBZXGAYU