read battery value

Posted on
  • Hi all

    As part of my car tracker project I'm using a 6000mAh lipo via the jst connector. I have a rough projected lifetime before requiring a recharge but I think it would be more useful to send the battery voltage as part of my GPS coordinate SMS.

    Is there any way I can read the voltage of the battery via the jst?

  • It will not help to measure the battery voltage, it is too steady and does not indicate how much juice is left. you need to measure the discharge current and integrate. Search for "Coulomb counter". There are ICs that are made for this purpose. Another search term is "battery fuel gauge" and "battery state-of-charge". I think there is a breakout board for LTC4150, for example.

  • The voltage would be good enough if you're just after a bit of warning that the battery is almost out. When the battery is getting low and the voltage starts to drop faster, you can have a rough idea of how much time you have left.

  • If you did want to measure the voltage, you'd need to divide it down with a potential divider (but then it seems for an accurate reading you also need a capacitor on the analog input).

    So for example:

    • A capacitor (0.1uF should do it) between GND and A0
    • A 100k resistor between GND and A0
    • A 100k resistor between Battery volts (or even the 5V/vBat/VCC pin) and A0

    Then analogRead(A0)*3.3*2 is your voltage.

    Obviously you want to use high-value resistors for the potential divider, as they'll be constantly drawing power.

  • Obviously you want to use high-value resistors for the potential divider, as they'll be constantly drawing power.

    Or: you 'sacrifice' a pin to drive the devider (and do some calibration) to get the fourmula right... A calibration over a range may turn out that the formula is not linear anymore.

    Using an extra pin - and may be an extra FET and chose to put different loads - 'practically no' load with no pin sacrificed and load over the sacrificed pin (and extra FET) - will give you more points for figuring out how well you battery still is. On the other hand, doing the measuring too often with such a setup, will add to the drain of the battery.

    There is just no free lunch... that's why these specialized 'fancy' devices exist... such as accurate state of charge measurement... in this case for Li-Ion batteries.

  • You could always poll the GSM board using the AT command for battery voltage.

    at+cbc will return current state of battery charge.

  • Neat! ...networking between the devices... not just for data/control, but also house keeping / internal things. #measuring #voltage

  • Thanks! I will check that command over as see if it returns what I need.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

read battery value

Posted by Avatar for Hardware_Hacks @Hardware_Hacks