Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to Zero Output from LM358 Differential Amplifier?

Status
Not open for further replies.
I was going to propose splitting the supply and creating an artificial or "virtual" ground (hence my question in post #28), but gave up when DamoRC said he was using a 5V wall wart, and also because he might have a 30mA LED.
Attached is a scheme that uses a simple DC-DC converter to create ≈-2.8V. I added a DPDT switch for simplified gain switching. This scheme still needs a voltage regulator, or a separate reference voltage, to keep the output stable. If the LM331 can be made ratiometric, then it might work without a regulator, but that would seem to me like a poor design.

The .asc file is not identical to the posted schematic. I was mainly testing the interaction between the converter and the amplifier.
 

Attachments

  • Hall effect level shifter sch.PNG
    Hall effect level shifter sch.PNG
    33.2 KB · Views: 883
  • Hall effect level shifter.asc
    3.4 KB · Views: 184
Last edited:
Roff,

Thanks for the suggestion. At least I know where to start if I go the negative supply route. I like the resistor / pot networks for fine adjustment of the voltage - I don't think I have seen this before (just shows you how little I know). As always, I have a couple of Qs.

(1) Is there a general model or set of relationships that I can refer to that helps you calculate what the negative voltage will be (the LM358 can only operate down to -1.5v if I am reading the data sheet correctly?

(2) What do you mean when you say "if the LM331 can be made ratiometric"?

Thanks

DamoRC
 
I forgot that I cannot make a Quick Reply on this website so it is gone.
 
Last edited:
Roff,

Thanks for the suggestion. At least I know where to start if I go the negative supply route. I like the resistor / pot networks for fine adjustment of the voltage - I don't think I have seen this before (just shows you how little I know). As always, I have a couple of Qs.

(1) Is there a general model or set of relationships that I can refer to that helps you calculate what the negative voltage will be (the LM358 can only operate down to -1.5v if I am reading the data sheet correctly?
I don't know what you are reading, but the LM358/324 can handle any split of 32V: 0 and 32, -2 and 30, -8 and 24, ±16, -32 and 0, etc., or any rail-to-rail differential of 32V or less, down to around 3V. You just have to maintain the input common mode range to be between the negative rail and 1.5V below the positive rail.

(2) What do you mean when you say "if the LM331 can be made ratiometric"?

Thanks

DamoRC
I may have gone off half-cocked on this proportionality thing. I looked through the thread again, but couldn't find the Hall effect device part number or a link to the data sheet. Could you post it again, please?
 
OK, the A1302KUA-T Hall sensor is ratiometric. That means that the "gain" (volts/gauss) is a function of Vcc. Since the LM331 gain (hertz/volt) is not a function of Vcc, you will need a voltage regulator for the A1302KUA-T and for the offset voltage pots. You might as well use the same 5V regulator for the entire system.
Is your wall wart internally regulated, or is the output greater than 5V when unloaded or lightly loaded?
 
hi damo,
Built on a bread board the circuit I posted using a LM358.
The output of the LM358 cannot be set closer to zero than +0.6V, for the reasons explained in my post, the LM358 in that configuration is not up to the job.

I then tried a MCP6002 [rail2rail] OPA in the same circuit, as explained the non invert gain is 2.
So used a divide by 2, resistive divider on the non invert input.

With HE input set at 2.5V, the NI is 1.25V , so the OPA output is 2.5V [without any Voffset input on INV]

Adjusted the Voffset to null out the OPA 2.5Vout, the output zero close to 0V, actual 8mV, with no external load on the OPA.

But as Al points out the HE device could be subject to fields that would drive above and below the nominal output +2.5V of the HE.

Could you tell us what the expected range of output of the HE you expect when in service.??

BTW: my patience isn't wearing thin, its Teflon coated...;)
 
Last edited:
Understood. Just so we are on the same page, we are talking about my original inverting differential amplifier with the voltage injection component that you had added - correct?

I will record the various voltages you suggested, with and without the voltage injection and with and without the feedback resistor. Probably be tonight before I get this completed.

DamoRC



Yes the original circuit with two 14k resistors, two 20k, and one 10k input resistor.

With the feedback resistor (14k) removed you should see the output go from 0v to 3.5v when you change the input from about 2v to 3v.

We can do a few more tests to determine what is wrong. This circuit isnt that complicated.

BTW i've worked on projects that have taken years to complete so this shouldnt bother my patience too much :)
 
Last edited:
Roff - Thanks for the explanation. So, If i understand correctly, if there is a load on the circuit that pulls the voltage slightly lower than Vs, the HE sensor output per magnetic input will change, but the LM331 frequency will not, so I cannot guarantee that the change in frequency observed at the LM331 output is truly due to magnetic influence on the HE, it could be just voltage fluctuations on the Vs to the HE.

Eric - thanks for taking the time to replicate the circuit and confirm the findings..

Mr Al, I did some testing last night prior to reading your post (so I was using my original circuit) but I think I have covered the bases you wanted me to. Also, I mis-stated my supply specs. The circuit is currently powered by a phone charger wall wart, rated output 4.8volts, 750 ma.

I reconstructed the circuit in stages and took voltage readings as I went along.

First off, the correction on the supply, it's a 4.8v, 750 ma rated supply. A quick check indicated that
(1) No load voltage = 4.81v
(2) 22 ohm load (target 218 ma), voltage drops to 4.74v
(3) 10 ohm load (target 481 ma), voltage drops to 4.63v

So probably not a regulated supply.

Onwards...

(1) Vs = 4.81v
(2) HE no magnetic field and not connected to the circuit = 2.40v
(3) HE with example signal (weak magnetic field) and not connected to the circuit = 2.42v

Connect Hall Sensor to LM358 in- through 10K. (feedback to in- not connected). Voltage divider (22K plus 50K POT) connected to in+ (Vref)
(4) With Vref = 2.40v, Vout (from LM358) = 3.50v
(5) With Vref = 4.80v (max Vref I can produce), Vout = 3.50v
(6) With Vref = 1.40v (min Vref I can produce), Vout = 0.00v
(7) Set Vref to 2.36v, Vout = 0.00v
(8) Set Vref to 2.41v, Vout = 3.50v (these last two (7 and 8) were to get me close to the switching point)
(9) With Vref at 2.41v and Vout at 3.50, application of weak HE signal (representing an increase from 2.40 to 2.42v at the in-) the signal dropped to 0.00v

Connect LM358 output to in- without Rf - circuit becomes insensitive to the HE signal. Vout moves from 3.46 to 1.42v as the Vref is set at 4.81v and 1.42v respectively. Setting the Vref to 2.38 makes the output go to 2.4v but the circuit does not respond to the signal from the HE.

Added 10K Rf from LM358 output back to in-.
(10) Vref at 2.38, Vout at 2.4, apply HE signal, Vout drops to 2.38
(11) Adjust Vref to min and max (1.4 and 4.8v), Vout moves from 0.62 to 3.48v
(12) adjust Vref to 2.8v, Vout is 3.24v, apply HE signal and Vout drops to 3.22v

So with the 10K (1x amplification) connected, the output is shifting by the correct magnitude and in the correct direction when I apply a field to the HE

I realized at this stage that I was using the opposite polarity field to what I had been using previously (HE signal is going up by 0.02v with application of field because the magnetic polarity is different to what I was using earlier)
So I switched the field polarity and repeated point (12) above

(13) Vref at 2.8v, Vout is 3.24v, apply HE signal, Vout rises to 3.26v
(14) Set Vref to 1.53, Vout is 0.70v (close to the minimum of 0.62v), apply HE signal, Vout rises to 0.72v

So the circuit responds predictably to the different HE signal (inverts by the same magnitude).

I shorted in+ to ground, Vout became 0.62v, HE (with no signal) still outputs 2.4v, circuit non-responsive to HE when magnetic field applied (no surprise there).

Removed short to ground and confirmed that circuit is behaving as in (14) above

(15) Vref = 1.53, Vout is 0.70v , apply HE signal, Vout rises to 0.72v

Added positive voltage injection through 10K to in- as suggested by Mr Al

(16) Vout dropped from 0.70v (in 15) to 0.66v with addition of positive voltage injection
(17) Adjust Vref until Vout returns to 0.70v (Vref now = 2.61v), apply HE signal, Vout rises to 0.72v

So the Voltage injection works in that the circuit is still responsive to the HE signal, however, the circuit will still not adjust to 0.00v output (or close to). The positive voltage injection actually increased the lowest level I can go to from 0.62v to 0.66v.

DamoRC
 
hi damo,
Read your results.
With a LM358 and a single 5V supply the circuit will never work as you want it too.

Eric
 
Roff - Thanks for the explanation. So, If i understand correctly, if there is a load on the circuit that pulls the voltage slightly lower than Vs, the HE sensor output per magnetic input will change, but the LM331 frequency will not, so I cannot guarantee that the change in frequency observed at the LM331 output is truly due to magnetic influence on the HE, it could be just voltage fluctuations on the Vs to the HE.

Eric - thanks for taking the time to replicate the circuit and confirm the findings..

Mr Al, I did some testing last night prior to reading your post (so I was using my original circuit) but I think I have covered the bases you wanted me to. Also, I mis-stated my supply specs. The circuit is currently powered by a phone charger wall wart, rated output 4.8volts, 750 ma.

I reconstructed the circuit in stages and took voltage readings as I went along.

First off, the correction on the supply, it's a 4.8v, 750 ma rated supply. A quick check indicated that
(1) No load voltage = 4.81v
(2) 22 ohm load (target 218 ma), voltage drops to 4.74v
(3) 10 ohm load (target 481 ma), voltage drops to 4.63v

So probably not a regulated supply.

Onwards...

(1) Vs = 4.81v
(2) HE no magnetic field and not connected to the circuit = 2.40v
(3) HE with example signal (weak magnetic field) and not connected to the circuit = 2.42v

Connect Hall Sensor to LM358 in- through 10K. (feedback to in- not connected). Voltage divider (22K plus 50K POT) connected to in+ (Vref)
(4) With Vref = 2.40v, Vout (from LM358) = 3.50v
(5) With Vref = 4.80v (max Vref I can produce), Vout = 3.50v
(6) With Vref = 1.40v (min Vref I can produce), Vout = 0.00v
(7) Set Vref to 2.36v, Vout = 0.00v
(8) Set Vref to 2.41v, Vout = 3.50v (these last two (7 and 8) were to get me close to the switching point)
(9) With Vref at 2.41v and Vout at 3.50, application of weak HE signal (representing an increase from 2.40 to 2.42v at the in-) the signal dropped to 0.00v

Connect LM358 output to in- without Rf - circuit becomes insensitive to the HE signal. Vout moves from 3.46 to 1.42v as the Vref is set at 4.81v and 1.42v respectively. Setting the Vref to 2.38 makes the output go to 2.4v but the circuit does not respond to the signal from the HE.

Added 10K Rf from LM358 output back to in-.
(10) Vref at 2.38, Vout at 2.4, apply HE signal, Vout drops to 2.38
(11) Adjust Vref to min and max (1.4 and 4.8v), Vout moves from 0.62 to 3.48v
(12) adjust Vref to 2.8v, Vout is 3.24v, apply HE signal and Vout drops to 3.22v

So with the 10K (1x amplification) connected, the output is shifting by the correct magnitude and in the correct direction when I apply a field to the HE

I realized at this stage that I was using the opposite polarity field to what I had been using previously (HE signal is going up by 0.02v with application of field because the magnetic polarity is different to what I was using earlier)
So I switched the field polarity and repeated point (12) above

(13) Vref at 2.8v, Vout is 3.24v, apply HE signal, Vout rises to 3.26v
(14) Set Vref to 1.53, Vout is 0.70v (close to the minimum of 0.62v), apply HE signal, Vout rises to 0.72v

So the circuit responds predictably to the different HE signal (inverts by the same magnitude).

I shorted in+ to ground, Vout became 0.62v, HE (with no signal) still outputs 2.4v, circuit non-responsive to HE when magnetic field applied (no surprise there).

Removed short to ground and confirmed that circuit is behaving as in (14) above

(15) Vref = 1.53, Vout is 0.70v , apply HE signal, Vout rises to 0.72v

Added positive voltage injection through 10K to in- as suggested by Mr Al

(16) Vout dropped from 0.70v (in 15) to 0.66v with addition of positive voltage injection
(17) Adjust Vref until Vout returns to 0.70v (Vref now = 2.61v), apply HE signal, Vout rises to 0.72v

So the Voltage injection works in that the circuit is still responsive to the HE signal, however, the circuit will still not adjust to 0.00v output (or close to). The positive voltage injection actually increased the lowest level I can go to from 0.62v to 0.66v.

DamoRC


Hi again,

Something simple must be wrong but the minus terminal signal 'injection' resistor is supposed to be 14k not 10k, unless you use a 10k feedback resistor too.

In the test where we remove the feedback resistor, the output should jump between say 0v and 3.5v, but not in between.

What is the exact part number of the op amp you are using? Could it have been damaged previously?
 
Eric - thanks. I think I am getting to the point where I will need to (a) live with what I have or (b) add some negative supply to the circuit.

Mr Al,

I used my original circuit for the testing.

Injection resistor, HE input resistor and feedback resistor were all 10K.

In the test where we remove the feedback resistor, the output should jump between say 0v and 3.5v, but not in between.

I think that this is covered in points 8 and 9. When the VRef is 2.4 volts Vout does jump from between 0 and 3.5v with small change in the HE input signal.

Or am I missing something?

I can try this again with another LM358 (as I happen to have a bunch) but I think Eric was seeing the same kind of numbers as mine when we tried the non-inverting version of the circuit so I don't think its the IC.
 
Hello again,

Ok lets take this one step at a time then. With input of 4v, what does the output measure (all resistors intact)?
You also have the two 20k resistors to bias the non inverting input of the op amp?
 
Eric - thanks. I think I am getting to the point where I will need to (a) live with what I have or (b) add some negative supply to the circuit.
Are you aware that in the circuit I posted in post #41, you can use LM358 instead of the LM324? I only put the LM324 in because I mistakenly thought that's what you had. I'm reposting it here, with the op amp changed to LM358.
 

Attachments

  • Hall effect level shifter sch.PNG
    Hall effect level shifter sch.PNG
    33.1 KB · Views: 305
Hi,

Roff, im not sure why you would post such a complex circuit and confuse matters more. This circuit doesnt even need a negative supply anyway right?
Lets get it working right first and then add stuff later. Sound good?
 
Hi,

Roff, im not sure why you would post such a complex circuit and confuse matters more. This circuit doesnt even need a negative supply anyway right?
Lets get it working right first and then add stuff later. Sound good?
It will never work right if zero volts out with zero gauss in is a requirement. It needs a negative supply if he wants to get to zero.
 
Hi there Roff,

Well would you be happy if we got it to work with the output going down to say 50mv?
The way i see it, without a negative supply we should be able to get down to 50mv (or hey, at least 0.1v right?) or else something simple is wrong with the circuit like a bad op amp or bad connection etc. He is reporting that he can only get as low as 0.6v which is wayyyy higher than it should be with a truly working circuit even without a ground. So i thought that after we get the output down to some more reasonable level like 0.1 or better then we could start tacking on other parts to make the circuit work even better. But tacking on parts now is the wrong thing to do because it's not working the way it should to begin with. That's all i am saying, not that we shouldnt do something like that eventually.
The other thing is that once we get it working properly (down to 0.1v or less without a negative supply) he may even decide that the circuit is good enough like that. This is what i am really expecting because i know this circuit can go down below 0.1v without an additional negative supply. But of course, i'll leave it up to him if he really thinks it is necessary later.
 
MrAl, did you read my post about the output having to sink the current that flows through the feedback resistors?
Compare that number to the specs, and you will see why 50mV is probably not possible without a negative supply.
You can get closer by reducing the feedback current by a factor of 10. You will need to make the Thevenin resistances on the +in and -in inputs equal, so that input bias current does not cause problems.

I wasn't "tacking on parts". I was giving our OP a solution to his problem as stated. The circuit I posted should work if it is built correctly. As I mentioned, a 5V regulator is needed, which means that the 5V wall wart won't work.
The regulator will be needed no matter how the rest of the circuit is implemented.
 
Last edited:
The output of the LM358 is NPN and PNP complimentary emitter-followers. They have a voltage of about 0.62V each. The output has an extra 50uA current source to ground to pull its output down to typically 0.005V when it has a 10k resistor to ground and when it does not have a feedback resistor like in this circuit pulling the output up with a current that is much higher than 50uA.
 
Hi again guys,


My apologies, i thought someone already made it clear to the OP that there would be the need for some kind of output resistor to ground and so this would be an automatic assumption. I think i would opt for a 1k resistor myself.

As far as the 5v power supply is concerned, i would tend to want to use a 5v *regulated* supply. However, because of the ratiometric operation of the HED and of course the two 20k divider resistors are automatically ratiometric this circuit could very well work with an unregulated supply too, as long as it doesnt dip too much lower that say 4.5 volts. I want to take another look at that HED data sheet first through. Yeah ok, it works only down to 4.5v so using a 5v unregulated supply is cutting it close. If the line dips down to low line the DC could very well dip as low as 4.25v which would not really be good enough. I would suggest a regulated wall wart or a wall wart with more DC output like 9v and a good 5v regulator at least as good as the LM317L or better.

As i said *several* times in this thread however, we dont need a negative supply so dont worry about that anymore.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top