Very high output and distortion on basic buffer circuit

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Howdy
I'm fairly new to circuit design and I'm having a problem I can't explain.

I'm trying to create a very simple buffer circuit just to familiarise myself with op-amps.


(not sure why the image works in editor and not in viewing the thread - here it is https://www.eecs.tufts.edu/~dsculley/tutorial/opamps/opAmpBuffer.jpg)

I'm using an LM324 and when I set it up like this, all I get is extremely high output and a very distorted signal.
I've got my phone providing the audio via a 1/8" plug connected directly to the breadboard, and listening via headphones. When I connect the headphone directly to the phone output, it sounds fine, but when I connect to the output of the op-amp, it is extremely loud and distorted. As I understand, this circuit should really just pass the signal through basically unaffected, but again, I'm fairly new to this.

I tried another lm324 and another dual op-amp, but same result, so something makes me think I'm doing something fundamentally wrong.

Can anyone provide any insight as to why my circuit is a distorted mess and not a simple audio pass-through?

Thank you.
 

dl324

Joined Mar 30, 2015
16,845
Welcome to AAC!

The linked JPG isn't available.

How are you coupling the output? What gain are you trying to achieve? What supply voltage are you using? What is the amplitude of the input signal?

Can you sketch the circuit for us?

LM324 probably isn't a good choice. Input and output voltages are only guaranteed to be within a couple volts of the power supply.
 

MrChips

Joined Oct 2, 2009
30,711
Headphone amplifiers are typically designed to drive headphones, earphones and earbuds which have low impedances, typically from 8-32Ω.

Do you have a low input resistance to match this on your LM324 circuit?
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Thank yall for the replies.
Again apologies for the image - it works in the editor and if you click the link, but not in the thread, so I'm not sure what the problem is.
It shows a schematic with the output of an op-amp fed back into the inverting (-) input, with the signal coming in via the normal (+) input.

Here is a picture of my circuit:


I've got DC 12v coming from a wall wart for power (300ma positive (+) center).
I'm driving the input with an iphone connected via 1/8" jack to breadboard.
I'm monitoring the input from some studio headphones connected to board via 1/4" jack.
I'm guessing that's about 1v max that I'm working with?

I don't have any resistors but wondered if I needed one, also wondering if I need a cap for DC filtering (what kind of values work best, and does electrolytic or ceramic matter)?

Here's a more zoomed out version where you can see the tech data on the LM324. I'm obviously missing something, but I think I'm following the specs appropriately (32vcd differential input voltage, -0.3 to +32vdc input voltage, max 32vdc power supply).


Thanks again for the pointers - I know I've got something wrong I'm just not sure what.
 
Last edited:

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Forgot to mention, I'm trying at first to achieve NO gain, just to get an op-amp working correctly (I did try this with two matched resistors, but just got a drop in the still distorted output signal).

Once I get this buffer circuit working, I'm going to try expanding it with different pots / resistors and see how I can manipulate the gain. Probably try inverting versions as well.

Thanks again.
 

crutschow

Joined Mar 14, 2008
34,283
You audio signal is plus and minus but you only have a plus supply to the op amp so the negative half of the signal is clipped (basically it's half-wave rectified), causing the observed distortion.
You need a separate plus and minus supply (minus going to the com pin) or use a circuit to split the rail (pseudo ground).
 

AnalogKid

Joined Aug 1, 2013
10,986
You are missing input and output coupling capacitors and power decoupling capacitors.

AND - Since you have a single power supply, the input has to be biased at 50% of the total power supply voltage. The non-inverting input should have a 10 K resistor to the +12 V, a 10K resistor to GND, and a 4.7 uF or 10 uF / 25 V capacitor to the signal input (positive end toward the resistors).

The output needs a 4.7 uF or 10 uF / 25 V coupling capacitor to whatever the chip is driving.
BTW, what is the chip driving?
ABTW, that can not be a speaker; the 324 doesn't make much output current.

ak
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
You are missing input and output coupling capacitors and power decoupling capacitors.

AND - Since you have a single power supply, the input has to be biased at 50% of the total power supply voltage. The non-inverting input should have a 10 K resistor to the +12 V, a 10K resistor to GND, and a 4.7 uF or 10 uF / 25 V capacitor to the signal input (positive end toward the resistors).

The output needs a 4.7 uF or 10 uF / 25 V coupling capacitor to whatever the chip is driving.
BTW, what is the chip driving?
ABTW, that can not be a speaker; the 324 doesn't make much output current.
ak
That is very useful - I understood op-amps usually need the negative voltage as well, but I always saw that as three separate pins. Since this one had only one power and gnd input, I assumed dc voltage would work. So split the voltage, and send the negative to the gnd pin (I'll look up some more info on this)?

Thank you for providing some values to get started with, how did you come up with them / how flexible are they?

Currently just driving headphones as a test, eventually I'll be trying to process and output line-level audio. I had this chip on hand so that is what I'm starting with.

You audio signal is plus and minus but you only have a plus supply to the op amp so the negative half of the signal is clipped (basically it's half-wave rectified), causing the observed distortion.
You need a separate plus and minus supply (minus going to the com pin) or use a circuit to split the rail (pseudo ground).
That does makes sense when you put it like that - thank you.
 

MrChips

Joined Oct 2, 2009
30,711
Headphones have impedances typically 8-32Ω.
The output impedance of LM324 is higher than this (about 100Ω) and hence cannot drive headphones.

Look at LM386 audio power amp instead.
 

Audioguru

Joined Dec 20, 2007
11,248
If you bias the input of an opamp at half the supply voltage and use input and output coupling capacitors then the opamp can drive 2k ohms or higher but not headphones. Or you can add a negative supply so that the input is at half the supply voltage that will be 0VDC.

The LM324 is awful for audio because it has crossover distortion and poor high frequency response.
 

Attachments

AnalogKid

Joined Aug 1, 2013
10,986
I understood op-amps usually need the negative voltage as well, but I always saw that as three separate pins. Since this one had only one power and gnd input, I assumed dc voltage would work.
The LM324, the LM358 dual version, and the LM339 and LM393 comparators all came out in the early 70's as the first devices optimized for operation on a single power supply. The vast majority of opamps do not have explicit ground pins, and almost all of them will work on a single supply if you understand and work within their limitations. The 324 pushed two of these limitations, the input and output negative voltage ranges, not only to include the negative power pin potential but to exceed it on the input and get very close to it on the output.

In general, it is reasonable to expect that no matter what the power supply voltages are for a part, the signals the part takes in and puts out must be within those voltages. For a typical opamp running on +12 and -12, the input signal voltage range is between something like +10 and -10. This is because the internal circuits need a little voltage and current "headroom" within which to function. This can be a problem because if the opamp is running on +12 and GND, the most negative signal peaks must be at least +2 V. Not good for many situations.

The 324 and its friends have a negative input voltage range that extends *below* the negative power rail. So when powered by +12 V and GND, it can operate linearly with an input signal range of +10 V to - get this - negative 0.5 V. This was an OMG stunt in 1971. A similar thing is going on with the output voltage range, which can swing much closer to the negative rail than other parts at the time. One of the things this did was make the part able to interface directly with digital logic circuits, which typically had a "0" state between 0.0 V and +0.8 V, signal levels the 324 could both take in and produce.

As mentioned above, the 324 is not good for audio signal work because of its noise, crossover distortion, harmonic distortion, and limited bandwidth. But it is nearly indestructible, very stable, cheap, and a good part to start with. Almost 50 years later it still is the darling of the non-precision applications universe, with billions sold each year.

Search online for National Semiconductor app note AN-31.

ak
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
I really do appreciate all the helpful advice. I haven't tried updating the circuit yet but will report back when I do.

A few of yall say that this chip is 'not good' for audio. While that may be true, I'm just trying to learn basics of how an op-amp works - for example I've learned in this thread that the 'GND' pin on this op-amp should actually be more like negative voltage - very handy to know.

So my question is, is this chip really THAT bad, or can I still use it to make, say, a lowpass filter, even if it is not seriously hi-fi? Basically, can I continue learning with this chip and then swap it out for something better once I get the basics, or is it really worth throwing aside and abandoning because it is so bad?

Thanks.
 

dl324

Joined Mar 30, 2015
16,845
I've learned in this thread that the 'GND' pin on this op-amp should actually be more like negative voltage - very handy to know.
The LM324 was designed to operate from a single supply. The designers took advantage of that when they designed the output stage. If you operate it from split supplies, you need to have a resistor to the negative supply to improve crossover distortion.
So my question is, is this chip really THAT bad, or can I still use it to make, say, a lowpass filter, even if it is not seriously hi-fi? Basically, can I continue learning with this chip and then swap it out for something better once I get the basics, or is it really worth throwing aside and abandoning because it is so bad?
That amplifier is fine for general purpose work. The dual opamp version of the LM324 is LM358, and I use it for most of my opamp circuits.

You just need to understand the limitations. Some people will tell you that you need to use opamps with rail-rail inputs and outputs. That isn't the case if you know how to use the older designs. A number of people bash the LM741; in it's time, it was the best thing since sliced bread and I have a lot of equipment that uses it (because the alternatives at the time were more difficult to use).

I have LM741's in my stock, and a couple dozen more thanks to an AAC member (#12). I also have LM308, LM318, LF356, LM3900, CA3080,... for instances where I need a "better" opamp.
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Thanks again for the insight.

I found this article re: splitting the rail.
http://www.nutsvolts.com/magazine/article/how_to_trick_an_op_amp
(it seems to confirm what AnalogKid was saying earlier about what needs to be connected to the input etc - thanks again for spelling that out so clearly AK).

Then I'll work on a filter, and I suppose I'll keep everything at line level and amplify with a bass amp instead of just trying to get SOME signal out of my headphones - I was hoping they would be ok just to test things but that seems to be a common theme here, that they will not work.
 
Last edited:

Audioguru

Joined Dec 20, 2007
11,248
The LM324 and LM358 are terrible for audio but work fine without a negative supply, work fine when the supply is as low as 3V and have very low supply current. I found that the MC33171 single, MC33172 dual and MC33174 quad opamps do these things but without any crossover distortion and with good output up to 35kHz. The MC34071 single, MC34072 dual and MC34074 quad opamps also do everything without crossover distortion but are good up to 100kHz and use a little more supply current.

Most opamps do not have enough output current for most headphones so current boosters made with transistors must be added.

Why do you want a filter? To cut the lows so the sound is tinny? To cut the highs so the sound is muffled like an AM radio? Both?
 

Audioguru

Joined Dec 20, 2007
11,248
The maximum input voltage for an LM324 or LM358 is -0.3V. A normal input is capacitive-coupled and is within the power supply voltage used which is 0V to as high as 1.5V less than the positive supply. The written spec's say this and a graph shows it.

All, the specs are with a hefty load and a 5V supply but the datasheet says the minimum supply is 3V. A few graphs show a 3V supply.
The written spec's guarantee a minimum output of Vcc-4V when the supply is 30V and the output current is 26mA which is a very high current for it. A graph shows that its typical max output voltage is Vcc-1.5V when the current is 10mA or less.
 

Thread Starter

eljeffe

Joined Sep 28, 2017
39
Well good news - thank yall so much for the insight - I've done exactly what I wanted to do. I created an op-amp circuit that passes through the audio basically unaffected - I got the op-amp working and that is enough for me now. I learned that the negative voltage is very important when dealing with an audio signal, and I solved the problem by splitting my 12v power in two and using the mid-point between those two resistors as 'ground' for my audio signals.
I haven't added any capacitors just yet, and so far it sounds good (through a guitar amp). Why will I need them, and how do you calculate these values (4.7 / 10uf)?


Why do you want a filter? To cut the lows so the sound is tinny? To cut the highs so the sound is muffled like an AM radio? Both?
Because I want to build a (resonant) filter :D. I have no end-goal in mind right now other than learning. If the 384 will work for this, even with some distortion, I'm going to use what I have on hand first to figure it out.

Thanks again. It was the whole concept of negative voltage that I had glossed over. I get the idea of that from a previous dual-9-volt battery circuit I built, so when yall explained it like that, it made sense - I thought the op-amp would just *work* with a ground, I didn't realise there was a caveat.
 
Top