Classic Analog Spectrum Analyzer for Your Desktop

by emdee401 in Circuits > Electronics

17353 Views, 181 Favorites, 0 Comments

Classic Analog Spectrum Analyzer for Your Desktop

IMG_5662.jpg
IMG_5654.jpg
IMG_5670.jpg
bodeplotbig.jpg

This is a spectrum analyzer that visualizes 10 audio frequency bands. Although it might look like just another FFT ESP32 project, it is most certainly not! This design uses a PCB that I designed and build and although it involves an ESP32, it doesn't involve FFT. ( A digital way to determine what frequencies are embedded in a signal). The analysis of the input signal is actually done by 10 good old fashion opamp driven, band filters.

An ESP32 is used to host a webserver for visualization and to drive all the leds on the acrylic display.

Here are some of the specifications:

  • 10 Opamp based band pass filters
  • Onboard Power supply 12V input/4A to onboard 5V/3.3V
  • Microphone and Line input
  • Onboard multiplexor to switch between audio signals
  • Onboard Analog switch to toggle between input signals
  • Operating panel with 3 potmeters and 2 switches
  • Onboard pre-amplifiers
  • Onboard input protection against wrong polarity and over-current
  • All hardware and software are open source

Supplies

IMG_5595.jpg
pcbtop.jpg
images.jpg

You Need the following materials.:

  • PCB buy here ( pre assembled including smt components )
  • or bare PCB without components @PCBWAY.com
  • LEDSTRIP 74Leds / Mtr ( Ws2812 or simular, Other size possible if you deviate from my housing design)
  • Acrylic 5mm black ( or other color is you prefer)
  • acrylic 10mm transparent to create the tiles.
  • ESP32 DevKit1 ( you can use other ESP32 but I wrote the firmware for this one)
  • Some wire and connectors for audio and power
  • A power switch to your liking
  • A power supply 12V / 4 A

Also you will need some tools skills:

  • Soldering skills to hook up some wires
  • advanced soldering skills if you decide to assemble the PCB yourself (not recommended)
  • You'll have to glue together the parts of the housing if you decide to stick with my acrylic design
  • In that case, you'll also need a laser cutter of know someone who can cut the acrylic for you.
  • And finally, you'll need to be able to install the ESP32 libaries and boards and for that you need to know your way around Arduino environment. Although, all of that can be done using some tutorials because it is not that spectacular if you have the right guidance

All sofware ( sketch) hardware design, schematics, pcb layout etc is available at my Github:

Github for Analog Analyzer

Assembling the Housing

539813_BB_00_FB.EPS_1000.jpg
IMG_5597.jpg
IMG_5608.jpg
IMG_5599.jpg
IMG_5606.jpg
IMG_5628.jpg
wiring ledstrip.jpg
IMG_5617.jpg

To glue all the parts of the housing together, I used this glue: Evonik Acrifix 1R0192

Other glue for acrylic might also work fine.

step 1: I started with the backplate and glued the inside spacer plate on top. This plate has a zig-zag cutout where the ledstrip can be placed.

Step 2: Internally wire up the LED strips. Take note that you line them up properly. There can be a diviation in size and LED spacing, depending on who manufactured it. That's why I cut my strips into sections of 6 leds and line up each one individually. The design files for the backing plate includes some engraving to help you line up the LEDS.

Step 3: If you have the possibility, try out the leds before you glue on the top plate. You can also decide to glue the top plate later.

Step 4: connect the connection wires to the first ledstrip because you won't be able to do this later.

Step 5: glue on the top plate. Make sure it lines up with the other plates

Step 6: assemble the bottom housing. I used a L shaped rules to help me line up all at a 90° angle. Don't use to much glue! If you do, you might end up with glue on the outside of the unit and you don't want that!

The bottom plate is not glued but attached with little screws later.



Placing the Tiles for the LEDS

IMG_5672.jpg
IMG_5671.jpg

I used the same glue to attach the tiles, however, I only attach 2 dots of glue on the side of the tile that goes into the backplate. One dot to the left and the other to the right.

I used a L shaped ruler to make sure the tile is place under a right angle. Also, my advise is to glue one row at a time to make sure the tiles line up. When applying glue, work in pairs of 3 or 4 because the glue hardens rather fast.

If you won't more visibility of the tiles when the leds are on, glacing them will help. Although it is a lot of work, I used sandpaper on the front side of the tiles to 'roughen' them up. that way, the light from the leds is way more visible.

Placing the PCB, Control Interface,Logo Ledstrip and Mic

IMG_5623.jpg
IMG_5673.jpg
IMG_5680.jpg
IMG_5669.jpg
IMG_5681.jpg
IMG_5675.jpg
IMG_5684.jpg
IMG_5618.jpg

The PCB is attached to the bottom plate. I drilled some hole in the plate and used nut bolt and spacers to mount it.

The operating panel was put in place. I glued a piece of 'left over' acrylic just behind it to keep it in place. Wire it up first!

A similar thing was done for the LEDstrip of the Logo; I glued a 'left over' piece of acrylic and glued it to the housing, just behind the logo. Make sure to wire up the LEDstrip before you put it in place.

The microphone was glued to the acrylic housing, covering the little mic hole next to the operating panel

Warning:

Using many Leds at higher brightness will ask a lot of power ( amps ) from your power supply. Above that, the onboard regulator is calculated for 4A but even at 2A, it will get hot. You might want to consider feeding the LEDS not trough the board but directly from a 5A power supply. IF you don’t, I highly recommend using a heatsink to be placed on top op the regulator U14

Wiring It All Up

IMG_5679.jpg
IMG_5677.jpg
IMG_5619.jpg
wireing.JPG

The wiring is not that difficult.

I used shielded wire to connect the microphone and the audio input and I used some general wire for everything else.

Give some extra attention to the power lines that feed the LED Strips. You must wire the data lines in series, meaning that the data out of one strip will be connected to the data in of the next. Etc. You can also do that with the power lines.

In the photo's you'll see what might look like some chaotic wiring. Make sure you tie them down nicely using some Tyraps or simular.

The wiring is straight forward:

  • Power
  • Audio in
  • Microphone in
  • Ledstrip for logo
  • Ledmatrix/ Ledstrips
  • Front operating panel to main PCB

Look at the photo for more details

Programming the ESP32

programming.png
usb.jpg

I used the Arduino IDE. It is freely available online and it does the job. You can also use Visual Studio or some other great IDE. However, it is important the right library and it is best not to install what you don't need as it might give you errors when compiling. Make sure that your Arduino IDE is set for using the ESP32. If you don't know how to do so, google or look it a youtube video. There are some very clear instructions and setting up the IDE is not hard. You can do it! In a nutshell, it comes down to this:

  • In the Ide preferences window, look for the line: Additional Boards Manager and add the following line;

https://dl.espressif.com/dl/package_esp32_index.json

  • Go to your board manager and look for ESP32 and install the ESP32 from Espressif Systems.
  •  Select the correct board before you compile and you are good to go

When your Arduino IDE ( or whatever you use) is ready set go....you can continue compiling the sketch.

When compiling is done without error, you can upload the sketch to your ESP32. If you cannot get it to upload while USB is set correctly, try taking the ESP32 out of it's socket and try again ( you did use sockets when soldering this to the PCB, right?)

If you cant get it to compile in the first place, try to see if any of the libraries are missing and install them if needed.

I used the following libraries:

  • FastLED_NeoMatrix                        at version 1.1                    
  • Framebuffer_GFX                            at version 1.0                                    
  • FastLED                                              at version 3.4.0                                                
  • Adafruit_GFX_Library                     at version 1.10.4
  • EasyButton                                        at version 2.0.1                
  • WiFi                                                     at version 1.0                                                    
  • WebServer                                        at version 1.0                                    
  • WebSockets                                       at version 2.1.4                
  • WiFiClientSecure                              at version 1.0    
  • Ticker                                                  at version 1.1                                                    
  • WiFiManager                                     at version 2.0.5-beta      
  • Update                                                at version 1.0                                                    
  • DNSServer                                         at version 1.1.0                                
  • Adafruit_BusIO                                 at version 1.7.1
  • Wire                                                    at version 1.0.1                                                
  • SPI                                                     at version 1.0                                                    
  • FS                                                      at version 1.0    

Remark: I had some trouble compiling when I started. Turned out that Arduino IDE had many libraries activated and it decided to choose the wrong ones whenever it had to choose between libraries. I solved it by uninstalling the Arduino IDE and re-installing it from scratch.

 

Also, since some libraries are included with others, maybe this helps. Try sticking to these first:

  • #include <FastLED_NeoMatrix.h>
  • #include <Adafruit_GFX.h>
  • #include <pixeltypes.h>
  • #include <EasyButton.h>
  • #include <WiFi.h>
  • #include <WebServer.h>
  • #include <WebSocketsServer.h>
  • #include <Ticker.h>
  • #include <WiFiManager.h>



Operating the Unit

IMG_5658.jpg

You can use the microphone in to connect a small condenser microphone or you can connect your audio device to the line input connectors. Although the signal from the microphone is amplified on the PCB, it might not be strong enough. Depending on your microphone, you can adjust resistor R52; decreasing it’s value will amplify the signal more. In my prototype I replaced it with a resistor of 0 Ohm ( I shorted it). However, when using a different mic, I had to increase it again to 20K. So it all depends on your mic.

Mode button

The mode button has 3 functions:

Short press: change pattern(mode), there are 12 available patterns from which the last one is a fire screensaver.

Fast triple press: The VU meter that is displayed on the top row can be disabled/enabled

Pressed/ hold while booting: This will reset your stored WIFI settings. In case you need to change your WIFI settings or in case your system keeps rebooting, this is where to start!

Select Button

The select button has 3 functions:

Short press: Toggle between line-in and microphone input.

Long press: Press for 3 seconds to toggle “the auto change patterns” mode. When enabled, the pattern that is shown changes every few seconds. Also, when the button is pressed long enough, the Dutch national Flag will be shown. That’s how you know you’ve pressed long enough!

Double press: The direction of the falling peak will change.

Brightness Potmeter

You can use this to adjust the overall brightness of all leds / display. WARNING:Make sure you use a power supply to match the current for the brightness that you set. For sure, the ESP32 onboard regulator cannot handle all leds at full brightness. It is best to use an external powersupply that can handle 4 to 6 A. If you are using the USB cable that is connected to the ESP32, you might end up with a burning sensation coming from the ESP32 Board.

Peak Delay Potmeter

You can use this to adjust the time it takes for a peak to fall down to / rise up from the stack

Sensitivity Potmeter

You can use this to adjust the sensitivity of the input. It’s like cranking up the volume for lower signal inputs.

Serial Monitor

The serial monitor is your friend, it displays all info on booting, including your web server IP address.

Screensaver

When the input signal goes quet, a screensaver will kick in after a few seconds and the display / leds will show a fire animation. As soon as the input signal is back, the unit goes back in to normal mode

The Webinterface

webmanager.png
tempsnip.png

This firmware uses a webinterface that needs to be configured.

If you haven't used the web manager on this ESP32 before and there are now settings stored from a previous design in it's memory, after booting, the webmanager will take over.

If it keeps rebooting, there is a big change that settings are stored that are not working. Maybe from a previous build or maybe you made a typing error in your wifi password? You can force the ESP32 to boot to WIFI manager by holding down the mode button while powering on.

You can see the web address you need to connect to in the serial manager. However, first you need to connect to the access point it has created. ESP32 no password is required. You can do this by using any device with a browser like phone or tabled.

After that, visit the web address that is given by IP number in the serial monitor and follow the instructions to setup your WIFI access. When done, manually reboot your ESP32.

After booting, the new P address will be visible in the serial monitor. Visit this new ip adress with your browser to see the analyzer web interface.

If the wifi manager doesn't appear after booting, or if you need to change your WIFI settings, you can press and hold the mode button while pressing the reset button.

When your WIFI connection is set up, you can access you webserver's IP address to see the live spectrum analyzer.

It will show you all 10 channels in real time.

Show and Tell Your Friends About Your Amazing Build

IMG_5659.jpg
IMG_5660.jpg
IMG_5664.jpg
IMG_5668.jpg
Desktop Spectrum Analyzer with Analog Design

At this point, you were able to build an amazing device: A fully functional Spectrum analyser. It's a nice display in your living room isn't?

Don't forget to show your friends and family. Share it on social media and feel free to tag me!

https://www.youtube.com/watch?v=J-84QGtK8YU

🔀Let's connect

You like me work, please buy me a coffee to help me to burn the midnight oil.