Non inverting/inverting LM358

Thread Starter

MBG

Joined Jan 30, 2022
23
So an LM321 would work? I don't have any and tried the LM358 in the application note on Allegro's site (attached) and having the same issue -- voltage on output going lower. I'm just a hobbyist so the nuances of chip individuality aren't not planted in my brain as the song goes.

I'll order some LM321. -- thanks very much.

Oh see I had replies -- yes I'm using the 30 amp sensor so less mv per amp.
Nice to know it's the chip -- this was driving me crazy.
 

Attachments

Last edited:

Thread Starter

MBG

Joined Jan 30, 2022
23
Yes -- it's fine. (That did throw me initially). I can put the vom on it and absolutely see a rise coming from the output pin. Do you know much about these sensors? Once you see you're getting an MV rise and you don't touch anything....they remain correct?

Just checked stock on LM321 -- none anywhere. Any options? --thanks
 

Papabravo

Joined Feb 24, 2006
22,082
Yes -- it's fine. (That did throw me initially). I can put the vom on it and absolutely see a rise coming from the output pin. Do you know much about these sensors? Once you see you're getting an MV rise and you don't touch anything....they remain correct?

Just checked stock on LM321 -- none anywhere. Any options? --thanks
Your best bet is to find a single supply rail to rail device. The LM358 is a very old and crippled design. I'm sure you can do better.
Analog Devices -- AD8541
Texas Instruments -- LMC6484A
Texas Instruments -- TSV911

1643840706438.png

TSV911 should also work in the circuit shown in Post #19
 
Last edited:

sghioto

Joined Dec 31, 2017
8,634
Any options? --thanks
The LM358 is probably fine it's actually a dual LM321.
Depends on how much current you are trying to sense. With a 1.5 amplification your sensor outputs appx 100mV/amp
The LM358 max output on a 5 volt supply is appx 3.6 volts. With zero current on the input the output of the sensor is 2.5 volts leaving 2.1 volts to work with or a max sense current of 21 amps.
 
Last edited:

sghioto

Joined Dec 31, 2017
8,634
Do you know much about these sensors? Once you see you're getting an MV rise and you don't touch anything....they remain correct?
I have one on my bench.
As long as the current being sense remains steady the output voltage should remain steady.
 

Thread Starter

MBG

Joined Jan 30, 2022
23
Ok. All I know is I cloned the circuit in the application note (using an LM358 instead of 321) and the output voltage goes low. But it does do it in a very nice, linear manner compared to the other circuit. Maybe they intended for Vout to be inverted which I could do easily. Actually, the app note circuit behaves very nicely except for it going lower like that.

edit -- I'm just sitting here having happy hour and maybe that circuit is intended to put out a lower voltage. With the 5v limitation, easier to go down than up? (Or am I having too much happy hour?).
 
Last edited:

sghioto

Joined Dec 31, 2017
8,634
Ok. All I know is I cloned the circuit in the application note (using an LM358 instead of 321) and the output voltage goes low.
If you reverse the connections on the input of the sensor the voltage output should decrease with current. This will show up as a positive increase from the LM358.
[This current sensor board is based on the Allegro ACS712ELCTR-30A bi-directional hall-effect current sensor chip that detects positive and negative flowing currents in the range of minus 30 Amps to positive 30 Amps. The board operates at 5V DC and the current flow through the sensor is converted to an output voltage starting at 1/2Vcc (or 2.5V) for no current flow and moves up 66mV per amp for positive current or down -66mV per amp for negative current.]
 

Thread Starter

MBG

Joined Jan 30, 2022
23
Ok. Like I say I had setup the sensor to view a + increase and that would be the inclination but I'll just reverse it. No one will know but you and me right ? :) -- thanks
 

eetech00

Joined Jun 8, 2013
4,705
Ok. All I know is I cloned the circuit in the application note (using an LM358 instead of 321) and the output voltage goes low. But it does do it in a very nice, linear manner compared to the other circuit. Maybe they intended for Vout to be inverted which I could do easily. Actually, the app note circuit behaves very nicely except for it going lower like that.

edit -- I'm just sitting here having happy hour and maybe that circuit is intended to put out a lower voltage. With the 5v limitation, easier to go down than up? (Or am I having too much happy hour?).
Hi

Here's a circuit to remove the offset, but you should use a rail-rail type opamp.
I used a voltage source to represent the ACS712-30 output.
Full scale voltage output of the sensor with Vcc=5v will be 2.5v+1.98v=4.48v.
The opamp output will be 1.98v when the sensor input is 30ADC.

1643854989673.png
 
Last edited:

Thread Starter

MBG

Joined Jan 30, 2022
23
Thanks ! What chip do you suggest? Seeing so many out of stock now. I really appreciate it. I'm spending the day getting my head around all things op amp. I'd like to find some sort of simulator online that doesn't take days to learn -- maybe even something that's just dedicated to opamps. Just a basic jump right in thing -- something simple.
 

Thread Starter

MBG

Joined Jan 30, 2022
23
I just watched this which is done very well --

But it's all coming back to me why I cringe when it comes to op amps. Like I say I'm a hobbyist (for 55 years) and yeah, a buffer or a non inverting amp is dead simple but with an inverting amp I just get to the point where I just copy the schematic and see if it works. Trying to understand the inverting mode is a brick wall with me. :)
 

eetech00

Joined Jun 8, 2013
4,705
Thanks ! What chip do you suggest? Seeing so many out of stock now. I really appreciate it. I'm spending the day getting my head around all things op amp. I'd like to find some sort of simulator online that doesn't take days to learn -- maybe even something that's just dedicated to opamps. Just a basic jump right in thing -- something simple.
In post #30-
OPA2325 Precision Opamp
Differential opamp configuration.
 
Last edited:

Thread Starter

MBG

Joined Jan 30, 2022
23
Ok thanks. Playing with my circuit this morning, it's all clear to me now and definitely need a rail to rail part. My 358 was getting saturated (which maybe can even drive the output voltage lower?). I'm checking current draw on a transceiver and at idle 2.76v, rcvr on 3.13v, and mic key 3.44v. Then with audio (it's AM) that voltage is even driven higher -- to the 3.5 limit). So now seeing how my problems were happening. Great forum -- thanks.
 

ag-123

Joined Apr 28, 2017
294
the LM358 seem to be saturating at 4.2v indeed.
there is a 'companion' chip LMV358, that one is rail to rail, if you need 5v at the top LMV358 probably gets you close to it maybe less a hundred millivolts or so.

I'd like to ask an off-topic question about LM358 and such experiments on a breadboard. Do anyone here really patch an op amp on a breadboard for the tests?
Initially i looked at it and thought, oh 4 resistors, easy. Then it turns out there are many multiple connections to the same node and i'd need to patch a lot of wires all over, sometimes so squeezed i run out of connectors to patch say on a short (vertical) rail. That's worse if you need to connect other stuff say interfacing capacitor, a filter capacitor between power rails, an electret mic and a load resistor etc. What is still not yet mentioned is the additional patch wires that needs to goto VCC and GND, there are more than a handful and they are 'all over the shop', not just a straight lead in say from +ve or -ve rail. oh and that is much worse, if you fancy, 'adjustable' gain, i.e. a variable resistor that patches the Vin and Vout.

my habit is the + input is VCC/2, using a resistor divider. then the - input is the R(L) / R(I) pair. so VCC/2 is my 'virtual ground' sort of.
this is an inverting amp, if the schematic is too hard to imagine.
 
Last edited:

crutschow

Joined Mar 14, 2008
38,507
Trying to understand the inverting mode is a brick wall with me. :)
Let's try to remove some of those bricks. ;)

Below is a basic op amp inverter circuit.
Because of the very high internal op amp gain and the negative feedback from output to the (-) input, the op amp output will always try to keep the (-) input essentially equal to the plus input (in this case ground).
This means the (-) input will always be within a few mV of ground (depending upon the actual op amp gain). This is called a virtual ground point.

So when a positive voltage is applied at Vin, a current will flow through R1 to the (-) input.
This starts to raise the voltage at the (-) input, causing the output to go in the negative direction.
To keep the (-) input at the virtual ground, the output voltage must go to a negative value such that the current through R2 is equal to the current through R1.

If the input signal polarity goes negative, then the output goes positive, again to match the current through R1.
Thus the output is inverted from the input with a gain equal to -R2/R1.

The important thing to remember is that, with negative feedback, the output will always try to keep the (-) input within a few mV of the (+) input.
You can use that to see how a non-inverting op amp circuit with gain works also (bottom below) and determine its gain equation.

Make sense?
1643909310871.png
1643909228183.png
 
Last edited:
Top