Shop OBEX P1 Docs P2 Docs Learn Events
Some help required. — Parallax Forums

Some help required.

jmbertoncelli@USAjmbertoncelli@USA Posts: 48
edited 2009-01-11 16:23 in Propeller 1
Hello, I am using the Prop for a robotics platform and I would like to feedback the current battery voltage (leftover) to another computer but I do not have any idea on how to mesure the battery voltage using the prop.· if somebody would like to put me on the right direction?· Thanks a lot.

jm.

Comments

  • LeonLeon Posts: 7,620
    edited 2009-01-10 23:10
    Use an ADC like the 12-bit Microchip MCP3201. It's got an SPI interface so it's easy to interface it to the Propeller.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • jmbertoncelli@USAjmbertoncelli@USA Posts: 48
    edited 2009-01-10 23:15
    I am not very experimented from electronic point of view and I have a question about ADC,· I think that an ADC need some kind of reference voltage to work then how could I provide a reference voltage if the robotic platform is using the same battery source that I want to measure?

    jm
  • grasshoppergrasshopper Posts: 438
    edited 2009-01-10 23:19
    Yea that would work. However if you want to be real accurate a precision voltage regulator would do the trick. Make sure that the battery voltage is not greater than the Voltage max on the ADC.

    **Edited

    You could probably get away with using some diodes to measure the voltage. Wire them up as a switch and limit the current into the propeller.

    ***Edited again

    Just thought of a great simple idea:

    Using a Varicap diode one could measure battery voltage if configured as a RC Circuit. I think there already is a RC measuring object. Since the Varicap diodes capacitance changes with respect to voltage then this could work. This is a theory however, but seems possible.


    Post Edited (grasshopper) : 1/10/2009 11:30:44 PM GMT
  • LeonLeon Posts: 7,620
    edited 2009-01-10 23:38
    The capacitance is very small with most diodes, that idea wouldn't work. Even with "hyper-abrupt" diodes, the change is only 100 pF or so over 5V, and they are very expensive.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • grasshoppergrasshopper Posts: 438
    edited 2009-01-10 23:40
    Eh it was a thought. I was about to look this all up. Thanks leon for saving me some time [noparse]:)[/noparse]
  • jmbertoncelli@USAjmbertoncelli@USA Posts: 48
    edited 2009-01-10 23:52
    The voltage that I need to mesure is in a range of 7.5V to 14.5V.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2009-01-11 00:06
    Use precision resistors to divide the voltage into a measurable range then use an ADC to measure it.

    Many ADCs have internal references that use Vdd to generate it, since you have a regulator putting out a stable voltage everything will work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
  • kwinnkwinn Posts: 8,697
    edited 2009-01-11 00:08
    Sounds like a job for the 2 pin sigma delta adc circuit.
  • Paul RowntreePaul Rowntree Posts: 49
    edited 2009-01-11 00:31
    @jm : you are right to be concerned about using a reference derived from the same battery that you want to characterize ... The trick is to use a stabilized reference for the ADC, which can be a seaparate reference chip output or just use the 3.3 V that is driving the Prop. It will be kept at 3.3 V even if the battery source falls significantly, so then the divided-down battery voltage will be easily measurablke relative to this stabilized 3.3 V.

    Cheers!
    Paul Rowntree
  • jmbertoncelli@USAjmbertoncelli@USA Posts: 48
    edited 2009-01-11 01:04
    Thanks! I shall give it a try tomorrow. Have a great evening all!
  • AribaAriba Posts: 2,690
    edited 2009-01-11 16:23
    It should be possible to use a simple R-C ADC to measure the Battery voltage.
    Attached is a schematic, and here is a Spin code: (only the ADC methode, and not tested)
    CON
      batt = 7               'I/O Pin for Battery ADC
    
    PUB getBatt : time
      dira[noparse][[/noparse]batt] := 1        'discharge C
      outa[noparse][[/noparse]batt] := 0
      time := 0
      dira[noparse][[/noparse]batt] := 0        'Pin to input
      repeat
        time++               'measure time
      until ina[noparse][[/noparse]batt] > 0    'until C > 1.4V threshold
      dira[noparse][[/noparse]batt] := 1
    
    



    You get not a value in Volt, but a value which is higher for low Battery voltage, and lower for higher Battery voltage.
    (because the C is charged faster if the current is higher, and the current is higher if the battery voltage is higher).

    Andy
    250 x 239 - 1K
Sign In or Register to comment.