r/electronics • u/Appropriate-Line5968 • 10h ago
Project Spectrum visualizer with clock and weather station
https://gearip.net/spectrum-visualizer-with-weather-station/
This is an audio spectrum visualizer I built around the ESP32-S3 Espressif DevKit and the Adafruit 64×32 RGB matrix. The device shows the spectrum graph while audio signal is detected at the RCA inputs and defaults to a screens showing the clock and weather details using WiFi.










Electronics and PCB design
The central piece of the project is the ESP32-S3 Dev board from Espressif. It drives the RGB matrix (Adafruit 2279, 62×32 pixels, 3mm pitch). Since the ESP32-S3 outputs 3.3V signals, level shifters SN74HCT245N wer used to step up the voltage to the 5V needed by the RGB matrix. I’ve tried on the breadboard without the level shifter and the matrix was driven without problems, but the voltage is at the limit where the matrix could not handle it properly so I decided to use the level shifters. Between the SN74HCT245N chips and the matrix I placed 33 ohm resistors to help with ringing (voltage spikes and oscillations) and voltage overshoot on the ribbon cable that connects the PCB to the matrix. I actually used 4116R-1-330LF resistor arrays for space and simplicity reasons. The buffer chips have their DIR pins tied to HIGH to enable them to pass signals from A side (ESP32) to B side (matrix).
R17 is a pull-up resistor that keeps the display blank which the buffers are disable during initialization. It’s not essential, but without it, until the ESP32 initializes and the buffers are disabled and in high impedance mode, you’ll see weird flashes and figures on the display. R13 is the pull-up resistor that keeps the buffers disabled until ESP32 fully initializes. R3-R5 keep the unused pins of the buffers to a logic LOW rather than leaving them floating.
J2 is the connector of the ribbon cable that links to the RGB matrix that follows the HUB75 standard. It carries six color data signals (R1, G1, B1 and R2, G2, B2) for the pannels’s upper and lower halves, row address signals (A-D), clock (CLK), latch (LAT), output enable (OE) and GND. The matrix receives 5V power from the PSU on a separate cable.
The analog part of the PCB does the isolation and mixing of the audio source and shift the signal over 0V to prepare it for the ESP32 ADC.
The device is designed to be run in parallel with a power amp signal input. So it shouldn’t interfere with L/R channel separation or add noise to the audio source. Initially I tested without the transformers but I got noise back in the amplifier probably from the ESP32 digital side, matrix signals or WiFi. So I found these relatively cheap Triad TY-250P transformers. They have 1Kohm impedance on primary and secondary. RV1 adjusts the signal level so it doesn’t go over the 3.3V needed for the ESP32 ADC and to avoid clipping.
The most important part of this opamp section is to shift the level of the audio signal in the positive range. Normally an audio signal swings both positive and negative relative to ground. The ESP32 ADC can only handle voltages on the positive side. So to preserve the full waveform of the signal (both halves), the circuit adds a DC bias. R9 and R10 establish a reference of around 1.67V, which becomes the center voltage of the amplifier’s output.
R12/C19 and R18/C21 for a passive low-pass filter before the signal reaches GPIO1, to attenuate high-frequency signals and noise before sampling, to reduce aliasing. The cutoff is at about 20KHz. It’s important that C21 (1nF) is placed as close as possible to ESP32 GPIO1 to reduce interferences picked up by the circuit from WiFi or other digital signals. I’ve been experimenting all kinds of interference while on breadboard.
I ordered the PCB from JLCPCB, I couldn’t dream of etching it myself, too complex and double-sided. There’s a keepout area around the Wi-Fi antenna to avoid blocking the signal. There’s sockets for all ICs and the ESP32 Dev board. You can find the KiCAD files for the schematic and PCB at the end of the article.
I used a small 5A switching power supply to powers the RGB matrix and the PCB separately. The RGB matrix can (theoretically) draw up to 4A at 5V, but I haven’t seen anywhere near that. During operation, the PSU is just a bit warm.
ESP32-S3 Firmware
The firmware is written in C++ using the Arduino framework. It handles audio sampling and analysis, matrix rendering and clock, WiFi and weather functions. The ESP32 is sampling the mono audio signal received at GPIO1 at 40.000 samples per second. I fiddled around with Codex to display the spectrum accurately and it ended up splitting the dividing the spectrum between high and low frequencies, with different sampling rates and FFT sizes. The result is mapped to the 64 columns of the matrix covering the audio spectrum from 40Hz to 16KHz, which I found to be adequate. The frequency spacing is logarithmic, giving more space to lower frequencies. The bars rise quickly and fall more slowly, while white peak markers decay separately.
To accomodate for a signal that is picked up after volume control I added a global dynamics compressor that adjusts the scale of the spectrum analyzer.
There is no noticeable flicker or refresh on the display; I struggled with that as well for a while.
With no detectable audio signal for 30 seconds, the display switches to the clock and weather screen. It switches back to spectrum after 2 seconds of sustained audio signal. The screen shows the NTP synchronized clock at the top, then current temperature, today’s maximum and general weather conditions. After 18:00 it shows next day’s maximum and conditions, with an “N” in front. The weather data is pulled from open-meteo.com. If you use the same firmware, modify the location and add your WiFi SSID and password. Brightness changes from maximum during daytime and a lower setting after sunset (also linked to the location set in the code).
You’ll find the code at the end of the article.
Chassis build
I have to admit this was the hardest part for me. I designed the case in Fusion, without having any prior knowledge whatsoever about Fusion and product design, so it was a steep learning curve.
Having 3D models of the PSU, power connector and RCA connectors from the vendors helped a lot. I imported the PCB STEP model from KiCAD and built a model for the Adafruit matrix, of which I only had a picture with measurements. After I had all that built and imported I could build around them the case, that consists of 3 parts – a front frame that supports a glued acryl white translucid “window”, a middle chassis that has supports for the matrix and a back lid on which the PCB, PSU and connectors are mounted. For me, the hardest mental excercise was imagining how everything will be organized, where the acryl will sit, how will the matrix be mounted to sit behind the acryl and still leave 1mm of space for diffusing effect and where the other components will be screwed in. That on top of my total ignorance regarding Fusion.
The front frame has a recessed “pocket” that thins the normally 2mm wall of the frame to only 1mm and adds a 2mm lip around the acryl. The acryl is glued in that pocket. There are mounting posts in the corners for M3 inserts to connect with the middle chassis part with screws. This part was also new for me, using the inserts, but I found out it to be not that complicated. You can just use a soldering iron with a thicker tip to heat the inserts and then press them into the plastic. Leave 0.5-1mm of the insert above the rim and the use a flat object to press it down and cool it.
The middle chassis part also has posts to connect to the back lid, diagonal slots for ventilation and big “ears” to hold the matrix. The back lid has a cutout for the power connector, as described in the vendor’s documentation and cutouts for the RCA connectors. The PSU is sitting on posts and has its own threads for M3 screws. The reason I used posts is to shift the weight center inwards to the chassis so it doesn’t tip over easily. The PSU has a metal chassis and should be earthed but I didn’t have room for a big power connector with PE, so to counter that I’m ordering some (pretty expensive) M3 screws made from PEEK (Polyetheretherketone) which is an insulator. That way, even if the PSU chassis gets connected to mains, the screws won’t connect that to the outside. I should I add that this is not a replacement for the requirement to connect PE to the chassis of the PSU, so don’t launch this product commercially 🙂
M3 insert and chassis “lip”
RGB matrix screwed on the middle chassis
Repository with KiCAD schematic and PCB files, code and 3D models for print: https://github.com/gabriel-gearip/spectrum-analyzer.
And a sample of the spectrum analyzer in action: https://youtu.be/PjzRuayRK4k?si=L_JQ4ZCLeP2Vl_IA