Voltage Shifting for OpAmp

  • Thread starter 1rel
  • Start date
  • Tags
    opamp
  • #1
43
3

Main Question or Discussion Point

There's a LM741 OpAmp in a circuit, that's amplifying a signal (from a hall effect sensor) with about -0.5/+0.5 V voltage swing. The hall sensor requires about 1.2 V to operate.

Since I'm using a single power supply for the OpAmp (at ~10 V), I figured, that I need to shift the voltage to power the hall sensor up to about half the supply voltage, so that the sensor signal swings around Vcc/2.

The simplest way to do this, that came to mind, was to use a voltage divider with 3 resistors between Vcc/Gnd. Two big ones (R1) and a small one in between them (R2). According to this formula, I can pick up a voltage over R2 that is just in the middle between the power rails.

Something like that...
Vcc --- R1 --i-- R2 --i-- R1' --- Gnd

(Found by some simple calcs):
r = R1 / R2
r = ( Vcc - Vdiff ) / ( 2 * Vdiff )

example:
Vcc = 10 V
Vdiff = 1.2 V
r = ( 10 - 1.2 ) / ( 2 * 1.2 ) = 3.66...
So for R1 = 10 k, R2 = 36.6... k

The hall sensor doesn't require much power to work. So thought it should be ok to it that way, and in fact it does work, but isn't really stable somehow... Is this the proper way to do it (I actually don't think it is...)? Is there better still easy way to accomplish that? Maybe with two linear voltage regulators, like the LM317T?
 
Last edited:

Answers and Replies

  • #2
berkeman
Mentor
56,819
6,787
There's a LM741 OpAmp in a circuit, that's amplifying a signal (from a hall effect sensor) with about -0.5/+0.5 V voltage swing. The hall sensor requires about 1.2 V to operate.

Since I'm using a single power supply for the OpAmp (at ~10 V), I figured, that I need to shift the voltage to power the hall sensor up to about half the supply voltage, so that the sensor signal swings around Vcc/2.

The simplest way to do this, that came to mind, was to use a voltage divider with 3 resistors between Vcc/Gnd. Two big ones (R1) and a small one in between them (R2). According to this formula, I can pick up a voltage over R2 that is just in the middle between the power rails.

Something like that...
Vcc --- R1 --i-- R2 --i-- R1' --- Gnd

(Found by some simple calcs):
r = R1 / R2
r = ( Vcc - Vdiff ) / ( 2 * Vdiff )

example:
Vcc = 10 V
Vdiff = 1.2 V
r = ( 10 - 1.2 ) / ( 2 * 1.2 ) = 3.66...
So for R1 = 10 k, R2 = 36.6... k

The hall sensor doesn't require much power to work. So thought it should be ok to it that way, and in fact it does work, but isn't really stable somehow... Is this the proper way to do it (I actually don't think it is...)? Is there better still easy way to accomplish that? Maybe with two linear voltage regulators, like the LM317T?
Can you post your circuit schematic so far? There are several ways to do this...
 
  • #3
43
3
Hi!

That's about what I have on the bread board:

HallEffectSensorLM741_00a.png


(It's for an exercise I want to do, a megnetic levitator, just to learn more about electromagnets, and how to control them... It already almost works. Still need to tune the PID controller program more.

The reason why I ask about this "voltage shifter" for "biasing/offsetting the opamp input" is just because I have problems making the sensor/opamp output (Vout) reliable. - I have 3 "power rails" in the whole setup. 5 V Arduino, 10 V hall sensor/opamp part, 10-36 V electromagnet. To keep Vs stable at 10 V, I've used a LM317. But somehow, I constantly have to adjust the RM pot when changing the parameters/main supply voltage... it's not reliable this way.)
 
Last edited:
  • #4
davenn
Science Advisor
Gold Member
2019 Award
9,123
7,065
you have given no info on the Hall sensor
what is its part # ?

Dave
 
  • #5
43
3
It's a linear hall sensor, desoldered from an old CD-rom drive BLDC motor, so I don't know the exact specifications. They are really small, I've already experimented with a couple of hall sensor found before in different floppy disk/CD-rom drives (but the solder joints break just too easily... hm).
And they all seem to be similar, 4 pin linear hall senors, in a small SMD package and seem to work with around 1 V (found by trial'n'error), giving an output of plus/minus half the supply voltage. The last one gives me an output of up to +/- 500 mV max, at <5 mA, just tested it before.... If I rememeber correctly, some other ones from old floppy drives didn't go up to half supply voltage, giving just a couple of millivolts output (+/-).
 
Last edited:
  • #6
davenn
Science Advisor
Gold Member
2019 Award
9,123
7,065
so if you have no info on it, how do you know if its connected up correctly ?
there in may lie all your problems :)
 
  • #7
43
3
True :) It was more or less trial and error...

(The trick to find out the pin layout was to just apply a small voltage (0.5 V) to the pins, and find out which of them are drawing some current. (The good thing is: The Vcc/Gnd pins are normally on the diagonal on opposite sides of the chip.))


Corrections: It's already late here... and I've missed some points:

1) The sensor doesn't give +/-0.5V, it's more like +/-0.25 V, when powering it by ~1 V.
2) I think it was a stupid mistake, that was causing the troubles. Two 6.8 k resistors (R1), and 100 k pot. There was not enough current flowing through the two R1 resistors... I've replaced them with 330 Ohm resistors, and a 1k pot, and it seems to help... Sorry for posting it too early!

Still having problems with this whole biasing thing though.

Do you think it is okay to use this kind of voltage divider? Or does it make sense to use two voltage regulators, to lift the supply voltage for the sensor up to ( Vcc / 2 ) - 0.5V / ( Vcc / 2 ) + 0.5V? I've never worked with things like that before...
 
Last edited:
  • #8
davenn
Science Advisor
Gold Member
2019 Award
9,123
7,065
Do you think it is okay to use this kind of voltage divider? Or does it make sense to use two voltage regulators, to lift the supply voltage for the sensor up to ( Vcc / 2 ) - 0.5V / ( Vcc / 2 ) + 0.5V? I've never worked with things like that before...

Again ... .who knows ? without knowing how the Hall sensor is supposed to be wired, the way you happen to wire it is just a wild random guess,
which may or may not damage the sensor as you could be subjecting it to voltage and/or currents outside its tolerances

Dave
 
  • #9
43
3
Thanks. The sensor is working fine, the sensor itself was never a problem... (it works from 1V upwards, and draws <5 mA, and give a nice linear output.)

On a more general note, I was wondering, if it is generally okay to "step" the supply voltage for any sensor/low power part of a circuit down that way, if it's drawing just a little bit of current? Or are there other, more reliable/convential ways to do such offset down to a lower voltage, if it's needed somewhere in a circuit...

I'm thankful for any hints. (Just learning to construct simple circuits myself right now... I only have very basic knowledge when it comes to putting parts (of the right size) together without a giving schematic...)
 
Last edited:
  • #10
berkeman
Mentor
56,819
6,787
And they all seem to be similar, 4 pin linear hall senors, in a small SMD package and seem to work with around 1 V (found by trial'n'error), giving an output of plus/minus half the supply voltage
Thanks. The sensor is working fine, the sensor itself was never a problem... (it works from 1V upwards, and draws <5 mA, and give a nice linear output.)
We really need more info on the Hall sensor IC to be of good help. In EE, we don't just do things by trial and error -- we use the datasheet to tell us the best ways to use components, and to understand what we have to take into consideration when using the component in ways different from the traditional way they are used.

Since you say it appears to be similar to other Hall sensors, can you find an example sensor and point us to the datasheet? That would be a big help.

I'm not a fan of using voltage dividers to make virtual grounds for single-supply applications with opamps. There are generally better ways to do this. But without seeing more info on how the Hall sensor is traditionally hooked up, it's hard to just "guess" at a good solution. Hope that makes sense. :-)
 
  • #11
berkeman
Mentor
56,819
6,787
Also, sorry if I missed it, but what are you using to digitize Vout? What does the ADC input to your PID controller look like?
 
  • #12
43
3
It would certainly help to have a datasheet at hand for the sensor... yes.

(I'm not a electrical engineer, but I'd like to learn more about it. Trial'n'error also isn't my preferred way of doing things, but it helps sometimes to get a feel for how things work... The sensor was surprisingly easy to handle. - OpAmps on the other hand, and the issue about this "voltage shifting" topic is more diffiuclt to understand for me though...)


I'm not a fan of using voltage dividers to make virtual grounds for single-supply applications with opamps. There are generally better ways to do this.
Do you have any suggestions to do this in another (simple) way?

I've tried to find more info before about virtual grounds/dc coupled opamps powered by a single power supply. But it's all quite confusing to me. Some sources are going into too much detail, and others are too superficial... The voltage divider like above works. But if another sensor would be used, that wouldn't have constant resistance (like a light dependent resistor), it would probably not work properly anymore... the middle resistor of the divider/"RM Pot" and the sensor are in parallel... so hmm..


what are you using to digitize Vout? What does the ADC input to your PID controller look like?
It's the ATmega/Arduino ADC, read the scaled down output of the LM741 to 5V by another volage divider (R3/R3'). Since the LM741 isn't rail to rail, I need to clamp the read values on the microcontroller to the range the PID program can use.

That's the circuit on my bread board (Arduino using only the Hall_Vout input, and the IN1 output to control the magnet by PWM).

HallEffectSensorLM741_00b.png


(The PID program works okay, adjusting the PWM signal to power the coil. But I ran into almost unsolvable instability issues.... Almost giving up on this small levitator project... It's quite hard to tune all the parts (software/hardware). I don't yet know what which parameters cause the instability...)
 
  • #14
berkeman
Mentor
56,819
6,787
hall sensor doesn't look right
see tutorial here
Yeah, that's what I was thinking. The bias current should just come from some current source between the rails, and one side of the sensing terminals should just be tied to a Vref (like 2.5V), so that the delta-V from the Hall effect generates a positive offset output voltage out of the opamp with respect to that Vref...
 
  • #15
berkeman
Mentor
56,819
6,787
@1rel -- What is the uC's Vref voltage? Is it half of the 5V supply? If so, just stack the Hall voltage on top of Vref, and drive the ADC input directly with the output of the opamp...
 
  • #16
berkeman
Mentor
56,819
6,787
  • #18
43
3
Thanks for all the inputs!

Like already said, the sensor works like shown in the schematic. I just don't know if this 3-resistor voltage divider type of "virtual ground" makes any sense in practice. I don't see such a configuration of 3 resistors often when looking around the web..


hall sensor doesn't look right
see tutorial here
http://www.electronics-tutorials.ws/electromagnetism/hall-effect.html
mag26.gif
It's wired much like in the image above, just with "offset" in voltage, instead of directly powered by the DC Supply.

Is it a good practice make a virtual ground with such a 3-resistor voltage divider? When driving a differential opamp with a single power supply (direct coupled, I need to amplify the actual input value, and not only changes in input voltages...)?


Yeah, that's what I was thinking. The bias current should just come from some current source between the rails, and one side of the sensing terminals should just be tied to a Vref (like 2.5V), so that the delta-V from the Hall effect generates a positive offset output voltage out of the opamp with respect to that Vref...
I was thinking something along those lines too.

The hall sensor has 2 output pins, and their difference should be amplified... as far as I've understood. So there is no constant Vref.

@Current source betweent the rails:
The voltage measured over that RM pot was set to about 1.2 V, without the sensor hooked up, measuring the voltage with a multimeter. So that the resistance/voltage drop over the hall sensor, which is then wired in parallel to the pot, doesn't reduce the voltage too much later on, so that it stays over 1 V, which is required minimum (found experimentally, kept it low to not damage the sensor, it could be probably higher...). Instead of using that pot, the same can be done with that formula from the first post...

That's only needed because I use a single power supply. The output of the hall effect sensor moves up/down from half it's supply voltage (1V / 2 + virtual ground). And the difference of the two output pins should be about zero without any magnetic field applied. So it lies right in between the rails (Vs <-> Gnd).

The output signals from both output pins is then fed into the differential OpAmp (LM741) which amplifies thier difference by a gain of RF/R2 (?)... (which can be tuned by hand, RF is actually also a potentiometer in the circuit).

As far as I figured it out so far, the OpAmp "calculates" thier difference and amplifies it. Taking the non-invenrting input (+) subtracting the inverting one (-). Both are/should be in the middle of Vs (10V / 2) at the beginning, so that that the output of the opamp can swing in both directions. - It adjusts the output voltage, so that it gets as close as possible to the non-inverting input voltage (which also can be moving in respect tho other one), over the feedback resistor RF.

The voltage swing of the outputs hall effect sensor should now be amplified up to the range of Vs=10 V to Gnd (with some margins). (The LM741 needs at least 9V to operate, as far as I've read...)

I don't know if that all makes any sense...


Or it could also have a diffamp inside the IC with a differential output, like this HAL1 IC from micronas:

http://www.google.com/url?sa=t&rct=...ysRqxelOrzui87LPYyfk7Ag&bvm=bv.83339334,d.cGU
I don't know :)

Recently I've ordered a couple of those, which could be similar to the ones test so far. No detailed datasheet for these neither, but better than none at all ;)
http://www.ohhallsensor.com/pic/other/2013-07-10-14-49-190.pdf


@1rel -- What is the uC's Vref voltage? Is it half of the 5V supply? If so, just stack the Hall voltage on top of Vref, and drive the ADC input directly with the output of the opamp...
The ATmega/Arduino is powered by USB 5V at the moment. That's why I needed to halve the opamp output before feeding it to the ADC...
 
Last edited:
  • #19
jim hardy
Science Advisor
Gold Member
2019 Award
Dearly Missed
9,839
4,868
It's wired much like in the image above, just with "offset" in voltage, i
i dont know what that means. Offset?

Is it a good practice make a virtual ground with such a 3-resistor voltage divider?
it's okay so long as you dont demand it supply any current (any that is beyond opamp input bias current, usually less than a microamp)
looks to me like you've violated that.
R2' can have no current
but R2 assuredly does.

If you draw inside your hall IC a four terminal wheatstone resistor bridge
it allows current to flow between terminals 2,3 and 4
meaning,,,
opamp's output can change voltage at its noninverting input
because making opamp output more positive reduces current through R2 which reduces drop across R1
which makes volts at hall sensor more positive,
increasing voltage at R2' and opamp's noninverting input
and that's positive feedback
which gives stability problems
which you list as a symptom.
 
  • #20
43
3
i dont know what that means. Offset?
By offset I just meant, that the supply voltage for the sensor is lifted up by the voltage divider.

Measuring voltage over R1, should give:
V_R1' = R1' * I = R1' * Vs / ( R1 * 2 + RM )

So for RM = 90 Ohm. And R1/R1' = 330 Ohm.
This results in:
I_total = 10 V / ( 330 * 2 + 90 ) Ohm = 13.33... mA
V_R1' = 330 Ohm * I_total = 4.4 V

That's the offset measured from ground, to the node between R1' and RM (without any sensor connected, which is assumed to draw not too much current).
Virtual ground is now at 4.4 V?

it's okay so long as you dont demand it supply any current (any that is beyond opamp input bias current, usually less than a microamp)
looks to me like you've violated that.
R2' can have no current
but R2 assuredly does.

If you draw inside your hall IC a four terminal wheatstone resistor bridge
it allows current to flow between terminals 2,3 and 4
meaning,,,
opamp's output can change voltage at its noninverting input
because making opamp output more positive reduces current through R2 which reduces drop across R1
which makes volts at hall sensor more positive,
increasing voltage at R2' and opamp's noninverting input
and that's positive feedback
which gives stability problems
which you list as a symptom.
That sounds really interesting! But I don't understand yet what you're saying there...

Bias current of an opamp means: the current that actually flows into the opamp input pin? For an ideal opamp that would be zero?
If that is in reality always never ideal, I need to allow current flow into the inverting input of the opamp?

I'm just started to learn about using opamps, so it's very likely that something is wrong with the circuit above... that's why I asked initially.


For what I learned so far, it's okay to assume that there is no current flowing into the inputs of the opamp.
I also assume, that there's not much current flowing out of the hall sensor outputs.

So, looking at the schematic again, I also see problems there (so, wondering again, why it actually worked on the bread board, like that...)

There's no current flowing into non-inverting input of the opamp. It just senses the voltage on the output pin 1 of the sensor, as a reference (let's call it V+). Right?

Now if the voltage on the inverting input (V-) of the opamp, is for example, 10 mV higher than V+, what happens? - I thought, that the opamp now tries to change its output voltage, so that V- matches V+...

But it seems like, there can no current flow back through the feedback resistor RF... to make V- equal to V+ by changing the output voltage of the opamp.

Should I add a resistor from the non-inverting output to virtual ground? Maybe I try that later on...
 
  • #21
jim hardy
Science Advisor
Gold Member
2019 Award
Dearly Missed
9,839
4,868
Bias current of an opamp means: the current that actually flows into the opamp input pin? For an ideal opamp that would be zero?
If that is in reality always never ideal, I need to allow current flow into the inverting input of the opamp?
Yes in ideal opamp it'd be zero. We only have to consider it after the basic circuit topology is laid out.


For what I learned so far, it's okay to assume that there is no current flowing into the inputs of the opamp.
okay, that's a good start. Usually it's good enough and will be for your circuit.

I also assume, that there's not much current flowing out of the hall sensor outputs.
almost okay, except for pin 2.
........
There's no current flowing into non-inverting input of the opamp. It just senses the voltage on the output pin 1 of the sensor, as a reference (let's call it V+). Right?
correct

Now if the voltage on the inverting input (V-) of the opamp, is for example, 10 mV higher than V+, what happens? - I thought, that the opamp now tries to change its output voltage, so that V- matches V+...
correct

But it seems like, there can no current flow back through the feedback resistor RF... to make V- equal to V+ by changing the output voltage of the opamp.
What is voltage between pin 2 of Hall sensor and output of 741? That voltage willl cause current of V/(R2 + RF) to flow, and that current must come out of hall sensor pin2.

Should I add a resistor from the non-inverting output to virtual ground? Maybe I try that later on...
you could buffer both inputs to your difference amp with followers. see "instrumentation amp" here..
http://www.electronics-tutorials.ws/opamp/opamp_5.html

opamp21.gif


Your buffers neednt have gain, you could leave out R1.
 
  • #22
43
3
Thanks a lot for the infos, Jim!

Sorry for the late answer, was sidetracked from that test project for a bit, but I'll eventually come back to it. I need to learn more about OpAmps in general to really understand what's happening.

For some reason the circuit posted a while ago somehow worked, but I still have no clear plan why. - I might do another test on the bread board soon, adding a resistor to ground, from the non-inverting input of the 741 to (virtual) ground again, like in the conventional way of setting up a differential amplifier (Rg). To see how the resulting output changes...

300px-Op-Amp_Differential_Amplifier.svg.png


@Instrumentation Amplifier:
Adding two more OpAmps, or a special more expensive IC with all the circuitry inside, for that simple sensor would be overkill I think. But to learn more about input buffers and more precise measurement, I'm going to try it as soon as I come back to it...

Currently learing about transistors, logic gates, flip flops... More low level things. - If I eventually get how buffers, current mirrors, current sources, totem pole push pull / open collector etc. circuits really work, things may hopefully become more obvious. Might be trying to make a simple opamp with transistors/discrete components only soon (and come back here with lots of questions) ;)
 
Last edited:
  • #23
jim hardy
Science Advisor
Gold Member
2019 Award
Dearly Missed
9,839
4,868
Adding two more OpAmps, or a special more expensive IC with all the circuitry inside, for that simple sensor would be overkill I think.
It looks fearsome at first.
But it's easier than it looks if you use a "quad" opamp
which is four opamps in one package.
I personally like the LM324 because it is wildly popular so available everywhere, and cheap.
Further it will work from a single supply.
Its datasheet used to have a great selection of application circuits which TI removed for some reason.
Here's the old one that still has them, make yourself a hardcopy of this treasure.
http://www.solarbotics.net/library/datasheets/LM124.pdf

This page points to a LOT of good information for analog opamps,
http://my.ece.ucsb.edu/York/Bobsclass/2C/Tutorials/application_notes.htm
see the first three in particular

good luck in your studies.

old jim
 

Related Threads on Voltage Shifting for OpAmp

  • Last Post
Replies
12
Views
19K
  • Last Post
2
Replies
31
Views
2K
  • Last Post
2
Replies
38
Views
2K
  • Last Post
Replies
18
Views
5K
Replies
2
Views
30K
Replies
5
Views
2K
Replies
2
Views
2K
Replies
1
Views
2K
  • Last Post
Replies
12
Views
2K
  • Last Post
Replies
15
Views
2K
Top