Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,811,541 Members 54,455 Now Online
XDA Developers Android and Mobile Development Forum

[APP] Battery Diviner (May 1, 2011 - V1.06)

Tip us?
 
Izkata
Old
(Last edited by Izkata; 1st May 2011 at 11:56 PM.)
#1  
Izkata's Avatar
Senior Member - OP
Thanks Meter 14
Posts: 121
Join Date: Aug 2010
Location: Chicago
Default [APP] Battery Diviner (May 1, 2011 - V1.06)

For update information, see bottom of post

Yes, another Battery Time Left-style app. Originally intended to fill in some of the gaps and problems of the current ones out there, it has since expanded in scope. Here are the main features:

General Info
The Battery Diviner learns your patterns over time to generate extremely accurate battery usage predictions. For example, little to no usage while you're asleep, or large usage when you play games during that train ride every Friday...
  • When first installed, it's using a "Level 0" prediction - a simple charge-divided-by-time, so there's something to display
  • After a day has passed, it switches to "Level 1" prediction, only using Level 0 as a fallback if there's missing data. Level 1 is more accurate than Level 0
  • After a week has passed, it switches to "Level 2" prediction, which includes the day of the week in the algorithm. It is the most accurate, and Levels 1 and 0 are only used as fallbacks at this point
There are no profiles/etc to download, and it should work with any Android 1.6 or greater device. Because it examines usage patterns, it should also still work with over/underclocked phones.

It also never stops learning. Once Level 1 and Level 2 reach their limits (7 days and 4 weeks, respectively), they start overwriting their oldest data. That way, it'll adjust over time, in case your schedule changes.

For example, Level 1 is limited to 1 week. Beyond that, it starts to overwrite the data from exactly 1 week previous (that is, the data from 168 hours previously). So after 1 week more, Level 1 is almost completely adjusted to a new schedule. "Almost", because the gaps where the phone is charging or off don't get recorded, and so, not overwritten.

Main Screen

The Main Screen is a summary of information, including:
  • Current percentage
  • From the current percent, how long until the battery is empty, and when that is
  • From the current percent, how long until it is charged, and when that is (AC and USB separate, since they charge at different rates)
The charging times include a "to XX%" column. This means it's only predicting up until it's charged to that percent, because data to go higher is missing. It does this instead of extrapolating, because my own phone slows down above about 93%, and usually reports "full" at 97% or 98% - things that can't be predicted if they weren't experienced before.

History Graph

The history graph shows your usage over the past several days (up to a week), and includes a prediction section to show you exactly what it thinks you're going to be doing. So if the time remaining seems unusually high or low, the graph will show you why the prediction says what it says, and gives you the final decision.

Blue is history, what your battery was actually at. Red is a Level 0 prediction, Yellow is a Level 1 prediction, Green is a Level 2 prediction.
  • To scroll, drag left/right across the graph
  • To zoom, draw left/right across the Zoom section. To the left zooms in.
  • To re-center on "Now", double-tap on the graph. It also re-zooms to 24 hours, but zooming does not affect the offset at all. Exiting and re-entering the graph does the same thing.

Usage Graph

The Usage graph shows you how much your battery is expected to drop by over the course of the week. The drop percentage is per 15 minutes. The graph display has been smoothed, to make more sense visually, but it means that manually doing a prediction using it (as opposed to simply looking at the History graph) might not have the same accuracy.

Red indicates Level 0 data, Yellow for Level 1, and Green for Level 2.

Controls are the same as the History graph.

Why each 15 minutes instead of each hour? A few things:
  • It comes from the precision of the predictions (Notice how discharging time left always ends with 0, 15, 30, or 45 minutes?)
  • It's less than an hour to give more precise information (not only in creating the prediction from the data, but it also affects storing the data)
  • I was considering using 5 minutes, but that part of the data would end up about 3 times as large. 15 seemed like a good compromise

Widget

There are two sizes currently available: 1x1 and 2x1, shown above in the first image. The 1x1 has two styles, shown in the second image.

The May 1 (V1.06) updated has added the options to change what the text is on the widget. Shown in the second image, the two dark widgets have been customized - the one on the left always shows USB charge time, and the one on the right always shows discharge time.


Widget Configuration

Sample of what the new Widget Configuration screen looks like.

The preview defaults to the current percent, but you can drag that slider underneath it to see what the widget would look like at any given percent.

Settings

The displays are very customizable, by way of the Setting screen, allowing you to:
  • Completely alter the display of dates and times
  • Change when the widget switches between the different colors (default numbers are 40 and 20; see above)
  • Turn start-at-boot on and off
  • Change colors used in the graphs and the widget
  • Alter settings for the learning algorithms (More coming soon)

Notification Bar
  • Icon shows current percentage
  • The pull-down contains the same information that would be on the widget.
  • Selecting the notification opens the Main Screen
  • Settings -> Misc -> Status Bar to enable

Data can be transferred between Free and Full versions (Import/Export in the Help). Destination data gets erased in the process.

Free: http://www.appbrain.com/app/battery-...rydiviner.free

Full: http://www.appbrain.com/app/battery-...rydiviner.full


Upcoming Ideas
(But don't hold your breath. I want to do these, but some I don't yet know how, or could end up being a bad idea once testing starts)
  • Statistics screen doesn't currently exist, but here are two ideas:
    *Maximum possible battery life, by identifying the lowest usage pattern.
    *(Suggested in thread) Remaining talk time, remaining idle time, remaining music-playing time, etc... (Requires knowing when each is running, which could cause call-answering delays, or unnecessary battery drain; "might be a bad idea")
  • Alternative widgets. Two additional 1x1 designs have been chosen, there is now a 2x1, and other 2x1 designs are welcome. The pattern seems to be: Dark background, Light background, and iPhone-style. (Coming, slowly)

Misc.
Each day the data is successfully loaded, it creates a copy as a backup, to prevent complete loss of data, should it get corrupted somehow. The backup is automatically restored if there is a problem, and the user notified as to why the previous day is no longer known. This also creates an odd-looking block in the History graph.

Widgets will not work (and will even disappear from the list of widgets) if the app is on the SD Card. According to khaytsus, if instead using Apps2Ext, it will work fine.

Update: May 1, 2011, V1.06
One bugfix: On one user's configuration, Android somehow was reporting 101% battery (And yes, Android was saying the equivalent of "On a 0-100% scale, you're at 101%", so it's not that it uses a 150-scale or something). I don't know what the cause is, but if this ever happens, the Battery Diviner will now treat that new highest value as the scale. It resets any time the app closes.

New feature: Widget Configuration Screen, plus one new 1x1 widget!

The new Configuration screen allows you to change when the bar colors change, what colors, and even how many to use (minimum 2, but they can be set to the same color). There's also a whole bunch of options for the text that gets displayed on the widget. Text options are:
*Static text (once selected, it asks what you want to display)
*Current Percent (The default line 1)
*Time Remaining (Cur) (The default line 2)
*End Time (Cur) (The default line 3)

For Time Remaining and End Time, in addition to "Cur" for "Current", there's also "Discharge", "USB", and "AC", if you want to force it to always display those times instead of whatever the phone is currently doing.
The Following 5 Users Say Thank You to Izkata For This Useful Post: [ Click to Expand ]
 
dsMA
Old
#2  
Senior Member
Thanks Meter 6
Posts: 427
Join Date: Jun 2010
Location: Sacramento
Sounds very cool.

Some of these battery predictor apps that I have tried have asked for my phone's type/model and as such I am assuming that what it is doing is loading a profile specific to the stock specs for what ever phone is picked, but it sounds like this is not the case with your app? I take it instead of relying on predefined profile your app looks at actual battery consumption and thus would take into account users who have their phones over and underclocked?

You mention a free and a full version of the app, what is the difference between these two?

Motalen's battery predictor app had a cool feature in that when you opened the app it would give you estimates on how much time is remaining to do certain activities (making a phone call, watching a video, listening to music, web browsing, etc) have you any plans on implementing something like this?

Finally I just want to note that I am not sure if I am a fan of the widget's design.
 
Izkata
Old
#3  
Izkata's Avatar
Senior Member - OP
Thanks Meter 14
Posts: 121
Join Date: Aug 2010
Location: Chicago
Quote:
Originally Posted by dsMA View Post
Sounds very cool.
Thanks!

Quote:
Originally Posted by dsMA View Post
Some of these battery predictor apps that I have tried have asked for my phone's type/model and as such I am assuming that what it is doing is loading a profile specific to the stock specs for what ever phone is picked, but it sounds like this is not the case with your app? I take it instead of relying on predefined profile your app looks at actual battery consumption and thus would take into account users who have their phones over and underclocked?
There are no downloaded/stored profiles for models of phone, so it should work on any Android device. Every time the battery drops (or charges) a percent, the Android OS notifies my app, which takes note of the time and day. It learns from those patterns. This also means that I'm not polling every X minutes, so there is no artificial draining of the battery.

The only assumptions made are that 100% means "full" and 0% means "empty". (And full may not even be assumed, I'd have to check through the code again)

Quote:
Originally Posted by dsMA View Post
You mention a free and a full version of the app, what is the difference between these two?
I didn't mention it? Ack. I'll edit the first post with more/better information on that, but for now: the Settings screen is limited to "Autostart: Yes/No" in the Free version, while the Full version has a lot more customizations.

In the next version or two, the Free version will allow all settings to be seen, but not changed.

Quote:
Originally Posted by dsMA View Post
Motalen's battery predictor app had a cool feature in that when you opened the app it would give you estimates on how much time is remaining to do certain activities (making a phone call, watching a video, listening to music, web browsing, etc) have you any plans on implementing something like this?
I was planning on making a Statistics screen, with things such as, the maximum your battery can last, by identifying the time you use it the least, and the minimum it can last, by identifying when it's used the most, and so on. I'll keep this idea in mind, as another addition to the Statistics screen, but would have to think about how to do it well.

Quote:
Originally Posted by dsMA View Post
Finally I just want to note that I am not sure if I am a fan of the widget's design.
Yeah, it was meant to be reminiscent of Star Trek, just because I'm a fan. I always intended to make a second one (that would look better on lighter backgrounds), but haven't yet thought of anything that I think would look nice. So I'm fully open to suggestions right now.

The three guidelines for the widget, in case someone wants to design one, are: The status bar (visual battery representation), the eye (what app it belongs to), and the 3 lines of text must be on it.

I've considered making those 3 lines of text fully customizable (Say, someone doesn't want the actual percent there), but again, I'd have to think about it how to implement it. (Already have a few ideas )
 
khaytsus
Old
#4  
Senior Member
Thanks Meter 1,082
Posts: 6,932
Join Date: Apr 2008
Location: Central Kentucky
http://www.appbrain.com/app/battery-...rydiviner.free

Looks pretty neat, I'm a bit of a battery discharge geek, looking at Battery Snap multiple times per day.
AT&T LG G2 - 4.4.4, AOKP
Nexus 7 Wifi 2012 - 4.4.4, AOKP (m-kernel)
Samsung Note i717 - 4.2.2, Unofficial AOKP
Try my Alternative XDA CSS Themes (including 2010!)

--
http://theblackmoor.net
http://unlimitedphoto.com
 
pinhead875
Old
#5  
Senior Member
Thanks Meter 43
Posts: 364
Join Date: Aug 2010
I've only had this app installed since yesterday afternoon, but it's very cool. I love how I can view my past battery usage, and I can't wait to see how well the predictions turn out! Great app so far!
 
Izkata
Old
#6  
Izkata's Avatar
Senior Member - OP
Thanks Meter 14
Posts: 121
Join Date: Aug 2010
Location: Chicago
Quote:
Originally Posted by pinhead875 View Post
I love how I can view my past battery usage
You just reminded me of a missing setting in the Full version. Planned since day one but never implemented, will go add before the weekend (History is limited to 7-8 days (midnight split) to save space, Full version should be able to extend/reduce it. History does not affect the learning parts of the app; that is stored separately)

V1.02 Update coming sometime soon (Friday or during weekend). A bunch of updates to the Settings screen, plus now Free users can see all the settings, their defaults, and the help for them, just not modify them.
 
khaytsus
Old
#7  
Senior Member
Thanks Meter 1,082
Posts: 6,932
Join Date: Apr 2008
Location: Central Kentucky
Not sure if this is a question or a suggestion....

Curious about the mechanism you use to learn.. Does it learn "once" then use that forever? Like for example normally at work I use it X amount, but one day was light or I was trying a new program, or installing a new ROM (ahem) and used significantly more battery than normal. Does it continue to average, or would that throw it off forever?

I gotta say, the Usage Graphs are not making any sense to me... It shows different green, red, yellow.... At first I thought it was percent of battery used or such, but it doesn't seem to be.. At least not per hour? I average 3-4%/hr with the phone pretty much idle (ie: me not playing with it) running K9 online imap, weather updating, Tasker doing stuff etc... But Diviner is showing 1%.. woah, now it's showing 3-4%, I SWEAR earlier it wasn't going any higher than 1%.. I'll keep an eye on this, maybe I'm just crazy. Nope, not crazy, I just went back into Graph Usage and it's showing 1-2% again. I wouldn't expect this to be something that'd have to stabilize that much over usage, it should know exactly what I've used since I installed it yesterday evening, right?

One question... Why are the Charging Times on the main screen "to 82%" for USB, "to 88%" for AC? Is this an estimate of what I typically (so far) have charged to for each of these?

Now, a suggestion or two.. A "Now" button for the graphs, to make it easier to find the most recent real info (vs estimated).

Make the graphs on the main page representative of the real graphs. Not updating in real time or anything, but right now they're just static icons, right?

Fun stuff, look forward to improvements.
AT&T LG G2 - 4.4.4, AOKP
Nexus 7 Wifi 2012 - 4.4.4, AOKP (m-kernel)
Samsung Note i717 - 4.2.2, Unofficial AOKP
Try my Alternative XDA CSS Themes (including 2010!)

--
http://theblackmoor.net
http://unlimitedphoto.com
 
Izkata
Old
#8  
Izkata's Avatar
Senior Member - OP
Thanks Meter 14
Posts: 121
Join Date: Aug 2010
Location: Chicago
Quote:
Originally Posted by khaytsus View Post
Not sure if this is a question or a suggestion....

Curious about the mechanism you use to learn.. Does it learn "once" then use that forever? Like for example normally at work I use it X amount, but one day was light or I was trying a new program, or installing a new ROM (ahem) and used significantly more battery than normal. Does it continue to average, or would that throw it off forever?
It will continue to average it in, to a maximum of whatever the learning length is. For example: Level 1, the day-by-day one that shows up as Yellow on the graphs, limits itself to 1 week. After that, it wraps around and starts to overwrite the oldest data.

So Level 1 limits itself to 1 week. It's almost fully adjusted to a new schedule after that 1 week, slowly changing over the week. "Almost", because the gaps where the phone is charging or off, doesn't get recorded.

Level 2 limits itself to 4 weeks. This one is (will be) changeable in the Settings, minimum of 2 weeks, no maximum. So it will also wrap around and only keep the most recent 4 (or whatever) weeks of data.

Quote:
Originally Posted by khaytsus View Post
I gotta say, the Usage Graphs are not making any sense to me... It shows different green, red, yellow.... At first I thought it was percent of battery used or such, but it doesn't seem to be.. At least not per hour? I average 3-4%/hr with the phone pretty much idle (ie: me not playing with it) running K9 online imap, weather updating, Tasker doing stuff etc... But Diviner is showing 1%.. woah, now it's showing 3-4%, I SWEAR earlier it wasn't going any higher than 1%.. I'll keep an eye on this, maybe I'm just crazy. Nope, not crazy, I just went back into Graph Usage and it's showing 1-2% again. I wouldn't expect this to be something that'd have to stabilize that much over usage, it should know exactly what I've used since I installed it yesterday evening, right?
The colors I'm sure I mentioned somewhere. Red/Yellow/Green indicates the data it has and how accurate it thinks it will be.

Otherwise, your initial guess was right, it is percent of battery used, but it's per 15 minutes, centered on the hour, and smoothed so it makes more sense to humans just perusing the graph (Yeah, sorry, not explained anywhere). Because it's smoothed, manually doing a prediction probably won't give you exactly the same eventual percent as simply looking at the other graph. But I'm not sure.

The 15-minute decision is based on a several things:
*The number is how precise discharging predictions can be. Time left is always 0, 15, 30, or 45 minutes + however many hours.
*It's lower than an hour to give more precise information. (This has to do with how the data is collected, as well as how it displays and is used)╣
*I was considering using 5 minutes, but this part of the data would be about 3 times as large.

Since per-hour is probably more intuitive, I may separate the Usage display from what's actually stored.

╣Also, please note, that this still does not mean any polling. It has to do with the math involved in data collection.

Quote:
Originally Posted by khaytsus View Post
One question... Why are the Charging Times on the main screen "to 82%" for USB, "to 88%" for AC? Is this an estimate of what I typically (so far) have charged to for each of these?
Yes. It doesn't know how long it takes to go higher.
(I chose specifically to do it this way because my own phone, at above 93%, starts slowing down, and usually reports "Fully Charged" when it reaches 97% or 98%)

Quote:
Originally Posted by khaytsus View Post
Now, a suggestion or two.. A "Now" button for the graphs, to make it easier to find the most recent real info (vs estimated).

Make the graphs on the main page representative of the real graphs. Not updating in real time or anything, but right now they're just static icons, right?

Fun stuff, look forward to improvements.
First one: Double-tap on the graph, and zooming doesn't change the offset at all (I'm sure I put this into the in-app help ) (Unless that's not what you're suggesting?)

Second one: Static yes, and it's planned, but have to figure out how to do it. Probably won't come for a while..


Keep the questions coming.. It's sometimes hard to tell what is obvious to me and weird to others (Like the Usage graph), because I'm the one making it, so I already understand it all. Your questions will help me fix up the displays and the "Help" section.

EDIT: Looks like I have URL-posting ability now. Yay! Time to work on the OP...
 
overground
Old
#9  
overground's Avatar
Moderator & Developer Committee / Recognized Developer - xxxda-developers Founder
Thanks Meter 1,204
Posts: 5,285
Join Date: Apr 2009
Location: Oxnard, CA Likes: Los Angeles Lakers Dislikes: Heavy petting zoos
Just bought the donate version. The text boxes and such in settings are a little off.
Nexus One Miui11.26 No custom density.
 
T-mobile SDA, T-mobile G1 (bronze) Rooted, Nexus One Rooted 4.0.4, T-mobile G2x Rooted, Viewsonic G-tab 10.1", HTC OneX (SOLD), Kindle Fire Rooted, T-mobile SGS3 rooted, Note 10.1 rooted / GDE=360░s of fun!! / pinkventure.com
Quote:
Originally Posted by dumfuq View Post
That is correct. Or you cold use the escape sequence instead of quotes.
Code:
sh /system/sd/bart.sh Double\ post -d -u -m -f -u -q knockeduphooker9.1.1Full10-26-09
Buy me some meds
 
ardax
Old
#10  
Senior Member
Thanks Meter 66
Posts: 338
Join Date: Jul 2010
This looks really neat.

One thing I'm curious about, is there a way to have the history also show the expected values, so we can see how accurate the app's been?

Tags
battery, empty, graph, predict
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes