Author Topic: Strange step in amplified signal (with a differential opamp circuit)  (Read 1854 times)

0 Members and 1 Guest are viewing this topic.

Offline petertTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: de
Hello,

I was making some experiments with a simple differential amplifier circuit, as below.


R1 = 10 Ohm and R2 = 100 Ohm

The result is an amplified sine wave that has a strange step at 0V.


The opamp I use is an LM358N. The positive and the negative supply get powered by 9V batteries, such that there is approx. -9V on the Vcc- and approx. +9V on Vcc+ pins of the opamp. (Verified with a multimeter.)

The input signal is a 4kHz sine wave coming from a function generator, with a 500mVpp amplitude.

The circuit is built on a breadboard, but the signal does not get distorted on the breadboard, when probed with the oscilloscope and bypassing the opamp.

What could I have done wrong?

Edit: When I disconnect the signal generator's ground from the V- signal input of the opamp the distortion disappears. I am still confused what is going on, though.
« Last Edit: August 28, 2019, 02:14:31 pm by petert »
 

Offline Andreas

  • Super Contributor
  • ***
  • Posts: 3350
  • Country: de
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #1 on: August 28, 2019, 02:30:54 pm »
What could I have done wrong?

Hello,

the (low power) LM358 is known for cross over distortion under certain load conditions.
(see also LM358 data sheet)

-> use a OP-Amp without "cross over distortion" (e.g. LT1013/TL072)

with best regards

Andreas
« Last Edit: August 28, 2019, 02:37:48 pm by Andreas »
 
The following users thanked this post: petert

Offline nfmax

  • Super Contributor
  • ***
  • Posts: 1624
  • Country: gb
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #2 on: August 28, 2019, 02:59:35 pm »
You are using low value feedback resistors R1 and R2, which are loading the amplifier output and giving rise to the  'crossover' distortion for which the LM358 is well-known. Try using 1kohm and 10kohm resistors instead: this should give the same gain but with much less load on the OPAMP. I suspect you will find there is still a touch of crossover: adding a moderate-value load resistor from the output to the negative supply will shift the notch to lower voltages. About another 10kohm or so should remove it completely.

Disconnecting the generator ground terminal from the negative input removes the load of the upper R1+R2 in series from the amplifier output. You are left with a circuit that has a gain of about 0.9 and no load, so the distortion vanishes. The return from the signal generator is now going via the common 'ground' (bottom end of lower R2, mid point of the batteries) so there is still a complete circuit.

I hope this helps (and keep learning!)
 
The following users thanked this post: petert

Offline Old Printer

  • Frequent Contributor
  • **
  • Posts: 796
  • Country: us
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #3 on: August 28, 2019, 03:42:19 pm »
There was a thread related to this a couple days ago, down a couple pages now, but here is a link:

https://www.eevblog.com/forum/beginners/adding-filters-to-class-ab-audio-amp/
 
The following users thanked this post: petert

Offline nugglix

  • Regular Contributor
  • *
  • Posts: 209
  • Country: de
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #4 on: August 28, 2019, 04:04:07 pm »
And of course there is a video:

 
The following users thanked this post: rstofer, petert

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20363
  • Country: gb
  • 0999
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #5 on: August 28, 2019, 05:11:27 pm »
Yes, crossover distortion.
The key to understanding why this happens, is to look at the LM358's internal schematic. Refer to figure 16 on page 13 of the TI datasheet, if you can't see my schematic. For the moment, focus on the output stage: Q5, Q5, Q7 and Q13.
http://www.ti.com/lit/ds/symlink/lm358-n.pdf

Q5 and Q6 are a Darlington pair. They act as one transistor, with a very high current gain, but double the 0.6V turn on voltage of a single transistor. It works when current is flowing out of the output, i.e. sourcing current.

Q13 sinks current, i.e. it's used when current is flowing into the output pin.

The bases of Q13 and Q5 are connected together.

When the current in the output pin changes direction, i.e. it goes from sourcing to sinking or vice versa, the voltage on the bases of Q13 and Q5 have to change by three diode drops, or about 1.8, which can't happen instantaneously. During this transition point, both Q6 and Q13 will be off, so the output will be unable to supply any current, hence the dead-band in the output. If you could put the oscilloscope probe on the bases of Q5 and Q13 you'd see the voltage jumping by 1.8V, as the waveform crosses zero.

Other things to note about the output stage:
Q7 provides short circuit protection, by shunting the base of Q5 to ground, when the voltage across RSC exceeds 0.6V. Note that there's no protection against the output being shorted to +V.

The 50µA current sink enables the output to go very close to the negative rail, about 50mV, but it only works when the output stage is sourcing current or sinking well under 50µA. Increase the current sunk by connecting a resistor between the output and +V and the minimum output voltage will shoot up to 0.7V. Using low value feedback resistors can also have this effect, in some standard op-amp configurations. Figuring out which is an exercise left to the reader.



As mentioned above, connecting a resistor between the output and the negative supply will help reduce the crossover distortion, but connecting it the positive supply also works. Try changing the resistor value. Notice how the point where the crossover distortion shifts, depending on the resistor value and whether it's connected to +V or -V? It's because it changes the point when the current flowing though the output pin reverses.
« Last Edit: August 28, 2019, 05:13:24 pm by Zero999 »
 
The following users thanked this post: rstofer, Old Printer, petert

Offline petertTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: de
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #6 on: August 29, 2019, 01:03:37 pm »
Thanks everyone for your valuable input, especially nfmax! The last post is currently over my head, I have to admit.

Besides analyzing the schematic, I found no hint in the datasheet about crossover distortion that would apply to my case (dc coupled), just this:
Quote
For ac applications,where the load is capacitively coupled to the output of the amplifier, a resistor should be used, from the output of the amplifier to ground to increase the class A bias current and prevent crossover distortion. Where the load is directly coupled, as in dc applications, there is no crossover distortion
Did I miss anything?

Changing the resistor values did help as expected (I used R1=10k and R2=1MOhm to test out a large gain of 100), which worked as well, without showing any distortion.

I wonder though if large resistors will not affect the input signal, especially if it is weak. My signal generator only goes down to 1mVpp, but it didn't seem to affect the signal/distort it.

Chaining two opamps and "higher" frequencies:
When reaching about 78kHz and chaining the two channels of this opamp, both in differential configuration as in the first post, with the output of the first opamp going into the non-inverting input of the second, and common ground going into the inverting input of the second, I get a larger amplification as expected.
But the signal has a lot of phase noise and also oscillates vertically.



I am also a bit surprised by the quick decrease of gain with "higher" frequencies (not higher than 100 kHz), compared to 4kHz. I expected the gain to be mostly linear when you use negative feedback (and don't go over a gain of 100, or 100*100 when chaining two opamps)?
« Last Edit: August 29, 2019, 01:08:51 pm by petert »
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 7454
  • Country: pl
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #7 on: August 29, 2019, 03:40:49 pm »
Besides analyzing the schematic, I found no hint in the datasheet about crossover distortion that would apply to my case (dc coupled), just this:
Quote
For ac applications,where the load is capacitively coupled to the output of the amplifier, a resistor should be used, from the output of the amplifier to ground to increase the class A bias current and prevent crossover distortion. Where the load is directly coupled, as in dc applications, there is no crossover distortion
Did I miss anything?
It's misleading marketing. They refer to the case when the opamp's negative supply is ground and the driven load is also connected to ground. Then the opamp only needs to source current into the load, never sink, and crossover distortion doesn't occur. LM358 is intended for that kind of operation.
In your case, the output periodically goes below ground and needs to sink current. Consider replacing it with some RC4558 or NE5532, they have better output stages without such silly problems.

I am also a bit surprised by the quick decrease of gain with "higher" frequencies (not higher than 100 kHz), compared to 4kHz. I expected the gain to be mostly linear when you use negative feedback (and don't go over a gain of 100, or 100*100 when chaining two opamps)?
Gain bandwidth product is 1MHz so 100 is maximum gain at 10kHz. At 100kHz it's only 10.
No feedback can save you if open loop gain of the amplifier falls like a stone :)
 
The following users thanked this post: petert

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6420
  • Country: de
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #8 on: August 29, 2019, 06:44:54 pm »
With a 100 ohm feedback resistor, you're loading the output (@4 Vpp) with 40 mA, which is totally out of spec for the LM358. Multiply the resistance values by 100 like nfmax said.

 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20363
  • Country: gb
  • 0999
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #9 on: August 29, 2019, 09:17:48 pm »
The last post is currently over my head, I have to admit.
I can explain in more detail if you like. Some of the terms I used such as Darlington pair and current sinking and sourcing can easily be found using a search engine, if you're not familiar with them.

Quote
I wonder though if large resistors will not affect the input signal, especially if it is weak. My signal generator only goes down to 1mVpp, but it didn't seem to affect the signal/distort it.
The downsides to higher resistor values are offset errors due to the bias currents and increased noise.

The transistors in the op-amp's input stage require a current to turn on. This is known as the bias current. For example, if the bias current is 1μA and the input resistor between one input and ground is 1M and the other input is connected to ground via a very low impedance, the input with the 1M resistance to ground will be 1μ*1M = 10-6*106 = 1V higher than the other input. This will be multiplied by the gain, which could cause the output voltage to be significantly different to the expected value. This can be minimised by ensuring the input resistance seen by each input is equal (remember an op-amp amplifies the difference between each input), which is fortunately the case for your circuit. Unfortunately the bias currents still won't be perfectly matched, i.e. one input might be 1.01μA and the other 0.99μA, so this won't completely eliminate the error.

Increased noise will be observed with higher input resistances because the bias currents fluctuate randomly: a characteristic known as input current noise. It becomes voltage noise, when passed through a resistor, due to Ohm's law. Resistors also generate a thermal noise voltage, but this is normally tiny, compared to the input current noise of an op-amp with a BJT input stage.

Quote
I am also a bit surprised by the quick decrease of gain with "higher" frequencies (not higher than 100 kHz), compared to 4kHz. I expected the gain to be mostly linear when you use negative feedback (and don't go over a gain of 100, or 100*100 when chaining two opamps)?
Figure 5, on page 9 of the data sheet gives the maximum gain you'll be able to achieve, with a single op-amp, at a certain frequency.
http://www.ti.com/lit/ds/symlink/lm358-n.pdf

For 1kHz, it's just under 80dB, which is 1060/20 = 103 = 1000. In reality it'll be less than that, before the gain is less, than expected. The open loop gain of the op-amp should be much higher than the closed loop gain, for most op-amp circuits to work properly. Chaining op-amps will help, so you could use two stages with a gain of √1000 in series, but there are other downsides to that, so it's not an ideal solution.

Some other threads discussing changing op-amp stages.
https://www.eevblog.com/forum/beginners/op-amp-gain-and-number-of-stages/
https://www.eevblog.com/forum/beginners/purpose-of-this-amplifier-circuit-with-op-amplifiers/
 
The following users thanked this post: petert

Offline petertTopic starter

  • Regular Contributor
  • *
  • Posts: 178
  • Country: de
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #10 on: August 30, 2019, 06:33:51 pm »
The last post is currently over my head, I have to admit.
I can explain in more detail if you like.
Thank you, I will probably go back to the more low level details once I am more familiar with the higher level issues.

I experimented more with various (also lower) resistor values and it seems that the sine wave is clean, but the added noise remains, when chaining the two opamps.
It also happens at low frequencies of 4 kHz and less, so it is most likely due to the chaining of the two opamps, and picking up some noise along the way, since the single opamp amplifier did not have these issues.

Adding capacitors (220µF) around the power supply did not change anything either.

So I suppose the easiest way is to find an opamp that can provide the necessary gain in one stage.

For future reference, a link explaining some of the datasheet terminology: http://www.learnabout-electronics.org/Amplifiers/amplifiers64.php

Other useful op-amp links (also to prevent oscillation, second one in German):
https://www.electronics-notes.com/articles/analogue_circuits/operational-amplifier-op-amp/gain-equations.php
https://web.archive.org/web/20130828131053/http://elektronikwissen.net/opamp/9-opamp-wissen.html

Av (Voltage Amplification), dB and other terminology in context:
http://www.learnabout-electronics.org/Amplifiers/amplifiers13.php
« Last Edit: August 31, 2019, 10:29:01 pm by petert »
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 7454
  • Country: pl
Re: Strange step in amplified signal (with a differential opamp circuit)
« Reply #11 on: August 30, 2019, 08:06:06 pm »
Time to learn some noise calculations :)

LM358 doesn't specify noise, but the "improved" LM358B does and its performance is probably similar.
You use gain of 100 per stage, so full gain bandwidth is 10kHz because of 1MHz GBW.
Input noise density of LM358B is 40nV/rtHz. Multiply this by square root of bandwidth and we get 4000nV RMS noise from DC to 10kHz.
Multiply this by the magic number 7 and we get peak to peak value of noise which is not exceeded for over 99.9% of time. That's 28µV.
Furthermore, for various reasons, noise density increases at lower frequencies. The datasheet quotes a total of 8µV p-p in the range 0.1~10Hz.

Looking at the screenshots, your input signal appears to have amplitude comparable with LM358's input noise. So it's not very surprising to see noise roughly equal to the signal at the output too.

You need a lower noise opamp. Of the cheap ones, NE5532 has almost 10x less noise. A cascade of two NE5534 would offer some marginal further improvement. OPA2209/OPA2210 cuts it in half and LT1028/LT1128 halves the noise again if very low resistances are used throughout the circuit. Price increases accordingly.

To get 10000x gain at 100kHz in one stage it takes a 1GHz opamp. I'm not saying such things don't exist, but they tend to be pricey and noisy too.

And really, LM358 is a crap chip. It shouldn't be used unless you need the particular combination of low price, moderately low power consumption and the ability to pass signals down to the negative rail. Oftentimes it can be upgraded with something like RC4558, NE5532 or TLC/TS272. Or with more expensive parts. Sadly, it seems that there is no "LM358 done right", with tolerable input noise, better GBW, no crossover distortion and working down to the negative rail. And still cheap :)
 
The following users thanked this post: petert


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf