LM358 differential amplifier configuration - Page 1
Forum section: electronics / beginners

author: sachleen
author_rank: Contributor
timestamp: December 27, 2013, 12:28:57 am
content: I'm trying to use a 358 as a differential amplifier similar toU12B in Dave's uSupply.Here's my CircuitLab drawing and it seems to do the job in simulation:https://www.circuitlab.com/circuit/97h282/current-sense-amp/However, on my breadboard, I'm not seeing any change when I increase the difference between the two voltages. Similar to Dave's schematic, I have a 1 ohm resistor in series with V+ and the rest of my circuit. The blue wire is V+, the red is on the other end of the resistor. All four resistors are measured to be 9.8 K ohm but as long as they're the same it shouldn't matter.I'm seeing the voltage difference between red and blue wires as I change the load. 50mA load gives me roughly 50mV across the resistor. If I get rid of the 358 and ground the resistor connected to pin 7 (so I have just a voltage divider on each side of the sense resistor) I see a 50mV difference there, too. That difference goes up to 600+ mV as I increase the load up to 600+ mA. So I know all that works fine. Now, when measure the output of the 358 on pin 7, I see 730mV when it should be reporting 50mV. It will increase by maybe 10mV instead of the 1mV/mA I expect.I've tried swapping out the chip for another one so I know the chip is fine. Can anyone spot something wrong with the circuit?

author: Rerouter
author_rank: Super Contributor
timestamp: December 27, 2013, 02:02:16 am
content: Input Common Mode Range: 0 to (Vcc - 1.5V)try throwing 3 diodes in front of your 1 ohm current shunt for testing purposes, the supply voltage needs to be higher than the inputs by 1.5V

author: sachleen
author_rank: Contributor
timestamp: December 27, 2013, 02:57:02 am
content: OK I'm seeing some changes now. It's reading 1.7257V when there is 51.9mV across the shunt and 1.7393V when there is 71.4mV across the shunt. 1.622V across the three 1N4001s.Why do I need this, though? The input voltages are around 6v (12V supply) because of the divider, isn't it?

author: Rerouter
author_rank: Super Contributor
timestamp: December 27, 2013, 03:51:20 am
content: oh bugger, i've been playing around with high gain ones for too long, yes it does divide them down,that result actually raises some questions, i would advice you to confirm your resistance values

author: sachleen
author_rank: Contributor
timestamp: December 27, 2013, 03:56:36 am
content: That was the last thing I did before asking here. Checked them and labeled the picture in my original post. They're all 9.8X K ohm. I've tried swapping them around since they're not exactly the same values but that didn't make a difference, not that I was expecting any, but I don't know what else to try.

author: Galaxyrise
author_rank: Frequent Contributor
timestamp: December 27, 2013, 11:35:40 pm
content: Quote from: sachleen on December 27, 2013, 12:28:57 amShouldn't it be a 25mV difference between the middle of the voltage dividers? A 50mV difference there makes me suspect your ground.

author: sachleen
author_rank: Contributor
timestamp: December 28, 2013, 12:21:52 am
content: Quote from: Galaxyrise on December 27, 2013, 11:35:40 pmI thought that was a bit odd, too. If both voltages are divided by two, their difference should be halved as well. I've moved the circuit on to a separate breadboard and just have it hooked up to a dummy load right now. Same result. If you look at the attachment, I paralleled another 10k with R2, making it 5K, and I'm seeing an output of 4.05V and it changes as I increase the voltage across the shunt with the dummy load. So this is doing what I want but offset 4V. Mysimulation in circuit labdoesn't show the same result, though.

author: sachleen
author_rank: Contributor
timestamp: December 28, 2013, 01:56:45 am
content: So I think the fact that I'm reading 50mV after the divider has to do with my resistor values not being the same.Here are my numbers:Voltage on both sides of shunt: 12.023 V and 11.970 V - difference: 0.053, about what I expectFirst voltage divider (divide 12.023 by 2): 5.009 K and 4.997K - ratio: 0.499Second voltage divider (divide 11.970 by 2): 4.985 K 4.935 K - ratio: 0.497Voltage measured after divider: 5.997 V and 5.948 V - difference: 0.049, NOT what I expect.But if you do the math, a slight change in ratio produces a huge change in the output:(12.023 *.499) - (11.970 *.497) = 0.050387(12.023 *.499) - (11.970 *.499) = 0.026447Still doesn't explain why the op amp isn't working right.

author: Galaxyrise
author_rank: Frequent Contributor
timestamp: December 28, 2013, 02:11:44 am
content: My first thought was that your output is too close to the negative rail of the opamp. So I checked the datasheet, and it says 20mV, so I thought "that can't be it." But now that I've built it, that's totally it. And now I see the little caveat on the datasheet "RL < 10k". RL is 20k for you, and Vcc is 10V vs the 5V the 20mV is specified for. I have to lower pin 4 by a bit more than half a volt to get it to work.Here are some voltages from my working breadboard: (- to +)D to A:51.30mVC to A:10.00VC to F:45.25mVB to E:-1.15mVC to G:-1VNote that I'm using a 258 and not a 358, but I expect you'd get similar

author: sachleen
author_rank: Contributor
timestamp: December 28, 2013, 02:38:08 am
content: You're looking at the swing characteristic? The minimum output voltage V_OL is 5mV typicall, 20mV max with an input of 5V, right?But I'm expecting 50mV, which should be within the range. I can't supply a negative voltage to the V- input. Can you explain how RL fits into this? I originally had all 10Ks but now have 5Ks and it doesn't make a difference.

author: Rerouter
author_rank: Super Contributor
timestamp: December 28, 2013, 02:58:09 am
content: RL is the resistive output load, the op amp has a bias current coming out of its output, and with a high impedance or no load at all cannot approach ground

author: Galaxyrise
author_rank: Frequent Contributor
timestamp: December 28, 2013, 06:35:54 am
content: I was mistaken about your RL; your only lower potential path to ground is the voltmeter. But I added a 2k resistor from the opamp output to ground, and that didn't fix it like I expected it to. I had to go down to 100 ohms, where I could get down to 19.4mV output.

author: sachleen
author_rank: Contributor
timestamp: December 28, 2013, 07:26:36 am
content: Adding a 100ohm resistor from the output to ground is getting me close. I'm seeing the linear change in output as the voltage across the shunt increases but I have about ~50mV offset. You think that would be because my divider ratios are not exact?

author: Rerouter
author_rank: Super Contributor
timestamp: December 28, 2013, 07:43:44 am
content: yesmeasure your exact resistances and put those value into your simulation

author: sachleen
author_rank: Contributor
timestamp: December 28, 2013, 06:45:34 pm
content: Simulation seems to agree with what I'm seeing now. It's interesting that the simulation didn't show the need for the 100 ohm resistor. I see now that the DC solver doesn't work unless I have the volt meter connected in circuit lab so I guess that should have been a clue.Thanks guys!

author: kaykan
author_rank: Newbie
timestamp: March 28, 2014, 10:46:38 am
content: Quote from: sachleen on December 27, 2013, 12:28:57 amI have the same problem, I attach the schematic and the values expected and real.I tried with another op-amp (LM6462) and its work good, the problem is that this op-amp work up to 15V and I would like to use VCC=VDD=30V at the end (LM385 is up to 32V).From the real.png, seems that the op-amp don't work for low difference V+ - V-, my first design have VDD=VCC=19V so I think that the issue is that on the V+ I get a value too near with VDD of the gain, but now there are over 5V, but still not working..I have the same problem, I attached the schematics and the values expected and real.I tried with another op-amp (LM6462) and this work as expected, the problem is that this op-amp work up to 15V and I would like to use VCC=VDD=30V at the end (LM385 is up to 32V).From the real.png, seems that the op-amp don't work for low difference V+ - V-, my first design have VDD=VCC=19V so I think that the issue is that on the V+ I get a value too near with op-amp VDD of the unity gain, but now there are over 5V, but still not working..

author: salbayeng
author_rank: Frequent Contributor
timestamp: March 05, 2021, 05:17:15 am
content: It's an old post , but the LM358 has a blindspot on inputs and outputs for the top 2v below VCC , that's because the input stage is PNP.For a highside current sense use a ZXCT1009 or similar.https://www.diodes.com/assets/Datasheets/ZXCT1009.pdfYou can use a piece of PCB track as shunt , if accuracy not a problem (e.g. current limit to motor).