Wednesday, 12 May 2010

Saving N900 battery power with simple shell script

It's not a secret that Nokia N900 is a real power sucker and needs quite frequent contact with battery charger, especially when all those fancy always-online features are enabled and in constant use. I keep my N900 in such mode nearly all the time myself, yet there are times (overnight, while at work, hospital etc.) where I'd like to sacrifice being online 24/7 in order to spare battery an extra breath. Offline mode is not an option, as I'd like to preserve ability to actually make voice calls and send text messages. You know, old-school.

So, thanks to great input which I've received on maemo-users mailing list and few additional sources, I've crafted a simple shell script called that does few things in a single go:
  1. Sets internet connection mode to "Always ask" (available under Settings -> Internet connections -> Connect automatically).
  2. Disconnects current internet connection.
  3. Switches cellular radio into 2G-only mode.
  4. Disables automatic email send&receive in Modest email client.
While same script is used with "off" parameter, it re-enables automatic internet connection mode, dual (2G/3G) cellular radio mode and automatic email checking in Modest.

Simply speaking, basic usage is as follows:

Going into power saving mode...

root@n900:~# off
Restoring power suckers...

From my experience, actions taken by this script should make quite significant difference in battery life, yet YMMV of course. It also does nicely play with Alarmed application, so you can conveniently schedule power saving script to execute overnight and restore in the morning automagically.

Script is available for free download, use and any sorts of modification you'd like to make yourself. It's simplistic shell script, no GUI whatsoever, so use it via X-Terminal. It could be wrapped up with some nice status-area button or something, yet my Maemo development skills (and time) are very limited.


  1. Thanks for the script, I appreciate it, since it really might just save my battery for longer. :) However, I've got one question for you. Does the script require running X-Terminal on the background all the time, or can I just close the program and the script still goes on, until I turn it off?

  2. You don't need to keep X-Terminal opened all the time, as this script is not running in the background. It just changes few settings and it's done, so X-Terminal could be closed straight away.

  3. What about disabling Mail for Exchange sync? Can that be scripted as well?

  4. I don't use MfE myself, so I didn't look for a way to disable that via command line (which doesn't mean it doesn't exist).

  5. It's nice, but I think the main power saver here is the switch from 3G to 2.5G. I run my N900 in online mode 24/7, with IM for 5 accounts running, Modest doing checks, roaming onto Wifi as needed, and using it normally (a few texts, short calls, & browsing a bit per day). My battery routinely is at about 40% full when I plug it in at night to go to bed. The key thing is I don't have 3G, only 2.5, which uses less power.

    One other power-saver you may want to look into is Titan's Kernel-Power package. It spawned from the overclock stuff, and while it still allows overclocking, Titan's packages are more about power conservation. Using the low voltage kernels (or ultra/extreme versions) you can run the N900 at the same frequencies as a stock N900, but at far less voltage. That means over-all power use is lower, and the battery drains slower.

  6. Download wifi switcher as well.

    When you disconnect from a wifi the chipset is not switched off but keeps scanning for additional networks. Wifi switcher completely powers it down. I noticed significant power savings.

  7. I always get "permission denied" error. I use rootsh to gain root, i try simply and ./ and always fail. What do i do wrong? (sorry im not a shell specialist :) )

  8. @Woody14619: Yes, 3G is real power sucker, I've noticed that too, yet here in the UK most networks still have plain old GPRS (not EDGE) within their 2G coverage, so browsing the web is quite painful without 3G and WiFi. Apart from 3G, what I've also noticed is that battery goes quickly down during general Web browsing too, although it's a bit better when doing that via WiFi, not 3G. Also, thanks for kernel-power suggestion. I might give it a try eventually.

    @Remco: Thanks for useful suggestion. I think Wifi Switcher you're referring to is simply unloading wireless adapter kernel module, so that could be easily achieved within my power-saver script too.

    @lego: Did you make it executable? chmod +x I'd also move it away from MyDocs folder (ie. to /home/user) as it is fat32 filesystem, which doesn't recognize file permissions.

  9. I am having problems installing it, could someone help me through it please.

  10. @james self: it is a shell script, which requires some basic understanding of command line. Basically, you need to copy the file into some directory in your device (I suggest /home/user), then run X-Terminal, do chmod +x, and then run it by ./

  11. If you guys need a graphic widget button on screen for launching the script just drop me a message in the official Queen Beecon Widget thread

    Here is an example of what has already been done:

  12. @david lorenz: thank you!

  13. hi! mugen is making 2400mAh extended battery for N900, so it can help those who need longer time without charging:

  14. "I think Wifi Switcher you’re referring to is simply unloading wireless adapter kernel module, so that could be easily achieved within my power-saver script too."
    You can read more?

  15. Nice work!
    Does anyone know how to turn of the GPS and network positioning from the shell aswell?
    It´s always time consuming to turn all those off if you´ve used the map.