# Convert an audio signal to 0-5V using single supply op amp

I'm trying to capture an audio signal using an analog input of an Arduino Uno. The Arduino's analog input must be between 0-5V. I'd like to use a single power supply via an 9V battery, so I'm using a voltage divider to offset the input signal and feeding that to an LM321 op amp. Here's my current circuit:

Updated Circuit: Added 100uF cap before voltage divider.

Note: The audio input can be a microphone, mixer output, headphone jack, electric guitar, etc.

Originally, I was using the 5V power supply from the Arduino but I found that the amplified signal was being clipped around 3.8V. I believe this is because the LM321 is not a rail to rail op amp, and is limited to V+ - 1.5V according to the Vcm (input common-mode voltage range)...though I really don't understand exactly what that spec means. Is this correct?

I switched to a 9V supply and changed the voltage divider resistors to the values above to get close to a 2.5V DC offset. The non-inverting op amp is setup for a 2X gain, which works. However, the issue now is that although I have successfully amplified the signal, it is no longer centered at 2.5V. Here's a screenshot from my scope, the original source signal is in yellow and the output from the op amp is in blue:

What is the simplest way to get the output signal "re-centered" around 2.5V? Or, is this just a bad approach to solving the problem?

Solution

Thanks to everyone for their help. Here's the schematic for my final working circuit:

simulate this circuit – Schematic created using CircuitLab

And the oscilloscopic proof:

• Where is the AC coupling on the input? Commented Feb 23, 2015 at 3:10
• @IgnacioVazquez-Abrams I'm quite new to electronics, so I I really don't know. Can you elaborate? Commented Feb 23, 2015 at 3:25
• Convert R3 to two 2kohm resistors; one to ground and the other to the positive supply. This is the basic problem that causes the output dc level to shift. Commented Feb 23, 2015 at 11:42

You are close to having a working solution.

I attempted to edit your schematic but I don't see a edit link below the schematic in the preview window. So I'll draw a new one here.

simulate this circuit – Schematic created using CircuitLab

R5 & C2 filter noise from your 5V rail. You may need to increase the value of C2 if you are getting excessive noise.

R1 & R2 set the gain. Gain is set to 11 with the values shown.

R1 & C1 set the low-frequency response of the amplifier. Increase C2 if you need a lower break-point.

C3 & the parallel resistance of R4 & R3 also set the low frequency break point of the amp. Note that R5 doesn't affect the low frequency response because C2 keeps the node of R5, R4, C2 at AC ground potential.

• C3 & the parallel resistance of R4 & R5 Shouldn't it suppose to be R5 + R4 in parallel with R3? Commented Feb 23, 2015 at 8:28
• Dwayne, is it ok to use 2.2uF, as I don't have any 1uF? Commented Feb 23, 2015 at 14:38
• @m.Alin: Yes - I OOPSed. Thanks for catching that. I edited my answer with the correction. Commented Feb 23, 2015 at 15:06
• @Fiver: You can use almost any capacitors around that value. Be sure to calculate the filter break points to make sure that you don't need to change resistor values. Commented Feb 23, 2015 at 15:07
• "Increase C2 if you need a lower break-point." Should that be C1? Commented Feb 23, 2015 at 18:12

Just connect R2 to the Arduino's +5V supply like you did before. Only the op amp's Vcc needs to be at 9V.

For a more accurately centered bias point you could insert a capacitor in series with R3, then the op amp will have a DC gain of 1 and the output voltage will equal the input voltage. If you make R1 and R2 equal values then the input should be exactly 2.5V.

However, if your microphone is a dynamic or electret type then it will affect the bias point. I'm guessing you have an electret mic which is drawing enough current to drop the input voltage to about 2.5V. This cannot be relied on. You should use a separate load resistor for the mic, and AC couple it to the amp.

• Thanks Bruce, I'd like to stick to a single 9V supply since I intend on using a standalone QFP Atmel chip in the final design. The audio input can be anything from an electric guitar to a microphone to the audio out from a headphone jack of an iPad, etc. Commented Feb 23, 2015 at 4:07
• If the Atmel chip will be on the same board then use it's Vdd as a reference. Otherwise drop the 9V down to the same voltage as the MCU with a small regulator, eg. 78L05. Commented Feb 23, 2015 at 8:37

You need a capacitor on your mic input (before your voltage divider). As it is now, the divider isn't making a true "superposition" of a dc source + ac wave, because some dc current is now wasted driving your mic. WHich is dangerous for your mic!

Adding a capacitor on the input is "ac coupling" as Ignacio said -- it only allows ac signals to pass. The value of the cap should be high enough to pass the lowest frequency in your circuit.

Edit; the value of the cap should be chosen according to the high-pass filter formed by the cap and the parallel resistance of your divider resistors (about 1k). You'll want f3db to be around 15Hz or so for good bass response, and that limits your choices to around 100uF, which is going to have to be ceramic -- aluminum caps are terrible for audio. You should really make your resistor values much larger so you can use a smaller capacitor. Not TOO large, mind you, because the thermal noise goes up. Maybe try order of 100k. It's all a compromise. You can see this page for more information: http://tangentsoft.net/audio/hs-opamp.html

• Paul, thanks. I've added a 100uF cap but I'm not seeing any difference in the center of the output signal. Commented Feb 23, 2015 at 4:01
• Hmm, I'll think about this some more, but I noticed you drew your capacitor as polarized; I'm not sure if that's intentional. You should NOT use a polarized cap, because the audio input will swing below ground. Polarized caps only pass signal in one "direction". Commented Feb 23, 2015 at 4:35
• Also, what IS it centered at now? Commented Feb 23, 2015 at 4:41