Shop OBEX P1 Docs P2 Docs Learn Events
Propeller to measure voltage — Parallax Forums

Propeller to measure voltage

xanaduxanadu Posts: 3,347
edited 2012-04-01 10:17 in Propeller 1
I have a robot that I'd like to be able to monitor the 12v battery voltage on. The motor controller has all this built in, but I want redundancy built into my telemetry.

I have a couple pins left on the Prop, is there an analog circuit I can build to monitor the battery? It could even be as simple as a High/Low indicator with .5v accuracy.

Comments

  • kwinnkwinn Posts: 8,697
    edited 2012-03-31 17:02
    You could use a comparator to indicate good/bad, a dual comparator for good/marginal/bad, or use 2 pins as a sigma/delta adc to get an actual voltage reading.
  • LeonLeon Posts: 7,620
    edited 2012-04-01 03:05
    Or, interface an I2C ADC.
  • rwgast_logicdesignrwgast_logicdesign Posts: 1,464
    edited 2012-04-01 03:21
    funny i just found this blog yesterday...
    http://embeddederic.blogspot.com/ The 3rd and 2nd
    post are about building a battery monitor
    based on.... Ardunio yuck. Amyways i know
    its not analog and maybe a bit overkill, but
    maybe itll inspire you. if you go this route
    you could just build a quick atmel dev board
    to program the chip and then add the chip to your
    propboars and communicate via i2c which would save
    your prop pins.... let me know if this was helpfull
    or if its to much.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-01 07:45
    You could easily do this with a few passives to make sigma-delta ADC. See AN008, the section on extended voltage ranges:

    -Phil
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2012-04-01 08:06
    Hi xanadu;

    By far the simplest AtoD is this RC circuit.
    PropBatMon.png


    1. Set the Pin to output a LOW which discharges the capacitor to near 0 volts.
    2. Reset a counter variable.
    3. Set the Pin to input which allows the capacitor to start charging up.
    4. Watch and count the variable until the Pin reads HI
    5. The value in the variable represents the measured input voltage.

    OK, this is not linear but using a small look up table you can convert the value into battery voltage.

    Keep the resister fairly large to protect the Prop pin from damage due to over voltage.
    Almost any small capacitor will do. The smaller the value the quicker the conversion time.

    This is a fairly low resolution AtoD converter but quite adequate for battery voltage monitoring.

    Duane J
    114 x 114 - 2K
  • xanaduxanadu Posts: 3,347
    edited 2012-04-01 10:17
    Thanks guys, it looks like I'm going to try the Sigma-delta Analog to Digital Conversion (great PDF btw!). I really couldn't see spending $20 on a couple resistors in a pre-made solution, so as always you saved me time and money ;)

    I'll probably also build that comparator and the RC circuit since I have the parts. Should be a good learning experience. Now all I need to do is stop the phone from ringing hehehe.
Sign In or Register to comment.