What's wrong with my differential amplifier circuit? (Lab PSU design) - Page 1
Forum section: electronics / projects

author: tbj
author_rank: Contributor
timestamp: May 18, 2015, 04:53:51 pm
content: Hi all.I'm trying to use a differential amplifier for high side current sensing in my bench supply, loosely based on Dave's series of bench power supply videos.Here's my simulated circuit. Works more or less as expected.In my real circuit...Op amp is a KIA358P (LM358 clone) which in the datasheet says the output should be able to swing to ground.One side of sense resistor is at ~16.7 above groundThe other side is at ~16.3 above groundResistors are 10k (actually 9.73k, matched to within .01k)I expect to see ~.4 volts at the op-amp output; I actually see ~.7.What's going on here then?Any help appreciated

author: void_error
author_rank: Frequent Contributor
timestamp: May 18, 2015, 08:52:44 pm
content: That's easy, you're trying to operate your opamp outside its common-mode input voltage range.The 358 has a PNP input stage so it can't take an input voltage as high as its supply rail, TI datasheet says 1.5V below V+ maximum.Either increase the supply voltage at least 2-3V above the input voltage or use a rail-to-rail input opamp.Also take the input offset voltage into account.

author: DanielS
author_rank: Frequent Contributor
timestamp: May 18, 2015, 10:24:45 pm
content: Quote from: void_error on May 18, 2015, 08:52:44 pmThe op-amp's Vin+ is at Vsupply/2 due to the 10k-10k voltage divider. That puts the op-amp pretty much exactly in the middle of its common-mode range.I have not checked the specs but since it is a no-frills bipolar op-amp, I'm guessing 0.7V is about as low as the output can go without negative supply.

author: c4757p
author_rank: Super Contributor
timestamp: May 18, 2015, 10:35:14 pm
content: Quote from: DanielS on May 18, 2015, 10:24:45 pmYes, VICMis not being exceeded here. You're just expecting the output to go lower than it can while also sinking current.

author: akis
author_rank: Frequent Contributor
timestamp: May 18, 2015, 10:36:51 pm
content: You may be able to insert a biased diode 1n4148 at the foot of R6 therefore raising 0V to 0.65V or thereabouts. You could bias the diode through a 2-3K resistor. That way your "0V" expected output is now shifted to 0.7 V, it is not terribly accurate as the diode's drop will fluctuate somewhat, but if you bias it strongly it will not be affected by R3 and R6.

author: AxleD
author_rank: Regular Contributor
timestamp: May 19, 2015, 02:22:27 pm
content: I encountered the same issue trying to use the LM358/LM258 as a high side differential amplifier. After pulling my hair out for a day or two I eventually found the answer in the datasheet. Despite what they say, the LM358 can only swing to ground if it sinking a tiny current or sourcing current. If it sinks more than a few microamps the transistor will saturate at 0.7v instead of the 0v you expected (as c4757p already highlighted).See the attached which was taken from the TI datasheet.To get the opamp to swing below 0.7v you can use higher feedback resistors (say 200k) or load the output. Unfortunately you will run into the same problem when the voltage drop across the resistor gets very small and you need the opamp to swing virtually to ground (a few mv).The only viable solutions i found was to get a good rail to rail op amp or use a negative supply.

author: tbj
author_rank: Contributor
timestamp: May 19, 2015, 09:01:36 pm
content: I'm beginning to believe that there's no such thing as a true rail-to-rail op-ampUsing a charge pump to create a virtual negative rail seems like it could be an option. Seems hacky, though. Is this a common way to handle this?The supply to the op-amp doesn't have to be symmetrical, does it? I could just have 5 volts or so on the negative rail just so I can swing the output entirely to ground, correct?One thing I don't get is why this problem was never mentioned in Dave's lab supply videos (and, in fact, doesn't manifest itself in the usupply, which uses the 358 in this configuration in the current limit circuit).

author: DanielS
author_rank: Frequent Contributor
timestamp: May 20, 2015, 12:42:13 am
content: Quote from: tbj on May 19, 2015, 09:01:36 pmMost op-amps do not have a ground reference pin so they have absolutely no clue where their + and - supplies are relative to ground. You can split the supply voltage whichever way you want within the device's operating range depending on what input and output dynamic range you need.Since all you want here is to have true zero within the output range, even -2V negative supply would be enough.One inexpensive way of generating a low-power negative rail is simply to capacitively couple the supply transformer into a second rectifier bridge. You can limit the negative supply with either a couple of shunt diodes, a zener, a 431, a 7905 or anything convenient.

author: akis
author_rank: Frequent Contributor
timestamp: May 20, 2015, 07:12:54 am
content: Did you check my diode suggestion. You only need 2 additional components, a diode and a resistor. Because the op-amp cannot really sink down to 0V, very few op-amps can, you do not ask it to. You tell it "your 0V from now on will be 700mV". So all you have to do then is subtract 700mV from whatever the output is, it is almost perfectly linear.Edit: correcting early morning brain farts

author: mikerj
author_rank: Super Contributor
timestamp: May 20, 2015, 08:23:45 am
content: Quote from: tbj on May 19, 2015, 09:01:36 pmIf there is, the ancient and very cheap LM358 certainly isn't it.