# How do I invert the output of this current sensor using the other side of the LM358?

Referencing a design that uses a more expensive OpAmp, I have put together (in simulation) this current sensing circuit that uses one half of an LM358. I would like to use the other half of the LM358 to invert the output of this circuit. That is, where right now the output is 0V when there is no current through the load increasing linearly to 5V when the maximum current is reached, I would like an output of 5V when there is no current decreasing to 0V when the threshold maximum current is reached.

I have made several attempts at adding an OpAmp inverter circuit (again referencing the basic diagrams found via Google), but I have not been able to hack the two circuits together properly. How can I wire the other side of the LM358 to accomplish this? Edit: After some more playing around with the simulator I realized that I was misunderstanding the inverting OpAmp concept, among other things. I am still curious to know if there's a relatively simple analog circuit that will accomplish my stated goal, but I (think I) understand now that it's not going to be a matter of just wiring up the second OpAmp with a few resistors.

• I think you can swap the connections at pin 2 and 3 and then connect Q1 to Vcc instead of R3, with an another 200 ohm resistor. That way you can use other half of the LM358 for other applications. Mar 19, 2012 at 18:06
• @abdullahkahraman: In the simulation, that gives 10V output when there's no current flowing and drops instantly to 0V when there's even the smallest current. Mar 19, 2012 at 18:16
• Ah, right, because there is some kind of feedback here and the above try doesn't provide that. Mar 20, 2012 at 7:41

Try this topology: One thing to watch out for, and I don't have time to check on the LM358, is what you're asking for needs the op-amp to be a rail-to-rail type for both the inputs and outputs.

Edit: Here is the suggested circuit simulated: As you can see, the output ramps down from its high as soon as there is any current flowing. Substituting an ideal op-amp for the LM358 changes the voltages somewhat but not the behavior / curve.

Or have I done something incorrectly?

• LM358 input cannot come closer than ~~ 1.5 V to V+ from memory. Mar 19, 2012 at 23:22
• Thanks, Russell. That more or less means whether OP sticks with his current circuit and bodges on an extra inverting stage, or goes with something simpler that inverts right from the start, (s)he'll need a different op-amp. Mar 20, 2012 at 0:41
• I edited this question yesterday to attach simulation results for this proposed circuit, but apparently the edited version needs "peer review" before it becomes visible to anyone else. The summary is, the output of this circuit ramps down from its high as soon as there is any current flowing. Substituting an ideal op-amp for the LM358 changes the voltages somewhat but not the behavior / curve. Mar 20, 2012 at 13:31
• It looks like I mis-calculated the amount of gain in your original circuit. Try changing R1 to 100 and R2 to 2.46k in my circuit and the new gain should match what was in your original circuit. You will have to tweak the R values to get standard values that give roughly the same gain. Mar 20, 2012 at 16:15
• Your new simulation shows R1 and R3 as 0.2 Ohms, where previously you had a 2 Ohm sense resistor (as far as I could tell from your image). You can increase R1 or decrease R2 to reduce the gain. Increasing R1 will reduce the power consumption but might reduce accuracy by mismatching the impedance seen by the inputs to the op-amp. Mar 21, 2012 at 16:40