Go Down

Topic: Amplifying audio signal to be used in frequency analyzer (Read 1 time) previous topic - next topic

DwightD

Okay so I'm working on a simple Arduino frequency analyser like many others before me, but I'm new to this type of tinkering so I'm pretty clueless. I know a lot of people use the MSGEQ7, but I'm in Europe and can't get that shipped in time for the deadline for my project (cant find any Europe retailers, if you know one that would be very helpful).

So I'm trying to read a 3,5mm audio jack, process the signal with FFT and then output it onto an 8x8 LED matrix. But I don't know how to amplify the signal to get it between 0 and 5V.

Could I use an LM386 (http://www.ti.com/lit/ds/symlink/lm386.pdf) to amplify the signal before feeding it into my Arduino? Are there are other components that could be of help that I can get shipped to Europe fairly quickly? Are there any other workarounds I could use? It doesn't need to be super accurate, I just want a rough representation of the sound on my LED:s.

The whole concept of amplifying a voltage that varies between positive and negative really confuses me, so I don't really understand how to get it into the 0-5V range.

Thanks in advance!

marco_c

You need to use an Op Amp (Operational Amplifier) like the LM386. There are many types depending on the application, and usually only need a few other components like resistors and capacitors. The amplification multiple is usually set by resistor ratios. I am not an expert, so I usually look for circuits online or from the data sheets for the device and build those.
Arduino Libraries https://github.com/MajicDesigns?tab=Repositories
Parola for Arduino https://github.com/MajicDesigns/Parola
Arduino++ blog https://arduinoplusplus.wordpress.com

DVDdoug

How much amplification do you need?     What's the voltage before amplification, or what's the source?    If you have a line-level source (around 1V from a CD/DVD player, or a headphone output, etc.) you can use that without amplification.   If you're using a microphone you'll need an amplifier with a gain of around 100 (depending on the sensitivity of the mic and how loud the sound is).

Since you're under a time-crunch, it might be best to buy an audio preamp.

The LM386 might work, but it's not an op-amp.   It's a power amp, which means it's designed to drive a speaker.    It's gain is adjustable between 20 and 200.

Wikipedia has basic diagrams for inverting and non-inverting op-amp schematics.  

Since audio is AC, it really doesn't matter if you choose an inverting or non-inverting design.   If you  need to adjust the gain below 1 (or adjust the gain down to zero for silence) use an inverting design because non-inverting designs can't go below a gain of one.   (But, you can still add a volume control to bring the signal down to zero.)

Op-amps typically run off bipolar power supplies, which means you need +12V and -12V, or +15V and -1V, etc.    The LM386 runs off a single supply.

Quote
The whole concept of amplifying a voltage that varies between positive and negative really confuses me, so I don't really understand how to get it into the 0-5V range.
If you connect a battery to a speaker, you'll see the speaker move off-center (either in or out).   If you reverse the battery the speaker will move in the opposite direction.     Audio is AC and the current flows back-and-forth at a rate depending on the frequencies, so the speaker moves in-and-out to reproduce the sound.

Since the Arduino's analog-to-digital can't read negative voltage, and the Arduino can be damaged by negative voltage, the standard practice is to bias the input at 2.5V.    The two equal-value resistors make a voltage divider.    

The 10uF capacitor "isolates" the DC bias from the amplifier while allowing the AC audio signal through and on the Arduino-side the audio signal gets added to the 2.5V bias, which means a 5V peak-to-peak signal that normally swings between +2.5V and -2.5V now swings between +5V and zero.    (You can probably skip the 47nF capacitor, it filters the higher frequencies to prevent aliasing.)

Grumpy_Mike


Go Up