High Level Speaker Signal Output into ESP32/Arduino

An opto-isolator is completely "safe" but they are not linear.

You need a voltage divider (2 resistors) and a protection circuit to protect against negative voltages. It "wouldn't hurt" to also protect against "unexpected" high positive voltages. The protection circuit requires a current-limiting resistor but the voltage divider can also serve that purpose so it's just one or two diodes.

Another handy circuit is a peak detector (if a peak meter is OK). Otherwise you are "sampling" a waveform (or half a waveform) and you'll have to find the peak, average, or RMS, in software.

The basic power calculation is Watts = Voltage x Current. But it can also be calculated as
Watts = Voltage squared / Resistance.

So, 100W into 4-Ohms is 20V RMS = 28V peak = 56V peak-to-peak.

The resistance of your voltage divider isn't critical... It's the ratio that's important. But the resistors should be high-enough that they don't dissipate too much power and burn-up. The resistors can sum-up to around 10K and everything should be fine.

You probably will need a pot (or something) unless you want the "top" of the meter to always represent 100W.

I made a "giant VU meter effect". It works at audio line-level and it's just a visual effect and totally useless as a "meter". The software automatically and continuously (slowly) adjusts so the top of the meter is about the maximum. I can adjust the volume or play loud & quiet songs and I always get lots of "meter action".

My World's Simplest Lighting Effect has two concepts that you might want to copy - It finds the waveform peak every 50ms and then it calculates a 20-second moving average of peaks so it can automatically adjust the sensitivity.

My real-world effects us another "trick" of switching to the 1.1V ADC reference with low-level signals but I don't know if the ESP has that. (The lower reference also doesn't work with a biased input like I use in the Simple Effect example.)

1 Like