Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
bt0618
PostPosted: Feb 23, 2012 - 05:05 AM
Rookie


Joined: Feb 02, 2012
Posts: 25


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
 
 View user's profile Send private message  
Reply with quote Back to top
alexru
PostPosted: Feb 23, 2012 - 08:55 AM
Raving lunatic


Joined: Apr 15, 2009
Posts: 6440
Location: San Jose, CA

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.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
dak664
PostPosted: Feb 23, 2012 - 01:08 PM
Posting Freak


Joined: Jun 15, 2008
Posts: 1972
Location: North Carolina USA

BATMON has a 75 millivolt resolution:
Code:
/* 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
 
 View user's profile Send private message  
Reply with quote Back to top
bt0618
PostPosted: Feb 27, 2012 - 01:32 AM
Rookie


Joined: Feb 02, 2012
Posts: 25


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!
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits