WiFi_Kit_series icon indicating copy to clipboard operation
WiFi_Kit_series copied to clipboard

How to retrieve battery charge level

Open ratcashdev opened this issue 6 years ago • 8 comments

Sicne this board has a li-pol charger, i was wondering, if it's possible to retrieve the charge status (charging/not charging) and also, how to retrieve the current battery percentage/level using Arduino?

ratcashdev avatar May 17 '18 10:05 ratcashdev

Same question

Netoperz avatar May 30 '18 13:05 Netoperz

can you place a voltage partitor on BAT + and route to pin A0 ?

antoniosap avatar Jun 29 '18 05:06 antoniosap

Yes, that would be possible. I was just wondering, whether there's something out of the box, since the charging regulator must measure the voltage.

ratcashdev avatar Jul 03 '18 17:07 ratcashdev

Was this ever solved? the last answer doesn't seem to be a real answer

dalefrancis88 avatar Aug 29 '18 20:08 dalefrancis88

You can tie in a wire to the battery positive leg and run it thru a voltage divider to an analog input. That's what I have been doing. Some other mfg (Adafruit, Wemos) put an internal V-divider on the board for reading it in the sketch. The esp32 Lora kit Version2 board mentions some battery monitoring but the documentation is poor and theres no schematic for V2 so cant figure out if its real or not.

kampto avatar Nov 05 '18 23:11 kampto

Maybe this might help: https://github.com/3KUdelta/heltec_wifi_kit_32_batt_monitor

3KUdelta avatar Mar 03 '19 10:03 3KUdelta

@3KUdelta thank for this link! from your code

 if (val>=320){
    val=320; // 3.7v 500 mAh Batt - estimated max at 320, cut at 320
    }    
                       
  val = (val-100)/2.2;  // calculate percentage  

Where does the 2.2 come from? Basically how should this be adjusted for a 2000 or 2600 mah?

gavan1 avatar Dec 03 '21 02:12 gavan1

It seems that I normalized it to 220 (320 when full - 100 = 220) /2.2 equals precentage. Don't ask me why I did it. It is a long time ago ;-) The mAh has nothing to do with this - just see what value you get if you battery is fully charged, this is then your max val.

3KUdelta avatar Dec 03 '21 18:12 3KUdelta