opamp non-inverting gain, wrong in spice sim

crutschow

Joined Mar 14, 2008
38,526
You need to calculate the output offset for the maximum input DC offset of the op amp you will use, which is the input offset times the closed-loop gain (here 10).
If that's too high for you purposes, then you need an op amp with lower offset (there are auto-zero amps with low microvolt offset if needed).

You can't depend upon the simulation to give an accurate worst-case offset.

The sim below shows it works using a low offset, single-supply op amp:
I changed the values for R1 and Rfb to get the closest gain of 10 that standard 1% values can generate (within about 0.3% of the ideal, for zero resistor tolerance).
For a lower cost, low-offset amp, try looking at the OPAx197, for example, which I think is a low-cost op amp with low offset.

1696889120458.png
 
Last edited:

Thread Starter

spookydd

Joined Aug 12, 2013
45
Just the basic PDIP8 PIC, the 12F675. Nothing fancy, and I'm even going to have to figure out how to make it do I2C as well.
I've been poking around for a decent single opamp to use, but haven't selected one yet. I will try out the lm358 on a breadboard soon, but I am still looking at other options. It doesn't have to be rail-to-rail output, but a rail-to-rail input type would be more appropriate, as the output will never need to get anywhere close to the rails. it's only the input that needs to handle the roughly 200mV and it must output that with the gain of 10 as accurately as possible. it's for a measurement, so I want it accurate. maybe the op-07 could be a candidate, possibly..
 

Thread Starter

spookydd

Joined Aug 12, 2013
45
I arrived at something somewhat better using that lm358 model that I found and using smaller values of res that can actually be found and in a 0.1% tolerance.
Now if I could have a decent model of the op-07, that might be even nicer.
Anyone got a model of that op-07 to share?
 

Attachments

Thread Starter

spookydd

Joined Aug 12, 2013
45
I did find a few microchip opamps and I haven't yet looked closely enough at their datasheets. They would be much cheaper than the lt1006. We'll see. otherwise I suppose the lm358 might work, and I'll double check on that on a breadboard to make sure. But the lm358 is a dual opamp and I would prefer using a single, so an other option would be nicer
 

WBahn

Joined Mar 31, 2012
32,878
Just the basic PDIP8 PIC, the 12F675. Nothing fancy, and I'm even going to have to figure out how to make it do I2C as well.
I've been poking around for a decent single opamp to use, but haven't selected one yet. I will try out the lm358 on a breadboard soon, but I am still looking at other options. It doesn't have to be rail-to-rail output, but a rail-to-rail input type would be more appropriate, as the output will never need to get anywhere close to the rails. it's only the input that needs to handle the roughly 200mV and it must output that with the gain of 10 as accurately as possible. it's for a measurement, so I want it accurate. maybe the op-07 could be a candidate, possibly..
If your input signal is from 0 V to 200 mV and you have a gain of 10, then your output is going to be between 0 V and 2.0 V. That would imply that the output can be near the rails if you are using a single-supply opamp.

I asked this before -- what is the smallest input signal for which you need an accurate output signal?
 

WBahn

Joined Mar 31, 2012
32,878
I arrived at something somewhat better using that lm358 model that I found and using smaller values of res that can actually be found and in a 0.1% tolerance.
Now if I could have a decent model of the op-07, that might be even nicer.
Anyone got a model of that op-07 to share?
Why do you think that the OP-07 is going to work for you?

Its input voltage range typically only goes to within 1 V of either rails and is only guaranteed to get within 2 V of the rail (and that's with +/- 15 V rails).

Its output voltage swing might not get any closer than 2.5 V of the rails (with a 10 kΩ load).

It's only spec'ed for supply voltages down to +/- 3 V (i.e., 6 V if running it single-supply).
 

Thread Starter

spookydd

Joined Aug 12, 2013
45
well then, the op-07 wouldn't be suitable.
I'm looking into the TL051 right now.
I am powering the opamp from the same rail as the PIC, so 5V, single rail.
And I don't need the gain 10 opamp to function near the bottom rail, nowhere near that. The 200mV reading would be about the full scale to read from the shunt, perhaps slightly more, but not much, and unlikely to drop below about 180mV, so it's not really that close to the bottom rail in any case. The reading range useful would be like 180-200mV or so from the shunt, and so I need this to come out as 1.8-2V. I don't see this as much of a tall order. I just need an opamp that does this well.
I can't get a model working yet for the TL051, but working on that.
If the microchip opamps aren't too expensive, we'll see about those next..
 

WBahn

Joined Mar 31, 2012
32,878
well then, the op-07 wouldn't be suitable.
I'm looking into the TL051 right now.
...
I can't get a model working yet for the TL051, but working on that.
Instead of spending a bunch of time trying to get a model working, you should look at the data sheet first. Just 30 seconds of effort is all it takes to rule it out.

1696990123441.png

Not only is the minimum supply voltage +/- 5V (so 10 V if you are doing single-supply), but the input voltage range starts 4 V above the negative rail.

On top of that, the output voltage range only goes down to about 2.5 V above the negative rail.

Any time spent trying to find and install a simulation model is pointless.
 

WBahn

Joined Mar 31, 2012
32,878
Several times it has been suggested that you look at offerings from Microchip.

I just did a Google search for "microchip single-supply opamp" and just clicked on the first one in the list from their site, which happened to be MCP6041

1696990710240.png

So it can clearly work with the low input voltages you are working with.

Its supply voltage range is 1.4 V to 6 V, which is a good match for your 5 V supply.

Its output voltage swing is rail-to-rail.

It's available in single amplifier packages.

It's available in plastic DIP packages.

DigiKey has them in stock and they are only $0.85 in single quantities.

https://www.digikey.com/en/products/detail/microchip-technology/MCP6041-I-P/413363
 

Papabravo

Joined Feb 24, 2006
22,083
Several times it has been suggested that you look at offerings from Microchip.

I just did a Google search for "microchip single-supply opamp" and just clicked on the first one in the list from their site, which happened to be MCP6041

View attachment 304666

So it can clearly work with the low input voltages you are working with.

Its supply voltage range is 1.4 V to 6 V, which is a good match for your 5 V supply.

Its output voltage swing is rail-to-rail.

It's available in single amplifier packages.

It's available in plastic DIP packages.

DigiKey has them in stock and they are only $0.85 in single quantities.

https://www.digikey.com/en/products/detail/microchip-technology/MCP6041-I-P/413363
If you ever give up your day job, I think you might have a future in purchasing. ;)
 

Thread Starter

spookydd

Joined Aug 12, 2013
45
well, I had been looking some more and I settled on the MCP601, which is even cheaper than the mcp6041 and apparently just about the same.
It does seem to check all the boxes, as far as I can tell.
1) through hole PDIP8. check
2) single opamp. check
3) single supply. check
4) rail-to-rail IO. apparently check (well enough)
5) low voltage, 2.7V min. check
6) won't break the bank. check as well (and actually available)
So I ordered some of those, and in the mean time, I still plan to try out some breadboarding with the LM358, but won't retain that one, because it's dual and I only want a single
I tried looking for a spice model for the mcp601 but so far, what I found doesn't seem to work properly, at least with ltspice, as the model probably isn't suited for it
 

Audioguru again

Joined Oct 21, 2019
6,826
You and your spice program did not read the datasheet of the TL071 opamp.
Te TL071 does not work when its total supply is less than 8V.
It has the problem called "Phase Inversion" where the output goes as high as it can (about 1.5V less than V+) if an input voltage is closer than 4V from its negative supply voltage.
Its output cannot go lower than about 1.5V above its negative supply voltage.
 

Thread Starter

spookydd

Joined Aug 12, 2013
45
well, it can go either way.
but aside from this little extra from the offset, it apparently will work as expected that way.
As I don't need it to go very close to the bottom rail and stay well off the upper one, the useful range is much more than enough for the purpose.
I couldn't put my hands on my lm358 stash, but while digging for those, I came across a few MCP602 and breadboarded a quick rig to test how this effectively works. And it does in a range far wider than necessary. So muy pick of the MCP601 should suit the purpose and it won't break the bank.
I couldn't find a spice model of the MCP601 that actually works in ltspice, so the only sim I was able to make is the one based on the LM358. Close enough I suppose. The key is, besides that input offset a little heavier than I wish it was, the MCP601 will do for now.
Unless someone has a better alternative to propose, this is what I'll use for now.
 

Audioguru again

Joined Oct 21, 2019
6,826
The LM358 dual and LM324 quad opamps are never used for audio because they are very noisy, produce crossover distortion and have trouble producing high output levels above 2kHz.
 

Thread Starter

spookydd

Joined Aug 12, 2013
45
this project isn't audio, so whatever shortcomings related to audio aren't an issue. and I actually don't think noise is something to worry about in this case. distortion isn't at all an issue as well, just put out the right voltage with the proper gain. the accuracy of the gain is what really counts. perhaps the drift over time and the changes with temperature are the only things to watch out for. but the usage is only very short term, just to take measurements, quite short, so temperature doesn't have much time to change and doubt any drifting would be of concern in such short times as well.
I'm going to breadboard the whole thing, and I'll see how it goes
 

WBahn

Joined Mar 31, 2012
32,878
The LM358 dual and LM324 quad opamps are never used for audio because they are very noisy, produce crossover distortion and have trouble producing high output levels above 2kHz.
And this is relevant.... how????

There is ZERO indication that the TS is going anything related to audio.

What I'm designing works off a 12V battery, so no negative rail possible.
There is a shunt tied to ground/minus (negative rail?), and I need to read that drop on the shunt and "magnify" it times 10, then it's fed to a PIC,
 

WBahn

Joined Mar 31, 2012
32,878
this project isn't audio, so whatever shortcomings related to audio aren't an issue. and I actually don't think noise is something to worry about in this case. distortion isn't at all an issue as well, just put out the right voltage with the proper gain. the accuracy of the gain is what really counts. perhaps the drift over time and the changes with temperature are the only things to watch out for. but the usage is only very short term, just to take measurements, quite short, so temperature doesn't have much time to change and doubt any drifting would be of concern in such short times as well.
I'm going to breadboard the whole thing, and I'll see how it goes
You still need to quantify the requirements.

It's not enough so say that the accuracy of the gain is what really count. How accurate is accurate enough? If the actual gain turns out to be 10.1, is that sufficient? If it turns out to be 9.9999993, is that unsatisfactory?

Changes in temperature are not just a matter over the time span of the measurement. If you take a reading in the later afternoon when everything is at 93°F and you take the reading of the exact same thing just before sunrise and the temperature is 51°F, you will get different results solely because of the effect of temperature.

So, again, what is the required performance of the system? Not just "best" or "as good as possible" or "very accurate", but more like "The output voltage must be correct with 0.01% over a temperature range of -20°F to +110°F".
 
Top