[BitCloud] Checking External Battery Level

4 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello all,

I am using 2-AA batteries to power up my STK600-ATMEGA128RFA1 node and I was wondering if there was a way to check the remaining battery life.

I am using AVR Studios 4's platform and BitCloud's library, more specifically, the WSNDemo.

My components is a STK600-ATMEGA128RFA1 and a STK600.

Thanks in advance

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is no standard way to do this. You might connect your power line to an ADC input (using divider and, probably, some kind of switch to not drain more current than necessary) and measure battery voltage and predict battery life based on this measurement.

The opinions and views expressed by me on this forum are my own and do not represent my employer or anyone else that I'm affiliated with.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

BATMON has a 75 millivolt resolution:

/* Bandgap can't be measured against supply voltage in this chip. */
/* Use BATMON register instead */
  BATMON = 16; //give BATMON time to stabilize at highest range and lowest voltage
...
  for ( i=16; i<31; i++) {
    BATMON = i;
    if ((BATMON&(1<<BATMON_OK))==0) break;
  }
  bat=2550-75*16-75+75*i;  //-75 to take the floor of the 75 mv transition window
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your replies!

I have decided to follow alexru's method.

My group looked up the voltage of a new battery and compared it to the current voltage from our used battery (voltage divider being used)

Now we just have to edit the code a bit to take into consideration the voltage of a dead battery so that we can create an equation that shows how close a battery is to dying.

Once again, thank you for your replies!