4
\$\begingroup\$

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.

schematic

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:

enter image description here

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:

schematic

simulate this circuit – Schematic created using CircuitLab

And the oscilloscopic proof:

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Where is the AC coupling on the input? \$\endgroup\$ – Ignacio Vazquez-Abrams Feb 23 '15 at 3:10
  • \$\begingroup\$ @IgnacioVazquez-Abrams I'm quite new to electronics, so I I really don't know. Can you elaborate? \$\endgroup\$ – Fiver Feb 23 '15 at 3:25
  • \$\begingroup\$ 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. \$\endgroup\$ – Andy aka Feb 23 '15 at 11:42
6
\$\begingroup\$

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.

schematic

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ C3 & the parallel resistance of R4 & R5 Shouldn't it suppose to be R5 + R4 in parallel with R3? \$\endgroup\$ – m.Alin Feb 23 '15 at 8:28
  • \$\begingroup\$ Dwayne, is it ok to use 2.2uF, as I don't have any 1uF? \$\endgroup\$ – Fiver Feb 23 '15 at 14:38
  • 1
    \$\begingroup\$ @m.Alin: Yes - I OOPSed. Thanks for catching that. I edited my answer with the correction. \$\endgroup\$ – Dwayne Reid Feb 23 '15 at 15:06
  • \$\begingroup\$ @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. \$\endgroup\$ – Dwayne Reid Feb 23 '15 at 15:07
  • 1
    \$\begingroup\$ "Increase C2 if you need a lower break-point." Should that be C1? \$\endgroup\$ – AaronD Feb 23 '15 at 18:12
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Fiver Feb 23 '15 at 4:07
  • \$\begingroup\$ 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. \$\endgroup\$ – Bruce Abbott Feb 23 '15 at 8:37
1
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ Paul, thanks. I've added a 100uF cap but I'm not seeing any difference in the center of the output signal. \$\endgroup\$ – Fiver Feb 23 '15 at 4:01
  • \$\begingroup\$ 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". \$\endgroup\$ – Paul L Feb 23 '15 at 4:35
  • \$\begingroup\$ Also, what IS it centered at now? \$\endgroup\$ – Paul L Feb 23 '15 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.