Arduino Goes to Town, Part 1.


This post will be about the use of a microcontroller like Arduino Uno in an audio context. The first use case as mentioned in my previous post was to use it to implement the input switching logic and prevent key bounce. I will get to that in detail but first lets take a look at all design objectives.

Letting the Arduino drive something replacing the VU-meters got me thinking about something like this 32-Band Audio Spectrum Visualizer Analyzer. It would not only replace the VU-meter panel but the supporting boards too. It would add its own requirements so the first issue was to sort out the overall integration. First of all, the analog frontend. Most similar project I found on the Internet used something like this to interface the ADC on the Arduino:
I guess it somewhat does whats needed, it AC-couples both channels, sums left and right channels to mono, offsets the signal since the ADC can't measure negative voltages. But I had a couple of concerns if I would put something like that into my amplifier. Things like crosstalk, loading and noise. I therefor quickly put together a circuit like this:
It could have been made much more elegant but I wanted to keep it minimal and simple. I already got a +15-0-15V power supply in the amp so I went with a dual rail design but a single rail would have worked just as good with another opamp. I went with the TL072 because I wanted something cheap, unity gain stable and low offset. The circuit does a lot with just a few components. The first stage is used as a summing amp. It presents a high input impedance to the source to offload it even when connected in parallel with the preamp stage. The inverting buffer is a virtual earth (ground) circuit and it is used here to prevent crosstalk. The stage is unity gain in the schematics above but this is where you put any amplification if needed, I personally replaced R2 with a 20k resistor. Why would you need amplification? The signal is already +6 dB just by summing two channels. But what if you only got a mono signal and your ADC does not support a 3.3V AREF? Making R2  = 20k will add another 6 dB if needed. C2 is the AC-coupling capacitor blocking DC and also serves as a first order high pass filter. The trimpot VR1 in between the stages act as an attenuator in order to adjust and set the output level.

The second stage is also inverting so it will rectify the phase even if its not really needed in this context. It is biased through the R7/R8 voltage divider splitting 3.3V in half. The 3.3V is taken from the 3V3 pin on the Arduino and is also used to feed the AREF with an external voltage reference instead of using the more common internal 5V. Why? Because my preamp got a 1Vrms sensitivity. 1Vrms equals 2.83V peak-to-peak and that is closer to 3.3V than 5V. So we gain a bit resolution and the 3.3V pin is supposed to be a bit more stable than the 5V. You could of course feed another AREF voltage trough J5 if it better suits your hardware.

The second stage is unity gain and is followed by R6/C2 that forms a first order low pass filter. It is also preloading the ADC pin a bit but the main purpose is to counter the Nyquist frequency. First order is better than none but C1 is used to add another first order low pass filter in order to steepen it to a second order in total with a F3 of around 18kHz (more about why later). The components around J6 and J7 was added to interface the LDR and the mode switch. They have no function in this context but made sense on the PCB as an integration block. J5 is feed from the 3V3 pin on the Arduino and it also act as a passthrough to the AREF pin. J4 is the power connector connected to the +15-0-15V power supply in the amp. J3 is the connector connected to one of the ADC pins on the Arduino. J1/J2 is where the audio source is connected to the frontend. I connected it in parallel with the DSP (acting as the preamp). The signal is taken from the output of the input switching board.

Next up was the visualisation of the "spectrum analyser". My initial thought was to make something out of a set of WS2812B LEDs. Browsing through the web I got a bit carried away and bought a Longruner WS2812B Led Strip Panel Kit Matrix 8x32 256 Pixels. I did it without thinking too much about it. First wakeup call, 256 WS2812B LEDs can draw quite some current, 75W @ 5V -> 15 A. Ouch, and I don't even got a 5V supply in the amp! So I quickly added a Mean Well LRS-50-5 to the shopping list. It is not 75W but I am not going to drive the LEDs anywhere near 100% simultaneously. Thats about it from a hardware perspective. The Mode switch and LDR from the VU-meter setup will be reused and interfaced through J6/J7 in the schematics above. The 32x8 WS2812B matrix will be powered by the LRS-50-5 and the Arduino will be powered by the existing 12V power supply (the one driving the relays in my amp). Everything needs to share a common ground, like this:


That is the overall idea. Next up is the programming of the Arduino. Stay tuned...