Shop OBEX P1 Docs P2 Docs Learn Events
Measuring negative voltage (on variable DC power supply) — Parallax Forums

Measuring negative voltage (on variable DC power supply)

Robot FreakRobot Freak Posts: 168
edited 2009-05-08 17:06 in Propeller 1
Hello all,

I'm building a variable DC power supply, with digital voltage and current measurement.
I'd like to use the Propeller for the measurements, so I can display it on a LCD display.

The propeller is powered by it's own supply, so that it doesn't produce noise on the DC outputs.
The power supply has a ground, 1.2 till 12V and -1.2 till -12V outputs.

Measuring the positive output is easy, using an appropriate voltage divider to scale the voltage down to a 3.3V max.
With interconnected grounds, an ADC can then measure the voltage on the positive DC output.

Main problem: measuring voltage on the negative DC output.
The negative DC output can't be connected to the ADC because that only works for 0 till 3.3V.
What do I need to read the negative voltage?

Thanks in advance,
Robot Freak

Post Edited (Robot Freak) : 5/8/2009 2:31:08 PM GMT

Comments

  • RaymanRayman Posts: 14,793
    edited 2009-05-08 14:05
    It's fairly simple to use an opamp to invert the voltage.

    Also, I've used the MAX1270 because it can accept negative voltages. But, the MAX1270 has a fairly low input impedance, so I had to use an opamp buffer anyway... But, if you're measuring supply voltage, you don't have to worry abou the impedance too much. But, the price of the MAX1270 is pretty hefty!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • Robot FreakRobot Freak Posts: 168
    edited 2009-05-08 14:11
    Thanks Rayman,

    An OpAmp seems the best solution, but it needs a positive and negative voltage supply to function.
    The only negative supply is from the power supply itself, and that one is variable.

    Kind regards,
    Robot Freak
  • hairymnstrhairymnstr Posts: 107
    edited 2009-05-08 14:13
    For this application any old opamp should do, the good old 741 is a good (and cheap) choice.

    Remember that you need to put a potential divider across the supply before feeding it into an inverting op-amp because the opamp won't get closer than about a volt to either rail, so it can't output more than about 11V if you run it off a +/-12v supply. This shouldn't be much of a problem because you need to scale the output anyway.


    Edit:

    What is the arrangement for the DC supply? Are you using variable regulators running off unregulated supply?
  • Robot FreakRobot Freak Posts: 168
    edited 2009-05-08 14:20
    Hello hairymnstr,

    See the attachment for my simulation schematic.

    Kind regards,
    Robot Freak

    Edit: the transformer has been replaced by two function generators.
    The transformer has two times stabilised 12V AC, RMS.

    Post Edited (Robot Freak) : 5/8/2009 2:28:24 PM GMT
    735 x 437 - 38K
  • RaymanRayman Posts: 14,793
    edited 2009-05-08 14:40
    I think you can make a summer circuit with a single supply opamp that will do the job for you...

    Here's how opamp summers work:

    http://www.allaboutcircuits.com/vol_3/chpt_8/8.html

    I think if you sum a constant 3.3 V signal with a signal that can very from 0 to -3.3V, you can get an output that varies from 0 to 3.3 V...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    Post Edited (Rayman) : 5/8/2009 2:45:37 PM GMT
  • hairymnstrhairymnstr Posts: 107
    edited 2009-05-08 14:45
    Okay, looking at that you could run the opamp off the unregulated DC rails (before the LM317). You need to watch out for what the actual voltage is here, smoothed DC is more than the RMS voltage you put in, but the 741 for example can run off +/-22V.

    If you feed the 0V rail in to the non-inverting input of the op-amp the measurement will be relative to this and not the unregulated supply rails so it doesn't matter that they aren't a specific voltage.

    You could always add an LM7812/LM7912 regulator pair as well to give you regulated +/-12V for running the op-amp if you wanted.
  • Robot FreakRobot Freak Posts: 168
    edited 2009-05-08 15:07
    Thanks hairymnstr!

    I didn't think about using the unregulated power supply, but it seems to work.
    Will it be stable enough without additional regulators?
    The OpAmp will never output more then 3.3V so I think it will...

    Kind regards,
    Robot Freak
    532 x 368 - 23K
  • hairymnstrhairymnstr Posts: 107
    edited 2009-05-08 15:15
    Cool, looks good.

    I'd guess the un-regulated supply will be fine, you don't normally find regulators in audio amplifiers, the op-amps run straight off the smoothed DC.
  • kwinnkwinn Posts: 8,697
    edited 2009-05-08 15:17
    You could always use a voltage divider connected to the prop 3.3V to shift the 0 to -12V level so it is +3.3 to 0V
  • Robot FreakRobot Freak Posts: 168
    edited 2009-05-08 15:27
    hairymnstr said...
    Cool, looks good.

    I'd guess the un-regulated supply will be fine, you don't normally find regulators in audio amplifiers, the op-amps run straight off the smoothed DC.
    Ok, thanks for your help!

    Post Edited (Robot Freak) : 5/8/2009 3:50:34 PM GMT
  • kkibbekkibbe Posts: 11
    edited 2009-05-08 15:32
    Kwinn has the idea. Voltage dividers to bring the -12V to 0V to a range of -3.3V to 0V. Then connect the ADC input between two 10K resistors. The other side of one of the 10K resistors goes to the +3.3V supply. The other end of the other 10K resistor goes to the output of your voltage divider. Assuming you have high precision resistors and a nice steady +3.3V supply you will get zero volts at the input of the ADC. With some math you will be able to convert that to what you want, in this case -12V. As the input voltage to the voltage divider goes from -12V to 0V the input to the ADC will go from 0V to 3.3V.

    No op amps required, just a bit of math.

    Kevin
  • Robot FreakRobot Freak Posts: 168
    edited 2009-05-08 15:51
    Hello kkibble,

    Thanks for explaining, now I understand what Kwinn meant.

    Kind regards,
    Robot Freak
  • kwinnkwinn Posts: 8,697
    edited 2009-05-08 15:53
    Robot Freak, trust me, it can work and no negative resistance resistors are required. What happens is that when the input from the - power supply is at 0 volts you have 3.3 volts out from the voltage divider. As the negative voltage increases in value (lets say to -6V) the output from the voltage divider decreases. If we could get the exact resistor values required for the divider you could have 3.3V at 0V in, 1.515V at -6V in, and 0V at -12V in. Unfortunately standard resistors only come in certain values so we have to make do with what we can get and do a bit of math to correct for it.
  • hairymnstrhairymnstr Posts: 107
    edited 2009-05-08 15:57
    Neat solution, will have to remember that. Of course if you don't want to do maths, you could use a trimmer maybe?

    Edit: Of course you'll still have to do the maths to invert and apply a scaling factor to make the number between 0 and -12 so you may be just as well to use a fixed resistor without the instability of a trimmer.

    Post Edited (hairymnstr) : 5/8/2009 4:04:06 PM GMT
  • Robot FreakRobot Freak Posts: 168
    edited 2009-05-08 16:02
    Yes, a trimmer is a good idea.
  • RaymanRayman Posts: 14,793
    edited 2009-05-08 17:06
    If you want to do a summer without the opamp (I think this is the same as the voltage divider idea)(on second thought, I think this is like using an opamp...),

    here's an app that can help:

    http://www.pulsedpower.net/Applets/Electronics/SigmaDeltaADC/SigmaDeltab.html

    Just change R2 to 500k and R3 to 100k and you get a nice input range... (R4 isn't needed).

    You don't have to use the Prop as your ADC for this to work.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    Post Edited (Rayman) : 5/8/2009 6:17:43 PM GMT
Sign In or Register to comment.