Question about opamp datasheet specs - Page 1
Forum section: electronics / projects

author: Peabody
author_rank: Super Contributor
timestamp: December 25, 2021, 12:49:18 am
content: I've used the MCP6041 opamp in a circuit. Its common mode range extends to a bit above the upper rail. And what I find in the three copies of this chip that I have on hand is that if you connect both inputs directly to the positive rail, the output is low. So this is comparator mode, with no feedback or biasing resistors. I don't know if this is standard behavior for any opamp - if the inputs are exactly the same voltage (both connected to the same low-impedance source), the output is always low. If not, I'd like to know if there is a datasheet spec that predicts this behavior, which is exactly how I want it to behave.The circuit involved is shown below. It's a solar-powered 18650 charger with load sharing (aka power path) using parts in hobbyist-friendly packages. If the input to the regulator is ever at a lower voltage than the battery voltage, the mosfet should turn on. But actually, the mosfet needs to stay on so there will be no oscillation. So it's nice that the opamp output stays low even if the drain and source are exactly the same voltage, and goes high only if the solar panels are providing all the power and the output after the Schottky actually rises above the battery voltage. So having this bias built into the opamp works out pretty well. Of course I'm assuming that this bias that's present on my three copies is typical for this part. But it would be nice if there's a spec that confirms that. I've looked, but don't see one. But since I'm not a trained professional, maybe I just don't know what to look for.I understand that RDSon will provide some voltage drop across the mosfet even when it is fully on, so maybe the circuit would work anyway, but that would depend on how much current is flowing, and the opamp's bias provides additional insurance against any oscillation. Anyway, in the drawing I refer to the TLV2401 as an alternate opamp which will tolerate higher voltages, but I don't have any of those, so I don't really know if they will work - unless there's a spec that tells me they will.Edit: I know the NDP6020P has been discontinued. I just don't know of a through-hole replacement for it.

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 25, 2021, 02:39:49 am
content: Hope I got what you want to achieve right.So, you should just add some hysteresis to your comparator circuit around the opamp to avoid oscillation and to avoid having to rely on what exactly will happen when the two voltages are too close to one another. That essentially takes the form of some positive feedback.

author: Kleinstein
author_rank: Super Contributor
timestamp: December 25, 2021, 11:08:43 am
content: With both inputs connected together and thus zero differential input voltage the output depends on the sign of the offset votlage. The offset can have both signs (but can vary between units), so both a low and high signal is perfectly in spec and no surprise.Usually the offset voltage of OPs does not have a defined sign it can be both ways.The offset voltage vs common mode graph is an example curve. It may look this way, but it can also be a bit different. The main point is that somewhere around 0.5 V and Vcc-0.7 V the offset can change. Changes are the change could also be in the other direction, though there may be a more common case.The main information to take from the curve is that in these two ranges there may be additional errors.Most other rail to rail OPs have only 1 such cross over region, but there are a few more with 2 such regions of reduced accuracy that are best avoided when accuracy matters.

author: Peabody
author_rank: Super Contributor
timestamp: December 25, 2021, 08:37:38 pm
content: Thanks very much for the comments. So it appears there's no guarantee that my three example chips are typical. However, I wonder if I can take some comfort in Figure 2.6 from the MCP6041 datasheet shown in the first picture below. To me it suggests that when the common mode voltage is near Vcc, as opposed to near Vss, there's a pretty strong positive offset voltage, which is what I want. In my circuit the non-inverting input is always directly connected to Vcc, and the lowest Vcc will get is the voltage at which the battery low-voltage protection is triggered, so no lower than about 2.5V if the battery is completely discharged overnight.Also, if any battery current is flowing through the mosfet, RDSon is going to cause some voltage drop, and that will help keep the opamp output low, and the mosfet fully on. That will be less reliable if current is very low (MCU sleeping), but in that case it probably doesn't matter much if the mosfet is only partially on. And I've tested this circuit over several days in sunlight, and can't detect any tendency to oscillate.I need to do more testing, but I feel pretty comfortable using this opamp without adding positive feedback. However, the second picture below shows the same graph for the otherwise similar MCP6141. It presents the opposite picture, with strong negative offset voltage at CMV = Vcc. And the same is true of the TLV2401. So it seems I need to order these other parts and see how well or poorly they behave. (The TLV provides a higher Vcc. With the MCP parts I'm limited to using 5V panels.)I would just like to avoid adding two resistors to the circuit to enable positive feedback. This circuit is in response to one proposed by Andreas Spiess that doesn't actually work in partial illumination. Mine works, but is already more complicated than his, so I'd like to avoid the resistors, and the current that would flow through them, if possible.

author: Kleinstein
author_rank: Super Contributor
timestamp: December 25, 2021, 09:03:20 pm
content: The graphs are just examples. A MCP6041 may as well behave like the curve shown for the MCP6141. The offset usually can be positive or negative and they usually try to get it close to zero. So positive and negative values can be similar likely. There can be still a tendency for them to prefer one case, but not guarantied and may be different from the one shown.As an exampl look at the curve from the MCP6006 data-sheet: there the offset changes sign with temperature. Looks like 1 step only with this one.

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 25, 2021, 09:34:38 pm
content: Yes, it also varies with temperature and can change signs with it, so... unless you design your circuits by crossing fingers...

author: Peabody
author_rank: Super Contributor
timestamp: December 26, 2021, 06:00:20 pm
content: So you're saying the "representative" part shown in Figure 2.6 isn't necessarily a "typical" part. And it was just luck of the draw that all three of mine had positive offset, or maybe they just came from the same batch.I need to think through how to deal with this. If an opamp had a negative offset near Vcc, then I think the effect would be that the gate voltage would rise until it got into threshold range for the current being passed, and that would create a built-in voltage drop across the mosfet essentially equal to the offset voltage. It would only be a few millivolts, and it would probably only be there at low current levels. At high currents, RDS would probably produce more than enough voltage drop to satisfy the input offset voltage. And I don't see that it would be any more prone to oscillate than the opamps I've been using.But I'm not sure that adding positive feedback is the answer. An alternative would be to just add some negative bias. I wish I had opamps with negative input offset voltage to experiment with. Perhaps I can simulate that. I was able to simulate the circuit using the LT1494 opamp, but I don't know what LTspice assumes about input offset voltage. Anyway, that was under load, with RDS helping create the voltage drop across the mosfet. I would need to simulate it at very low load (just the regulator), and if possible specify the input ofset voltage. Can I do that in LTspice? Or I guess I could just add some positive bias to the circuit and see how wonky it behaves. I'll attach the simulation files in case anybody wants to look at them. I would just say that the simulation shows what I found with the actual circuit - the performance is absolutely perfect.

author: Kleinstein
author_rank: Super Contributor
timestamp: December 26, 2021, 07:22:19 pm
content: The offset and offset drift can be any direction. Some units go one way and some go the other way. With BJT based ones there may be some correlation between the drift an offset (especially when larger), with FET based ones this is less the case.With the rail to rail OPs like the MCP6041 there are usually 2 input stages (one with N-channel and one with P-channel , or NPN/PNP) and at the extremes only one of the 2 input stages will be active. The two input stages can have different offsets and thus the step in the offset curve at some point. Depending on the OP type the change over from one input stage to the other can be in a small range and thus only 1 step, or there can be an extended range in the center with both stages active resulting in 2 steps. Usually the direction of the step is random, though when there are 2 steps the usually go on one direction as the center part (most of the range) is in between the two extremes.The simulation may not be accurate for the offset and common mode error, as there are many possible variations. I don't think many OP models include full data for a monte carlo type simulation of random variations between units.

author: Peabody
author_rank: Super Contributor
timestamp: December 26, 2021, 11:32:21 pm
content: I understand, but the question remains as to the effect on circuit performance if the input offset voltage is different from the opamps I'm using, or if mine drift significantly. I may be able to determine what the LTspice models use as the input offset voltage, if anything other than zero. The only opamp of this type I have found in LTspice is the LT1494. I have the Pspice definition for my MCP6041, even a separate version for use as a comparator, but don't know how to convert that over to LTspice.In any case, my thought is to simply add some positive or negative bias to the non-inverting input, and see how the circuit performs in simulation - what effect the bias has on the output voltage at different load currents and battery voltages. If it turns out that added bias under, say, 5mV simply doesn't make any difference, then I think I don't have to worry about input offset voltage. The exception might be checking for oscillation, which I might need to test in the physical circuit.

author: Peabody
author_rank: Super Contributor
timestamp: January 04, 2022, 06:11:42 am
content: Just to wind this up, I changed my simulation schematic to insert a voltage source in series with the non-inverting input to simulate positive or negative input offset voltage. What I found, at least in simulation, was that I was worrying about the wrong thing. It turns out that if the opamp output is high when the inputs are equal, the circuit still behaves just fine. It doesn't shut down the mosfet, or oscillate, and the currents provided by the battery and the panel , as well as the output voltage, remain the same as they are if input offset voltage is zero. That's even with the input bias set well above 3mV.However, the situation I was originally happy with - the output is low when the inputs are equal - is not good. As illumination increases, the mosfet is late turning off, which results in panel current flowing backward through the mosfet to the battery for a while. Of course this only happens during the brief period when the panel begins to supply all of the power, and it's not very much current because the voltage difference isn't very great, so it might work well enough without any correction. But at a bias of -3mV, I get about 30mA of reverse current, and I don't want that if the battery is fully charged.Positive feedback only makes this worse. But adding negative feedback eliminates the problem - without messing up things if the bias is reversed. It looks like the negative feedback using 1meg and 3.3K resistors fixes things for input offset voltage of up to +/-3mV, and the current flowing through the resistors is only about 2uA.Below is the schematic I used in the simulations showing both the input bias voltage added to the non-inverting input, and the negative feedback added to the inverting input. I hope these changes were the right way to simulate these things.I still don't know if the simulations using the LT1494 produce the same results as I would get if I had a working model for the MCP6041 that I'm actually using. And I don't know how I would test these things on the actual circuit. I only have a toy scope, and would have to figure out a way to trigger when battery current goes negative.

author: magic
author_rank: Super Contributor
timestamp: January 04, 2022, 09:31:01 am
content: Here's a funny picture which reminded me of this thread a few days ago.Apparently, they somehow managed to skew Vos towards positive on average while the worst cases are still symmetric.

author: magic
author_rank: Super Contributor
timestamp: January 04, 2022, 09:44:23 am
content: Quote from: Peabody on January 04, 2022, 06:11:42 amThis should work, I think. You created a noninverting amplifier which amplifies battery voltage ~300x with respect to load voltage. In practice, it will amplify the sum of battery voltage and opamp offset and the worst case of -3mV×300 is still not enough to turn on many FETs.For testing you could put a resistor in series with the FET.

author: Peabody
author_rank: Super Contributor
timestamp: January 04, 2022, 04:55:17 pm
content: Quote from: magic on January 04, 2022, 09:44:23 amI don't understand. What would the gate voltage be in that worst case?I'll have to think about what adding the resistor in series with the mosfet would test. (It should be clear by now that I have no formal training in any of this.)

author: Peabody
author_rank: Super Contributor
timestamp: January 04, 2022, 08:00:29 pm
content: I ran the simulation with the input offset voltage proxy (V2) at -3mV, 0, and +3mV. The result is shown below. While the gate voltage isn't at ground, it doesn't appear to be high enough to affect anything. The panel and battery currents, and the load voltage, overlap on the three runs. At the same time, the gate voltage isn't ever low enough to permit current flow back into the battery. Well, you can see just a hint of that - a tiny glitch when battery current first reaches zero. I ran it again at a battery voltage of 3.5V and got the same thing.

author: Peabody
author_rank: Super Contributor
timestamp: January 09, 2022, 08:14:32 pm
content: I determined the input offset voltage of my three MCP6041 opamps. They range from 0.11mV to 0.82mV, and by chance the 0.82mV is the one I've been using in the physical circuit.I've also added a 0.51R resistor in series with the mosfet, and connected my battery-powered scope across the resistor. If the voltage across the resistor ever goes negative, that means current is flowing from the panel back to the battery, which is not what I want.The simulation of 0.82mV input offset voltage (-0.82mV bias added in series with the non-inverting input), but without the feedback resistors, produces a definite reverse current, as shown below. However, I am able to produce such a negative spike from the same physical circuit only by increasing the panel illumination very rapidly. The scope in single trigger mode, with the falling trigger point just below zero, captures this dependably, and it lasts about 3ms. But if illumination changes slowly, there is never any negative battery current. I even dug out my LM317 supply with 20-turn pot, and am unable to produce any negative current no matter how fine the adjustment. As the "panel" current increases, battery current decreases, but just stops at zero.The negative spike produced by a rapid light change might be caused by gate capacitance, or the opamp slew rate being too slow, or possibly even the fact that the opamp Vcc is also the mosfet output, so it is rapidly changing when the light changes. But it seems to me that I should be able to produce a steady-state negative current because of the input offset voltage, and don't understand why I can't.

author: asdf336
author_rank: Contributor
timestamp: January 10, 2022, 12:19:42 am
content: Add a resistor network to introduce your own offset bias in the direction you want with an amplitude that exceeds the worst case offset of the opamp (edit ok maybe I’m late on this).

author: Peabody
author_rank: Super Contributor
timestamp: January 10, 2022, 05:47:14 am
content: Yes, I can add the resistors. But at this point I'm still trying to figure out if I need to do that.One thing that's peculiar about this circuit is that the non-inverting input is directly connected to the opamp's Vcc pin. And I wonder if at that extreme the opamp behaves differently than it does testing for input offset voltage at a lower voltage. I've already confirmed that when both inputs and Vcc are all connected together, the output is low. Tomorrow I'll try to measure how low the inverting input has to be to make the output go high. Nominally it should be .82mV below Vcc, but I suspect it will be a good bit closer to Vcc than that. Otherwise I don't know how to explain the results I'm getting. The problem is that I don't have the gear to control the voltages down to 10s of microvolts. But I'll give it a try.

author: asdf336
author_rank: Contributor
timestamp: January 11, 2022, 12:12:39 am
content: I mean if you need it to be a reliable design you need to design around the specs which in no way guarantee offset polarity.Opamps are designed for zero offset which means you can expect them to “miss” in both directions. If they ever do detect a trend in offset they’ll correct it. Note high end opamps show distribution curves of offset and drift and you’ll see they inevitably fall on both sides of zero. (OPA140 is one example).So you can test 10000 opamps and number 10001 can be different. I’ve lived this working at a company with poorly designed 20 year old products. Like clockwork every year there is a new problem as some component shifts within its data sheet range and destabilizes the design.

author: Peabody
author_rank: Super Contributor
timestamp: January 11, 2022, 11:20:54 pm
content: Ok, I was finally able to replicate the simulation behavior in the physical circuit. The problem had been that I placed the 0.5R shunt resistor coming out of the mosfet. So when the current tried to reverse, the voltage drop across the shunt made the opamp behave correctly, which meant I wasn't seeing the reverse current predicted by the model. Now I've put it on the battery side, and I get almost exactly what LTspice showed - about 10mA of reverse current coming back into the battery just as the panel voltage edges higher than the battery voltage.In actual practice using the opamp I've been testing (0.8mV input offset voltage), it probably doesn't do any harm. The reverse current only occurs when the panel voltage is just above the battery voltage - within the input offset range - but never when it's dark or in full sun, and it can't really cause any harm unless the battery is already fully charged. But running the simulation with the full 3mV maximum input offset, things get a bit dicey - lots of current going the wrong way.So, I do need to provide a fix for it, which is the previously discussed negative feedback, aka the non-inverting amp with gain of 300. LTspice says that works for the full input offset range of +/-3mV. I was hoping to avoid having to add the resistors, and also avoid the current used in the resistors, but unless someone is using an opamp that happens to have negative input offset voltage, I think the fix is the safe way to go. I'll write an addendum for my Github repo on this subject, and try to explain what's going on, and when the feedback is needed. Thanks very much for everyone's contributions. Sorry I was so slow to figure it out.

author: magic
author_rank: Super Contributor
timestamp: January 12, 2022, 08:21:18 am
content: It goes without saying you can reduce current in resistors by increasing their value10MΩ/33kΩ should still be widely available and result in <1µA waste.

author: Peabody
author_rank: Super Contributor
timestamp: January 12, 2022, 04:24:56 pm
content: Yes, but I don't have any 10Meg resistors, and don't know how far I can take it without running into noise issues. But I guess the 33K would be the controlling factor on that. Anyway, I've learned a lot about how all this works, and particularly about how solar panels work, and how linear chargers work with them.

author: Peabody
author_rank: Super Contributor
timestamp: January 17, 2022, 10:35:40 pm
content: I've found that the negative battery current problem is worse than I thought. Without the added feedback resistors, if the opamp drives the gate low when the two inputs are equal (positive input offset voltage), then as increased illuminance increases the power output of the panel, the output voltage of the circuit stays at the battery voltage, and the increased power goes into providing more backflow charging current to the battery through the mosfet. Since the non-inverting input is connected directly to the circuit output, and the inverting input to the battery, there is nothing to trip the opamp to the opposite state because the output is still at battery voltage, and large amounts of current can flow. The only thing that finally stops this is that the mosfet's Rds(on) causes enough voltage drop that it overcomes the input offset voltage.I guess this should have been obvious to me, but it wasn't. Anyway, it means the added feedback is essential for any opamp that has, or may drift to, positive input offset voltage. The picture below shows what's happening.