Battery life via underclock [Root]

Discussion in 'Motorola Droid 2 Global' started by 13th angel, Nov 9, 2011.

  1. 13th angel
    Offline

    13th angel Developer Developer

    Joined:
    Jan 16, 2011
    Messages:
    2,102
    Likes Received:
    1
    Trophy Points:
    103
    Location:
    Auburn, Alabama
    Ratings:
    +1
    Disclaimer: I, nor the developers of either of the apps mentioned below accept responsibility for what you do to your device.

    So I've been asked multiple times how I go 12+ hours on the normal battery with average use. I really dont do much so this can easily be increased.

    Recommended apps:
    SetCPU (free from XDA or paid on the market) - http://forum.xda-dev...ad.php?t=505419
    Milestone Overclock - http://milestone-ove...verclock148.apk

    Progressive underclock:
    This is the single biggest thing I've found to help with battery life. This is relatively easy to understand, you lower the clock speed as the battery reaches certain points. This is done by profiles in SetCPU.

    These are my battery level slots:
    (with stock speeds, adjust if you modify them)
    profile min/max priority
    charging 300/1200 70
    <40% 300/800 60
    <80% 300/1000 50

    Screen off underclock:
    Another pretty easy to understand one. SetCPU lowers the max clock speed whenever your screen is off. Also done via profiles in SetCPU.

    (stock speeds again)
    profile min/max priority
    Screen Off 300/600 90

    Notes about SetCPU:
    You should always have a "Temp > xx C" profile. I use 50C which is a tad on the high side but still within safe limits. I would recommend using 46-47C but ultimately is up to you.

    profile min/max priority
    Temp > 50 C 300/300 100

    Governor:
    I use Ondemand personally. Its made to do what it says, scales up the processor when its needed but the rest of the time will with at the lowest speed. With that said, smartass is a bit more efficient however it requires setting at a lower speed otherwise it doesnt work right. I prefer not to cripple my device when its not needed. In the end, it is entirely up to you.

    SetCPU Advanced tab:
    This is a really good explanation and rather than re-typing it all out I'll just link to it: http://forum.xda-dev...304&postcount=1

    Here is my values though:
    Sampling Rate: 37500
    Up Threshold: 75
    Ignore Nice Load: 0
    Powersave bias: 500

    Milestone Overclock:
    This really is an amazingly useful app when you start using it. It does two things, 1) has the overclock module and allows you to have it load on boot without having to write a shell script to do so and 2) allows you to easily modify the top frequency speed/voltage. All others require a script to modify however and I'll get into that later in this post.

    So when you open the app its pretty straight forward. Load module loads the overclock module, refresh refreshes the values above unload module when it is loaded, apply applies the value from the slider, and the slider allows you to pick which you use. Autoload on boot is also pretty obvious, it loads the overclock module after boot (its either 30 seconds after or 60 seconds after, cant remember). It allows the environment to get booted and sane (not running the boot up processes) and then loads. This is nice because if you set it then your device cant handle the speed it allows you time to deselect autoload.

    Now the real prize here is that last slot of the slider, the custom one. When you press the menu button then click settings it allows you to change the clock speed and vsel. These values will differ for every device. For instance, I can run mine up to 1375000 khz (the value is in khz in the settings menu) but Ace can go up to 1395000 khz without problems, mine instantly reboots above 1375 mhz. Vsel is much the same, this will vary by your slot speed though.

    My values for reference:
    clock speed: 1350
    vsel: 66


    Finding your speed/voltage:
    Be very very very careful when testing to find your speed/voltage. Do NOT rush this, otherwise you can easily bootloop your device and the only way to get out of it is by wiping data. Do not set at boot until you have found a stable speed/voltage.

    Using the settings menu and the custom slot bump up your custom rate in small increments. Generally safe way to get a "ball park figure" is to bump it up by 50 mhz at a time, then when it reboots go to 10, when it reboots go to 5, then 1. Always stress test each speed for a minute or two. This is especially important when you start narrowing in your speeds. This is a very handy feature of SetCPU, it has a stress test built in under the info tab of the app.

    For vsel, do basically the same thing just in 2/3 increments instead of 50/10/5. Always stress test and when you find the vsel that it reboots at then bump it up by 2 or 3 to be safe.

    I'll write up about writing a shell script for all slots later.
     
  2. 13th angel
    Offline

    13th angel Developer Developer

    Joined:
    Jan 16, 2011
    Messages:
    2,102
    Likes Received:
    1
    Trophy Points:
    103
    Location:
    Auburn, Alabama
    Ratings:
    +1
    Finally got off my butt and got around to writing this.....


    This is how to write a shell script for underclock/undervolt. I'll try to explain how everything works as I go.


    So this is my oc script and there are multiple ways to do it.


    Code:
    #!/system/bin/sh
    # might cause problems, use at your own risk
    # optimized for x13thangelx's D2G
    
    
    # sleep so that it allows you time to remove/comment the script if it causes problems on boot
    sleep 120
    
    
    # voltages
    echo 1 300000000 17 > /proc/overclock/mpu_opps
    echo 2 645000000 34 > /proc/overclock/mpu_opps
    echo 3 886000000 45 > /proc/overclock/mpu_opps
    echo 4 1128000000 58> /proc/overclock/mpu_opps
    echo 5 1350000000 68 > /proc/overclock/mpu_opps
    
    
    # speeds
    echo 0 1350000 > /proc/overclock/freq_table
    echo 1 1128000 > /proc/overclock/freq_table
    echo 2 886000 > /proc/overclock/freq_table
    echo 3 645000 > /proc/overclock/freq_table
    echo 4 300000 > /proc/overclock/freq_table
    

    Now to dissect it....


    Its fairly straight forward as far as a script goes, waits 2 minutes then write some numbers to the overclock module.


    Quick overview of a shell script:
    Code:
    #!/system/bin/sh
    

    This line tells the script what it gets run as and the path to what runs it, in this case a shell script using sh in /system/bin.


    Code:
    #
    
    This symbol is used to comment things out. This can be used for explanations, directions, or removal of lines so it doesnt get run, etc. Commented lines are not executed. Say i used "#sleep 120" instead of "sleep 120", then it would not execute the sleep command.


    Code:
    sleep 120
    
    This makes the script wait for 120 seconds before running. This is mostly to allow the environment to be sane before changing values. It also allows you to fix any problems (read reboots) by changing values, deleting the script, or other methods, without having to reflash the system or wipe data.


    Code:
    echo
    
    From the echo manpage: "Display message on screen, writes each given STRING to standard output, with a space between each and a newline after the last one."
    This command can be used to display text or to write data to a location. In this case it writes the values we use for our clock speeds and our vsel's.


    This requires the Overclock module to already be loaded. This can be done by having Milestone Overclock set to load on boot or by insmod'ing the module yourself.


    if you have Milestone Overclock installed as well then add this line to the script after "sleep 120"
    Code:
    insmod /data/data/pt.com.darksum.milestoneoverclock/files/overclock.ko
    

    Running the script:


    Theres several ways to run a script. I personally prefer using Script Manager because I have had init.d not run the script before.


    Init.d method:
    this requires a rom that supports init.d (which I think is everything but stock and it can with a little work)
    Rather simple, name the script 99oc.sh and put it in /system/etc/init.d and make it executable ("chmod +x /system/etc/init.d/99oc.sh" in terminal)


    Manual method:
    Save the script anywhere you wish and then run it by typing this into terminal emulator: sh /<path/to/saved/script> (obviously replace that with where you saved it including the scripts name).
    Downside is that you have to manually run it every boot.


    Script Manager method:
    Requires Script Manager (free on the market)
    Save the script somewhere on your sdcard then point Script manager at it, run as root (and when you know for sure you wont cause problems with it run at boot).
     
    Last edited: Nov 14, 2011
  3. 13th angel
    Offline

    13th angel Developer Developer

    Joined:
    Jan 16, 2011
    Messages:
    2,102
    Likes Received:
    1
    Trophy Points:
    103
    Location:
    Auburn, Alabama
    Ratings:
    +1
    2nd part posted. If theres any specific questions or anything I missed let me know
     
  4. themib
    Offline

    themib Senior Member

    Joined:
    Mar 7, 2011
    Messages:
    1,456
    Likes Received:
    29
    Trophy Points:
    48
    Location:
    South Dakota
    Ratings:
    +29
    Current Phone Model:
    Droid 4 (XT894)
    Thank You
    I've been using SetCPU since upgrading to GB, but never used the Profiles till now
     
Search tags for this page
99oc script code android
,
android underclock
,

how to underclock rooted android

,
rooted droid bionic underclocked to save battery life
,
underclock android phone
,
underclock android phone without rooting
,
underclock android safe value
,

underclock android without root

,
underclock rooted droid bionic to save battery
,
underclocking phone without root