Battery charge status/power remaining

riphill

  • Newbie
  • *
    • Posts: 4
    • View Profile
Apologies if this has been asked before, but is there any way to check the charge status (ie approximate charge level) and estimate how long the battery would last at the current rate of discharge in use?


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
I have a function we use to grab VCC on the AVR platform-
Code: [Select]
int getVCClevel(){
  //http://forum.arduino.cc/index.php?topic=133907.0
  const long InternalReferenceVoltage = 1100L;
  ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
  delay(1);
  ADCSRA |= _BV( ADSC );
  while( ( (ADCSRA & (1<<ADSC)) != 0 ) );
  int result = (((InternalReferenceVoltage * 1024L) / ADC) + 5L) / 10L;
  return result;//this should be in hundredths of a volt
}

You can use this and a general lithium ion discharge curve to guess approximate charge level.

Thanks,
Ben


riphill

  • Newbie
  • *
    • Posts: 4
    • View Profile
Thanks,  I'll give that a go, should give an indication of how charged the battery is at least I hope, I never know how long to leave it on charge.  If I output to a some stats I guess I could get a picture of the discharge rate and maybe graph a curve.


amb9800

  • Newbie
  • *
    • Posts: 1
    • View Profile
I have a function we use to grab VCC on the AVR platform-
Code: [Select]
int getVCClevel(){
  //http://forum.arduino.cc/index.php?topic=133907.0
  const long InternalReferenceVoltage = 1100L;
  ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
  delay(1);
  ADCSRA |= _BV( ADSC );
  while( ( (ADCSRA & (1<<ADSC)) != 0 ) );
  int result = (((InternalReferenceVoltage * 1024L) / ADC) + 5L) / 10L;
  return result;//this should be in hundredths of a volt
}

You can use this and a general lithium ion discharge curve to guess approximate charge level.

Thanks,
Ben
Does the TinyScreen+ (ARM platform) have a similar function?


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
It has a similar function, but the processor is running from a 3.3V regulator, so checking VCC isn't very useful except to check for a low battery <3.3V.

This is something we overlooked and should be able to fit on the next revision.


tastewar

  • Full Member
  • ***
    • Posts: 26
    • View Profile
Ben- when you say "fit on the next revision" are you referring to the hardware? Or next library revision... (hoping the latter, but guessing the former...)


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
Yes, unfortunately hardware, it will probably just be a simple resistor voltage divider. There isn't a good software workaround unless you can tell the software when it has a full charge.

Keep in mind that the current hardware with the <3.3V low battery warning, which means maybe 5% capacity, can last a while in standby mode, depending on what else you have connected.


EMH333

  • Newbie
  • *
    • Posts: 2
    • View Profile
Yes, unfortunately hardware, it will probably just be a simple resistor voltage divider. There isn't a good software workaround unless you can tell the software when it has a full charge.

Keep in mind that the current hardware with the <3.3V low battery warning, which means maybe 5% capacity, can last a while in standby mode, depending on what else you have connected.

Excuse me for asking if this isn't appropriate. About how long till the new hardware revision? I want to build a smart watch soon but depending on the time frame would be willing to wait if it means I get to know the battery charge level.
Thanks for your help!


 

SMF spam blocked by CleanTalk