Shop OBEX P1 Docs P2 Docs Learn Events
Battery level in spin — Parallax Forums

Battery level in spin

p00ndawgp00ndawg Posts: 70
edited 2010-06-16 03:11 in Propeller 1
possible on the msr1?

I got a 12v battery connected to two hb-25's, and a 9v rc battery connected to the msr1.

Anyway I could check the level of either?

Comments

  • Dr_AculaDr_Acula Posts: 5,484
    edited 2010-06-16 03:11
    You can do this with a voltage divider. Two resistors in series. The total resistance needs to be roughly 10k, but 1k to 100k will work. Too low and you flatten the battery. Too high and the internal resistance of the sensing circuit upsets the values.

    Max volts on a 12V battery might be 14V. It would be very unlikely to go above 15V. So if you divide by five, 15V becomes 3V which is within specs for a propeller.

    You can use 1% resistors for greater accuracy. Or measure the actual volts for two resistors and calibrate with that. Eg you could use 6.8k in series with 1.8k. That gives a ratio of 0.21 (1.8/1.8+6.8) which is pretty close. High resistor to the 12V. Measure it first before connecting a propeller or any other chip. Then you need to work out the maths - division of 0.21 and a 3.3V supply - you can have some real fun with the maths in software.

    The above only works best if you have a regulated supply to the sensing chip, but that would be true for the propeller.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/propeller
Sign In or Register to comment.