Help With Audio Spectrum Analyser using FFT & 250 Watt Amp

Hi there,

I am working on a project (with the help of the super clever people on this forum), to replace the displays in my B&O BeoLab Penta Speakers. I had stumbled across this video on YouTube:

Tutorial Video

I decided to take and modify this project for a 256 x 64 OLED Display (That is the perfect size for my speakers). With the help of the forum i have this sketch displaying (almost) perfectly on the new display and using new libraries.

Here is how i have it at the moment:

My Display

Now i need to try and get the spectrum working correctly, in the video he is using some PCB Microphone to feed the FFT, i need to use the output from the speakers amplifier - which is a 250 Watt unit. I am seeking advice on how i should go about feeding this signal to the ESP32 boards i am using. The amp outputs Positive & Negative wires which then feed into a Crossover Circuit and then into the different speakers.

I was wondering about how i can splice into the Amp Output and then feed it to the ESP32, will i need to reduce the power somehow or similar? Do i need both the Positive & Negative wires or can i just use the Positive?

I am totally stabbing in the dark here so any help will be greatly appreciated.

Many Thanks

Alex

A couple of "difficulties"...

In normal listening situations you're probably only running at a couple of watts, so you'll need to handle a wide range of signal levels.

If you have a line-level signal (such as tape-out or preamp-out) or headphone-out you won't have to deal with the higher voltages. But, you'll still have to handle a wide range of voltages if the signal is volume-controlled. If you have a receiver with "tape out", that's not volume-controlled so it's better. The signal level will still vary but not nearly as much.

To some extent you can adjust the sensitivity in software. (I do that with my sound activated lighting effects.)

You can scale-down the voltage with a [u]voltage divider[/u] (2 resistors). 250 Watts into 8 Ohms is about 45V RMS (about 60V peak or 120V peak-to-peak). Power = V2/R

I assume you already have a voltage divider with two equal-value resistors to bias the input (so you can read the negative half of the AC audio signal) and you can add another resistor in series with the input to reduce the signal.

You may also want to add some [u]over-voltage protection diodes[/u].

I've never used the ESP32... If it has multiple analog inputs, you can use multiple different voltage dividers and then choose the one (in software) that gives you the best reading. (You will need protection diodes on the voltage dividers with higher output.)

The amp outputs Positive & Negative wires...

Do i need both the Positive & Negative wires or can i just use the Positive?

On most amplifiers the minus connection is ground. The Arduino always reads relative to it's ground, so you need a common ground... Voltage measurement always need a reference (usually ground).

However, some amplifiers are differential (with a signal on the positive & negative wires) so if you're not sure check with an Ohmmeter/multimeter. If you your amp has a differential output and you short the -output to ground, you can burn it up!

Hi DVDdoug!

First of all thanks for taking the time to write up that response, it has answered alot of my questions.

The speaker takes an RCA Input at the bottom (which is the AMP), this is then carried up through the speaker to the crossover and then onto the speakers, unfortunately it will be varying volume from the AVR.

On the output from the AMP i am getting just 4 volts, i currently do not have any voltage divider in place, i am completely new to this but i am confident i can implement this fairly easily.

You mentioned that the Arduino is always reading relative to its ground, how the display & ESP32 are powered, is that i am taking 10vAC from the Old Display wiring, and have a simple LM7805 to convert it into 5vDC to power the equipment, is this an undesirable way to do things in terms of the ESP reading relative to its ground?

Thanks

Alex

EDIT: I get ~4v from both Positive and Negative wires from the amp.

I have the manual if its useful, diagram for the Amp is a few pages in:

Some sort of presetable voltage divider at highish impedance followed by schottky clamps to the rails, and just hope the the speaker + terminal has signal relative to system ground?

Worth a try.

The speaker takes an RCA Input at the bottom (which is the AMP), this is then carried up through the speaker to the crossover and then onto the speakers, unfortunately it will be varying volume from the AVR.

OK, I see. Those are active speakers. I'd try using that line-level (RCA) signal because you won't have to worry about over-voltaging the Arduino. You should get around 1V with the music "blasting" but you'll just have to experiment to see if you get a usable signal at normal listening levels.

It would also be worthwhile (as an experiment) to connect to the line level signal with the speakers disconnected and the volume cranked-up.

You can also do a basic analogRead() to see what kind of raw readings you're getting. Just remember that you're reading a continuously-changing "wave" with positive & negative* peak once per-cycle and two zero-crossings per-cycle, so the readings will "look random" but you should be able to pick-out the peaks manually/visually or in software.

And/or depending on how it's going for you, you might want to experiment with a little [u]microphone board[/u] so you can better-duplicate the project you are "copying" before customizing it the way you want.

You'll probably end-up using a voltage divider at the amplifier output and it would be "smart" to add the protection diodes. The resistor values should be much higher than the 4 or 8 Ohm speakers. Resistor values that add-up to around 10K Ohms are a good starting point. But the values are not really critical... It's the resistance ratio that makes the voltage divider work.

The protection circuit alone (without the voltage divider) is actually OK to experiment with, but if the signal is too hot you'll clip (hard limit) the readings which will create distortion in the FFT and give an "invalid" spectrum result.

On the output from the AMP i am getting just 4 volts, i currently do not have any voltage divider in place, i am completely new to this but i am confident i can implement this fairly easily.

I assume that's DC voltage? That's a little strange. I assume you're measuring that relative to the Amplifier's ground? If you're measuring that without the speakers connected it could be "leakage" and it might go-away when you connect the speakers.

There shouldn't be any DC voltage across the speakers/drivers. That would be a defect.

Any AC voltage depends on the signal level so you'd only read a constant 4 VAC with a constant test-signal and of course you'd hear it (if it's in the audio frequency range).

You mentioned that the Arduino is always reading relative to its ground, how the display & ESP32 are powered, is that i am taking 10vAC from the Old Display wiring, and have a simple LM7805 to convert it into 5vDC to power the equipment, is this an undesirable way to do things in terms of the ESP reading relative to its ground?

Well... A 7805 doesn't work from AC.

If the AC is rectified & filtered that's OK. And of course, everything needs a common ground. And since you are getting power from the amplifier, everything already has a common ground.

  • Do you understand about biasing the input so you can read the negative voltage? The chip can't read negative voltages, in fact I can be damaged by negative voltages, and FFT needs to "see" the whole undistorted waveform.

Hi again guys,

Sorry for the massive delay in my response - i have not had much of chance to work on the project and wasn't fully understanding what was being said here so i have gone off to research and try and come back better equipped.

Here is where i am at as of last night:

  • I re-measured the output from the Amp and realized i was being an idiot. The output seems to range from ~0.1 to 3.3v AC depending on the volume.

  • Working with someone else we (he) established the ESP32 can accept upto a 3.9v signal on the ADC channel by adding this line into the Project: analogSetPinAttenuation(A0, ADC_11db);- I'm not sure how i can test that this has been implemented.

  • In terms of wiring, i didn't explain fully how it is setup currently:

- 10vAC Taken from OEM Display wiring, this is rectified and stepped down to 5vDC in a simple circuit.
- I'm still not very sure on how i should be approaching getting a biased input to the ADC Channel, currently i have the output from the amp + to - with 2 @ 1k Ohm Resistors in series, from the center of these resistors i splice off into the ADC Pin. Is this adequate?
- I have ordered some 0.1uf Capacitors to put inline between the voltage divider and ADC channel in an attempt to clean the signal (i had seen this mentioned elsewhere previously).

  • At the moment i am getting a constant reading on the display of 0.1 & 0.5 Khz, i take it this is present from the AC input voltage of the circuit? Would it be easier to simply exclude these bands from the display and possibly increase / split resolution further up the frequency range to give more visuals?

I am struggling to figure out what i should be setting the software Amplification & "Crude Noise filter" in the project sketch as, i seem to be stabbing in the dark currently, if i lower the Amplification value i get a lot more interference but more activity at reasonable sound levels. If i higher the amplification i get no interference but the Visuals seem to be very low even at high volume.

You mentioned in another post that maybe the readings could be adjusted in software based on the volume level? Might this be a valid method here? Is there a way to condition (if thats the right word?) all of the signals to give an average / balanced output?

I'm conscious that this project is mainly an aesthetics feature but i also find it very interesting and would like it be fairly accurate if possible.

Thanks

Alex