Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Voltage Shifting for OpAmp

Tags:
  1. Jan 7, 2015 #1
    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: Jan 7, 2015
  2. jcsd
  3. Jan 7, 2015 #2

    berkeman

    User Avatar

    Staff: Mentor

    Can you post your circuit schematic so far? There are several ways to do this...
     
  4. Jan 7, 2015 #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: Jan 7, 2015
  5. Jan 7, 2015 #4

    davenn

    User Avatar
    Science Advisor
    Gold Member

    you have given no info on the Hall sensor
    what is its part # ?

    Dave
     
  6. Jan 7, 2015 #5
    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: Jan 7, 2015
  7. Jan 7, 2015 #6

    davenn

    User Avatar
    Science Advisor
    Gold Member

    so if you have no info on it, how do you know if its connected up correctly ?
    there in may lie all your problems :)
     
  8. Jan 7, 2015 #7
    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: Jan 8, 2015
  9. Jan 8, 2015 #8

    davenn

    User Avatar
    Science Advisor
    Gold Member


    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
     
  10. Jan 8, 2015 #9
    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: Jan 8, 2015
  11. Jan 8, 2015 #10

    berkeman

    User Avatar

    Staff: Mentor

    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. :-)
     
  12. Jan 8, 2015 #11

    berkeman

    User Avatar

    Staff: Mentor

    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?
     
  13. Jan 9, 2015 #12
    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...)


    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..


    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. Jan 9, 2015 #13

    jim hardy

    User Avatar
    Science Advisor
    Gold Member
    2016 Award

  15. Jan 9, 2015 #14

    berkeman

    User Avatar

    Staff: Mentor

    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...
     
  16. Jan 9, 2015 #15

    berkeman

    User Avatar

    Staff: Mentor

    @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...
     
  17. Jan 9, 2015 #16

    berkeman

    User Avatar

    Staff: Mentor

  18. Jan 9, 2015 #17

    berkeman

    User Avatar

    Staff: Mentor

  19. Jan 10, 2015 #18
    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..


    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...)?


    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...


    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


    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: Jan 10, 2015
  20. Jan 10, 2015 #19

    jim hardy

    User Avatar
    Science Advisor
    Gold Member
    2016 Award

    i dont know what that means. Offset?

    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.
     
  21. Jan 10, 2015 #20
    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?

    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...
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook