## DC amplifier with opamp LM358 problem

37 posts / 0 new
Author
Message

Hi,

I need a simple DC amplifier with
gain = 10
input voltage = 1 to 250 mV.

I have tested opamp LM358, but only one of my 3 pieces has linear relation between input voltage and gain.

Detail description is on http://www.mp222.wz.cz/opamp.html

I need 3 amplifiers. Shall I buy 100 chips and select 3 of them?

Total votes: 0

...and where is the rest of the circuit? Have you looked at the data sheet for the LM358? Do you know what an amplifier circuit should look like?

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Total votes: 0

Try using upping the resistors by 10 times. The datasheet should tell you how much current the device can sink.

Total votes: 0

js:
But my my picture is from datasheet:
"Typical Single-Supply Applications"

Total votes: 0

nanovate:
I will try it and let know.

Total votes: 0

You could also measure the offset voltage. 1mV is a small signal to put into a LM358

Total votes: 0

Quote:
But my my picture is from datasheet:
"Typical Single-Supply Applications"
So I see, I thought you wanted an AC amplifier, sorry, missed the DC bit.

I use a similar circuit but with 10K and 1K resistors.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Total votes: 0

I have used resistors 10k and 1k.
The change is very little. The worst chip shows now gain 3 at input 1mV (before it was 2).

Quote:
1mV is a small signal to put into a LM358

I thought so, but first, the nonlinearity is in all range (50mV input = 590mV output)
and second, why one of chips goes perfectly?
All of them are new, not used.

Total votes: 0

I have used more than 20,000 LM358, half chip in AC mode and the other half in DC mode like you have it. No problems.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Total votes: 0

Try using a split supply as the LM358 is not designed to operate in a rail to rail setup. The other issue could be it's offset voltage ass well.

The split supply will allow the device to operate with such low input voltages.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

"The critical shortage here is not stuff, but time." - Johan Ekdahl

"Step N is required before you can do step N+1!" - ka7ehk

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Total votes: 0

For signals in that low range, noise is a big issue. You need to get yourself a low noise precision amplifier.
You will also need to compensate for offset voltage, bias current, offset current, temperature drift, etc.

The biggest problem for you is the offset voltage. Add a circuit at the input to compensate for that and the response will be linear again.

However, although the LM358 inputs work down to ground, the outputs do not. Get a rail to rail opamp if you need that kind of functionality, or better, use biasing or dual supplies.

If you think education is expensive, try ignorance.

Total votes: 0

Or use the old workhorse LM324 (is there a dual version of it?)

Total votes: 0

Quote:
Or use the old workhorse LM324 (is there a dual version of it?)

LM2904 is the dual version, but the 324 parts are not much different than the 358 if "near ground" output signal levels are of interest. Besides carefully examining the offset issues, OP probably will need to implement a little V- if he really wants to use these parts.

Tom Pappano
Tulsa, Oklahoma

Total votes: 0

So 1mv in should be 10mv out, but some op amps dont get within about a volt of the negative voltage... either run it from +-5v, or get a rail to rail opamp?

Imagecraft compiler user

Total votes: 0

Quote:
So 1mv in should be 10mv out, but some op amps dont get within about a volt of the negative voltage... either run it from +-5v, or get a rail to rail opamp?

And even then "rail to rail" often really means "almost rail to rail", especially when it comes to output signal levels. V- might still be needed, depending on what the OP's actual range of interest is.

Tom Pappano
Tulsa, Oklahoma

Total votes: 0

We have had several recent questions along this same line so some basic information may be in order.

Op-amp outputs, even on so-called "rail to rail" ones never swing exactly to the supplies. There is some invalid zone where it cannot go. It might be as small at 20mV at very low load currents or it could be larger than 1V (LM741s and TL084s come to mind).

So, lets say you have DC gain of 20 and an input voltage of 0mv. Even ignoring input offset, the output will NEVER get to zero. Further, if you just measure things with a volt meter, you could reach very strange conclusions.

There is also an input common mode range. BOTH inputs must be within this voltage range for the amplifier to work properly. A few devices have an input common mode range that includes one of the power supply rails. This is useless if you don't also consider the valid output voltage range.

There are many other things that can also cause unexpected behavior. Input offset has been mentioned in this thread. It tends to be most significant for DC amplifiers with a lot of gain, but can cause surprises in almost any circuit. This is due to imperfect matching between the two halves of the input circuit. It results in an apparent voltage between the two inputs. In a simple non-inverting amplifier, The input offset is (approximately) multiplied by the gain and added to any other DC levels in the output. Thus, an offset of -1mV in a circuit with a gain of 10 could subtract 10mV from all output voltages. Thus, if the input were 0mV, the output would try to go to -10mV (but could not get there if it is a single supply circuit). The input voltage would have to be +1mV, in this example, just to get the output to zero, which the amplifier still could not do because of output swing limits.

Finally, with DC amplifiers, you need to be very careful how you determine gain. Suppose that you have an amplifier with an input offset of -1mV and an output that will swing within 100mV of the rails and a gain of 10. You put in 0mV and the output is +100mV, because of the output limitations. You put in 20mV (which is effectively 19mV due to input offset) and see an output of 190mV. Is the "gain" (190mv - 100mv)/(20mv - 0mv) = 4.5? It may appear to be such locally but if you check the gain for inputs between 20mV and 30mV, you will get something very different.

So, be aware of how these beasties really work. It will save much grief in the end.

Jim

Until Black Lives Matter, we do not have "All Lives Matter"!

Total votes: 0

Seeing that the circuit above should pretty much work as is from a 5V supply and seeing the output variations are so great I think we need to start a guessing competition:

I'm guessing that the op does not have a bypass cap across and near the supply pins and/or the other half of the chip has the inputs unterminated and oscillating wildly.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Total votes: 0

Why not put a diode in series with the output (having a capacitor in parallel). This brings the output pin to 0.7V and the actual "output" is at that time 0V. A load resistor on the cathode of the diode will complete the circuit.

The inputs, I believe, can handle 0V and a little tiny winy bit on the negative side too.

Total votes: 0

Visovian wrote:
Hi,

I need a simple DC amplifier with
gain = 10
input voltage = 1 to 250 mV.

I have tested opamp LM358, but only one of my 3 pieces has linear relation between input voltage and gain.

Detail description is on http://www.mp222.wz.cz/opamp.html

I need 3 amplifiers. Shall I buy 100 chips and select 3 of them?

There are a couple of things you are neglecting:

1) The input offset for an LM358 can be quite a few millivolts, either positive or negative depending on the individual IC. Think of it as a small voltage in series with your input. When you give the amplifier 2mV one device might see it as being +5mV another might see -1mV. The one with a negative offset will attempt to give a negative output but in your circuit it cannot. As others have suggested try it with a bipolar supply.

2) Even with an offset the amplifier can be linear - normally gain is interpreted as the output change divided by the input change for small changes. Not the output divided by the input.

3) Your method of measuring the open loop gain is wrong - the amplifier will go into saturation and you are measuring the maximum output voltage. In general it is almost impossible to measure the open-loop gain of an opamp directly.

The LM358 is not appropriate for amplifying DC voltages in the millivolt range, its offset voltage is too great. There are many opamps available these days with offsets down to the tens of microvolts if that is what you really need.

What is your application?

kevin

Total votes: 0

Hi all,

Quote:
What is your application?

Atmega 128 ADC measures voltage from 3 sensors.
Sensor output is DC voltage 2 to 100 mV.
For higher resolution, the DC amplifier 10x is to be used.

It is clear for me now that input offset voltage (Io) is an important value and LM358 is not suitable, its Io being 5 to 7 mV.

Quote:
Even with an offset the amplifier can be linear

Indeed, if offset was constant in all range of input voltage, then I could simply add or subtract it in code.
But my measuring showed something else. Seems Io vary slightly with input voltage.

One of my chips has by chance a very little Io and it desoriented me. (I did not work much with opamps before.)

So, I think a precise opamp with a low input offset voltage will solve the problem.

But finally I am thinking about one thing.
If I amplify the voltage 10x and set Aref to 1.28V, isn't the resolution the same as when I set Aref 0.128 V without amplifier?
I only wonder if Aref can be so low.

Total votes: 0

...and can you confirm if my guesses above are correct or wrong?

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Total votes: 0

Hi, John

Quote:
I'm guessing that the op does not have a bypass cap across and near the supply pins and/or the other half of the chip has the inputs unterminated and oscillating wildly.

On supply there is a 200M cap.
I occasionally put electrolytes to input and output with no change. So there were no oscillations by my opinion. Besides I think the measures correspond with high input offset (as I know now).

Total votes: 0

But do you have a 100nF cap near the chip?? Are the pins of the other half of the chip floating? Do you have a scope to confirm

Quote:
So there were no oscillations

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Total votes: 0

Hi John,

100nF cap is about 5 cm from the chip.
Other half of chip is floating.

You have forced me to bring my 20 kg osciloscope from distant room in 30 Centigrade.

There is no oscillation, but I fear your next post

Total votes: 0

Quote:
100nF cap is about 5 cm from the chip.
1cm or less would be the max I would feel confortable with. Putting a scope directly on the output may kill the oscillations. I would ground the +side of the other half of the chip and connect the - to the output, then do your tests again.

About half of the 20,000 modules I have made have this circuit, which is used as a rectifier/dc amp and it is pretty good from about 30mV to 3V output.

## Attachment(s):

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Total votes: 0

Visovian wrote:

But finally I am thinking about one thing.
If I amplify the voltage 10x and set Aref to 1.28V, isn't the resolution the same as when I set Aref 0.128 V without amplifier?
I only wonder if Aref can be so low.

According to the Mega128 datasheet, Vref should be between 2.0V and AVCC. So it seems you have to get that opamp working...

Total votes: 0

knutbr:
You have put me out of humour.
Thank you for the information, anyway.

Total votes: 0

js:

I grounded pins of other chip.
I measured again more carefuly (with scope on output)
and I found, the gain is in fact linear (as kevin_white wrote):

```input[mV]  output[mV] error
1          3          -7
2          13         -7
5          43         -7
...
...
150       1493        -7
200       1993        -7
```

So I could use this opamp and in code add 7 to each measured value.

Total votes: 0

Take a close look at the data sheets. You can quite easily adjust for the offset voltage, either in hardware or in software as you have suggested. But check out other sources of error. The LM358, AFAIK, has a very low bias current temperature drift, so that's one out of the way. :D. Temp drift of offset voltage is another - means that the 7 you use to linearise the transfer function will change with temperature. If you can live with it, fine, but it is good practice to find out.

Have you done bias current compensation? This is best done by arranging that both input pins see the same DC resistance. In your case, the inverting input sees 100//900 = 90 Ohms (if my math is correct :P ), so connect the non inverting input to the source using a 90 Ohm total resistance (including the resistance of the sensor) instead of directly as you have done.

If you think education is expensive, try ignorance.

Total votes: 0

emuler:
I think the error in amplification up to 2% would be acceptable in my application, but I will probably look for some better opamp. I hope, there are types which can work without various compensations.

Total votes: 0

Yes there are. You even get laser trimmed ones! Of course, these tend to cost an arm and a leg, but they are available.

If you think education is expensive, try ignorance.

Total votes: 0

Quote:
I hope, there are types which can work without various compensations.

There are *many* very nice contemporary opamps with much lower offsets, rail to rail inputs and/or outputs, etc. I would start at ti.com and you will find many dual and quad parts. Maybe not for \$0.20, but less than \$2.00. Freeing oneself from aggravation has it's costs 8-) Look carefully at the various specs and you will see various combinations of supply voltage range, current draw, current output, offsets, etc.

Tom Pappano
Tulsa, Oklahoma

Total votes: 0

I would suggest using slightly higher resistor values. The offset voltage drift can get larger with such a large load. There are better OPs, but the LM358 is not that bad, it's just the offset to take care of. With only 2 mV minimum input voltage, about 1/4 of the chips can have an offset of less than -2 mA.

Total votes: 0

What is the output impedance/ resistance of the sensors that you are using?

If you think education is expensive, try ignorance.

Total votes: 0

Quote:
I would suggest using slightly higher resistor values. The offset voltage drift can get larger with such a large load.
I agree this is why I suggested upping the resistor values.

You can also put in a reference voltage to pull it up from the rail. But you might have to look at your ADC's Vref to see if that would need to be changed also.

The LMP7712 might be an opamp to look at, it is low offset and RR

Total votes: 0

So my Guess was pretty much correct? :) The -7 looks suspicious, I can understand that at very low outputs but above 0.5V it does not make sense. But you meter may not be 100% correct either.

As you can see I have a calibration pot which also correct the ADC's errors, if any.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Total votes: 0

Quote:
I would suggest using slightly higher resistor values.
Resistors are now 1k and 9k. I have corrected it in schematic.
Quote:
What is the output impedance/ resistance of the sensors that you are using?
To say true, I do not know. I have mailed a question about the parameters.

Quote:
So my Guess was pretty much correct? Smile The -7 looks suspicious, I can understand that at very low outputs but above 0.5V it does not make sense. But you meter may not be 100% correct either.
Seems you were right. The measured values are more stabil now. Of course, my multimeter is not exact, and setting tenths of milivolt with a pot is also not easy. I did my best. Of course the values fluctuated a little, but the error kept always close to -7.

Dear friends,
thank you all for your answers and useful suggestions. I have learned a lot about opamps during this discussion.