# Differential amplifier op amp problem

I am learning Differential amplifier, and it has been fun and smooth, but I encounter a problem here. This is a 10x Differential Amplifier setup, and the voltage drop across R5 (0.01 ohm) is 5mv, so the output should be 50mv, but the simulation gave me a strange 97mv output, almost double my expected result. What is the problem here?

V(n001):     4.55006     voltage
V(n004):     4.54596     voltage
V(n003):     5   voltage
V(out):  0.0972042   voltage
V(vb):   4.995   voltage
V(va):   5   voltage
V(n002):     0.000604282     voltage
Id(M1):  0.49994     device_current
Ig(M1):  -2.31583e-009   device_current
Is(M1):  -0.49994    device_current
I(R6):   0.49994     device_current
I(R5):   -0.499984   device_current
I(R4):   -4.54596e-005   device_current
I(R3):   -4.45285e-005   device_current
I(R2):   -4.54038e-005   device_current
I(R1):   -4.44944e-005   device_current
I(V2):   6.45349e-005    device_current
I(V1):   -0.500029   device_current
Ix(u1:1):    -5.57749e-008   subckt_current
Ix(u1:2):    -3.41455e-008   subckt_current
Ix(u1:99):   -6.45349e-005   subckt_current
Ix(u1:50):   2.00963e-005    subckt_current
Ix(u1:28):   4.45285e-005    subckt_current

• Replace that FET with a short. Then re-sim. May 7, 2018 at 2:19
• @analogsystemsrf same result.
– user83582
May 7, 2018 at 2:21
• Try connecting the negative op amp supply to a negative voltage supply instead of ground. May 7, 2018 at 2:25
• @Billy Kalfus I don't know if it's a good idea, since I need to use a similar circuit like this in my future project that run on 5v USB power supply ONLY.
– user83582
May 7, 2018 at 2:29
• You can create negative voltages from a USB supply. But even if you couldn't, it's about finding the source of the error and THEN finding a solution rather than assuming the error is somewhere else just because you don't see a clear solution if the error is there. May 7, 2018 at 2:31

The answers are in the LM358 datasheet.

Most op-amps have limits on the common mode input voltage range. In your circuit the + and - inputs of the amplifier are at about 4.55V. But page 5 of the datasheet says that the common mode range goes from 0V to VCC - 1.5V. Since you are operating the amplifier from a 5V supply the maximum common mode voltage is 5V - 1.5V = 3.5V.

Lowering the value of V1 to 3.5V or less may fix your problem.

Also, Most op amps have trouble driving the output all the way to 0V or to VCC. The LM358 is no exception. In your circuit the output stage of the op-amp is sinking about 50uA of current via your 100K feedback resistor. If you look at figure 11 of the datasheet you will see that the op-amp output won't get all the way to 0V when its sourcing 50mA of current.

One way you can fix this is to provide a pulldown resistor on the output (say 100 ohms) to help the op-amp get all the way to ground.

Even with the pulldown resistor you may not always get all the way to 0V. If you want the output to be accurate as you approach 0V you would need some sort of negative supply.

The alternative to using a negative supply is to use a 2.5V reference and connect R4 to that reference rather than ground. Your measurements would then all be relative to 2.5V at the output. So for example a 5mV difference at the input gives 2.5V + 10 x 5mV = 2.55V at the output.

• Lower V1 to 3.5v gave me a V(out):0.0869797, slightly better result, and adding a 100 ohm resistor to the output and ground gave me a V(out): 0.0612655, and using a +5 and -5 supply for the 358 gave me a V(out): 0.0603848.
– user83582
May 7, 2018 at 3:08
• and using a reference voltage of 2.5V with R4 would be no different than using bipolar supplies I think. At your place, I would stay with two bipolar supplies so that the output voltage has enough headroom May 8, 2018 at 7:30

Your ~4.5V input voltages are outside the range for the LM358 being operated from +5/0, so it won't work at all in reality anyway.

Give the op-amp +8/-5 supplies and it will work (sort of) but when you calculate the required matching of the resistors you will have an unpleasant surprise. If you want 5-10% accuracy then you will need resistors matched to better than 0.01%.

And even if you do all that, it still will be garbage because the maximum input offset voltage of the LM358 can be as bad as 3mV, which is 60% of your entire signal, or about 10x worse than you would need for 5% accuracy.

To sum up, it's a bad approach that would make a really good op-amp look very bad, and you are using a bad op-amp to begin with.

• I never understand what that input offset voltage means in the datasheet, Now I got a better idea. I have the 358 running at +10 and -10, the output is V(out): 0.0762553, but still not good. So the input offset voltage is the main cause of this problem?
– user83582
May 7, 2018 at 2:59
• And matching of resistors, which means the CMRR (Common Mode Rejection Ratio) is not good and will not be stable. Because you are subtracting 5V - 5.0xV and a small error in either means a large error in current reading. Even with a really high performance precision amplifier, it's a bad approach. Look at how high-side current sensor circuits are designed. May 7, 2018 at 3:02
• You mean by putting the 0.01 near ground? It gives me similar result too, above 0.07 volt.
– user83582
May 7, 2018 at 4:29
• If you put it near the ground (low side sense) then a good (low Vos, TCVos single-supply or RRIO op-amp will do the trick nicely. May 7, 2018 at 10:05

This is a 10x Differential Amplifier setup, and the voltage drop across R5 (0.01 ohm) is 5mv, so the output should be 50mv

Points to note

• The input offset voltage of 3 mV adds or subtracts with your input signal of 5 mV and makes it potentially in the range 2 mV to 8 mV.
• You are exceeding the input common mode voltage range by some margin

Get a rail to rail op-amp with sub 100 uV input offset voltage if you want some measure of accuracy.

• so the inputs have to be from voltage of 0-3.5v? by switching R5, the 0.01 resistor near ground, I can overcome this problem, but since the input offset voltage is still too high, so I still get a bad result of 0.07v instead of the ideal 0.05v?
– user83582
May 7, 2018 at 11:50
• Correct, input offset voltage adds an error to your voltage sensing. May 7, 2018 at 12:34