Wireless Audio Visualizer – Part II

This post is about the wireless module that receives data from the base station described in Wireless Audio Visualizer – Part I and visualizes it on two VU-meters and a TFT display.

Since the AI-Thinker AudioKit base station from Part I does most of the heavy lifting, all that’s left for the wireless module is a rather simple visualization of the received data. That’s why the code for my setup (below) probably needs no further explanation, even if you decide to use different components.

My own choice of components for this module (see picture) were entirely determined by what I had lying on the shelf, and by the size of my lunch box, that I was prepared to sacrifice for the good cause. Otherwise, using an 52 M5Stack Core 2 would be a very expensive overkill (and I don’t even use its entire display). Even the cheapest ESP32 and a small display can do the job. Besides, these panel meters are also available with an LED backlight, what would make the DC converter in my setup obsolete. That said, my lunch box and the M5Stack seemed to be just made for each other and I definitely prefer the warm glow of incandescent bulbs over LEDs.

 

 

An even cheaper solution is emulating the VU-meters on two displays, for instance TTGO T-Display boards, that I used for my first YouTube video.

So it all depends on how much money you want to spend and what you want your module to show (and how). Note that using a different M5Stack core module could be a problem. Both my Gray and Fire have their speaker hard-wired to one of the DAC pins, so you would have to physically remove it. Which is probably a good idea anyway, as at least the Gray will click with every call to analogRead(). Nice looks, poor electronic design.

Wiring of analog panel meters

All analog panel VU-meters that I have come across so far have similar specs, but I’m far from an electronics expert, so if you use my wiring, make sure that their resistance is about 650Ω and their current limit 0.5 mA max.

As my code drives these meters from the ESP32’s 3.3V DACs (GPIO 25 & 26), we need to add current limiting resistors in series. For meters with the above specs, their value R follows from 3.3 = 0.0005 * (R + 650), which means that we would need two 6K resistors. For my module, however, I used the wiring scheme from an earlier (currently archived) post, using a 4K7 resistor and a flyback diode for each meter, and it works great.

My code has a variable maxDac that takes its value (in the [50, 255] range) from a potentiometer reading:

For testing whether your resistor’s value is safe for your type of meter, you can temporarily hard-code the value of maxDac, starting with a low value, or play with the range of the map command.

If you use a display without touch and want one of the spectrum variants to be displayed instead of the default logo / battery indicator, just set the value of variable spectrum in the code to 1 for a leaking peak spectrum and to 2 for the 3-color version.

Finally, you’ll need to upload 6 small jpg files to SPIFFS. They can be found here.

Here is the complete code for an M5Stack Core 2, with analog panel meters connected to pins 25 & 26 and a 10K potentiometer connected to pin 35 (‘sensitivity’ control).