[HOW-TO] Undervolt your way to 18+ hours per charge. (And overclock too!) 2.1 ONLY

El Poblano

Well-known member
Jul 31, 2010
139
14
0
Visit site
First off, I IN NO WAY TAKE CREDIT FOR THIS METHOD AND/OR FILES!! All the work put into this was done by Elkay at DroidForums.net. The original thread is located here.
As always NEITHER I NOR ELKAY ARE RESPONSIBLE FOR ANY HARM/LOSS OF DATA AS A RESULT OF THE FOLLOWING PROCEDURE. YOU MAY VOID YOUR WARRANTY. IT IS MEANT AS AN OPPORTUNITY TO DISCUSS THE POSSIBILITIES OF YOUR DEVICE AND YOU USE THE FOLLOWING METHOD AT YOUR OWN RISK!
However, I have been undervolting/overclocking my phones for more than two years now and have done so without any problems.
My reason for posting this is more as a guide to those who may be nervous about unleashing the real potential that their phones have. I have tried to make this as simple as possible. That being said, if anyone knows of a better method, by all means lets discuss it.

Ok! On to the undervolting!

1. Obtain the necessary files/programs:
-It is very possible to accomplish the following with only adb shell or a terminal emulator. This is quite difficult however, and requires that one is familiar with command line (chmod, mounting, ect...), and as such is NOT RECOMMENDED for the average user (the target of this how-to).
-Rather, with the help of root explorer, you can issue very simple terminal commands to undervolt/overclock. The Terminal and Root Explorer are here:
terminalp.png
rootexplorer.png

-After initial overclock/undervolting is achieved, you may want to take advantage of the the ability to set your own scaling points with user defined voltages. This is optional, but recommended if you goal is to extend your battery. SetCPU is required to enable scaling. This can be found here:
setcpu.png

-Next comes the files necessary for the undervolting/overclock. Like I stated before, these were developed by Elkay at DroidForums.net. There are two zips necessary: DX OC Tools.zip and DX OC.zip. These are attached below.

2. Place the files in the correct location and set permissions:
-DX OC.zip contains two files: overclock.ko and overclock.sh
-These two files can be moved onto the sdcard by mounting the card in usb mode, or by extracting within root explorer. Mounting is the easier method.
-Once both files are on the sdcard, open root explorer and navigate to /sdcard.
-Move overclock.ko to the folder /system/lib/modules by long pressing the the file and selecting move from the menu. Pressing move will give two buttons at the bottom of the screen, cancel and paste. Press the hard key BACK to return to / and navigate to /system/lib/modules. Press paste once there.
-Now is time to set the permissions for the overclock.ko. First mount as R/W by pressing the button that says 'Mount R/W'. If not mounted correctly, Root Explorer will return an error saying the file system is read only. Once again long pressing the file and select permissions. Overclock.ko must have its permissions set to User R/W and Group/Others R (644). It will look like this:
cap201008261817.jpg


-Next, following the same method as described above, place the overclock.sh in the folder /system/bin. Permissions should be set at User R/W/E, Group/Others R/W (755), or like this:
cap201008261815.jpg


-The remaining two files (setclock.sh and setscaling.sh) from the DX OC Tools.zip should be placed in the same directory as overclock.sh and with the same permissions as overclock.sh (they are all scripts).

3. Set the clock at the desired speed/voltage.
-This is the fun part! But first some information. This is where you can get yourself into trouble if you are not careful. The idea here is to get the highest clock speed with the lowest voltage AND REMAIN STABLE. You don't have to overclock at all, really. Just setting the voltage to lower than stock will give you the battery benefits without the supposed danger to your device.
-The overclock.sh script is et up so that the first value entered will be the clock speed IN HZ, NOT MHZ! i.e. 1150000 is 1150 mhz. The second value is a coefficient in an equation to determine voltage, known as vsel., e.g. 80 vsel is 1.6v, 96 vsel is 1.8v. The stock voltage on the X is 66 at 1 gHz.
-The greater the clock speed you set your phone at, the greater the voltage necessary to maintain stability. Do NOT go above 96 vsel, or you could fry your phone. In fact, I wouldn't go much above the stock 66 at all, as I have tested my phone to be stable at 1.15 gHz and 46 vsel, which is well below stock (and the battery gains are by lowering the voltage anyway).
-Open up terminal emulator, and run the following commands:
Code:
su
overclock.sh <desired clock speed> <desired voltage>
-It will look like this:
cap201008261818.jpg

-Congratulations... you are now overclock/undervolted! ...but we're not done yet.

4. Fine tuning and scaling.
-You might find that after entering a clock speed/voltage, that you phone becomes unresponsive or sluggish. No worries! That is what the setclock.sh script is for.
-Once again open the terminal emulator and enter in the the command:
Code:
su
setclock.sh <desired clock speed> <desired voltage>
-This way you can change your voltage or clock speed to something a bit more stable with out the need to reboot.
-Notice this is the same format as the overclock.sh, but if you have already entered in a command using overclock.sh since the last boot, you must use the setclock.sh command to change the clock speed/voltage.
-Once you discover which setting you most like (i.e. at the speed you want and most stable), you can set up the scaling. This will further give you better battery life! This is optional, however, and your phone will run just fine without scaling.
-Once agan open up root explorer and navigate to /system/bin. Make sure you are mounted R/W and long press the file setscaling.sh. Scroll down and select open in text editor. It will look like this:

cap201008261820.jpg


-Each of the values can be edited so that SetCPU can run your custom operating points.
-The first two lines are the max voltage and max clock speed you want your phone at. The second set of commands are similar to those we have entered in using terminal emulator. Remember- not all values are in the same format! (Hz vs mHz) Maintain the correct number of digits to avoid problems.
The last set of lines is for SetCPU, and are used as the operating point that it will scale to.
-Set as desired.
-After all the values are correctly set, press the menu button and hit Save and Exit.
-Exit Root Explorer and open Terminal Emulator.
-Run the command:
Code:
su
setscaling.sh
-There will be NO readout after the command.
-To ensure that you values have been entered as desired, stay in Terminal Emulator and enter the following command:
Code:
su
cat /proc/overclock/mpu_opps
-It will look like this:

cap201008261819.jpg


-This will help ensure your desired values have taken effect, if you are concerned they haven't.
-After all the values are to you liking, open SetCPU and behold the magic!!

5. Important Notes!!!
-If you phone locks up or reboots, DON'T WORRY!! These don't run on start-up, thus you phone is back to stock when it reboots.
-A faster method of getting the undervolting back after a reboot is through a simple command:
Code:
su
insmod /system/lib/modules/overclock.ko
setscaling.sh
-Once you open SetCPU after these commands, you'll be back to what it was before the reboot.
-Some might say that undervolting hurts your CPU by increasing the amperage... IT DOESN'T! V=IR (Voltage=Current(in amps) x Resistance). We are adjusting the voltage, and the resistance of your processor remains the same no matter what. Thus I=V/R, i.e. current decreases by undervolting resulting in less power used and cooler temps. Everyone wins.
-Feel free to mess around with your values, as long as your voltage is low. A high clock speed that can't be maintained by a chosen voltage will only result in a random reboot. No harm done.
-I have found my phone incredibly stable (5 days and counting) at 1.1 gHz and 32 vsel. This works out to less than HALF the voltage of stock. My battery is awesome- for ex. I unplugged at 7am, and its 8pm here, my battery is at 70%.
-This is currently only for 2.1, though Elkay has mentioned that his is working on a version for Froyo.
-UPDATE: There is one known bug that I had forgotten about. If after running the cat /proc/overclock/mpu_opps command you notice that your voltage didn't stick, run the command setclock.sh <clock speed> <voltage> to fix it. Remeber though that the overclock module must already be loaded after boot for the setclock.sh command to work (the module is loaded either by the overclock.sh or the insmod /system/lib/modules/overclock.ko commands).

Once again I take no credit for the method above, rather I just compiled what I saw as the useful information into one place.
 
Last edited:

alosenster

Member
Jul 18, 2010
16
0
0
Visit site
Thanks for the great tutorial!
My only problem was with the setscaling.sh step. When I verified it, it still had the default values. In root explorer, I see my file, named setscaling.sh, as well as another file named setscaling.sh.bak. Is that file overriding the scaling that I'm trying to do?
 

jdbower

Well-known member
Jul 2, 2010
615
59
0
Visit site
Dumb question... But why wouldn't it come undervolted?

Stock settings are a compromise between battery life, performance, and reliability. Increase one, and you sacrifice one or both of the other two. It's all about your own priorities around the phone - if battery life is the most important aspect go for it. If performance is what you want, I'd do with one of the overclocking threads. Personally, I'm glad to see threads like this one that allow you to make that choice - thanks!
 

El Poblano

Well-known member
Jul 31, 2010
139
14
0
Visit site
Thanks for the great tutorial!
My only problem was with the setscaling.sh step. When I verified it, it still had the default values. In root explorer, I see my file, named setscaling.sh, as well as another file named setscaling.sh.bak. Is that file overriding the scaling that I'm trying to do?

Lol... after reading you post again, I think I answered the wrong thing.... However, the setscaling you are trying to edit is the one WITHOUT the .bak. Root Explorer automatically backs up any file you edit, so that after setting the values you want in the setscaling.sh, it will make a copy of what it was. Also, when it the text editor, make sure you press the menu button and save. That could be the reason why its not showing the correct values.
EDIT!! So sorry for confusing you like this... I realized I forgot to put a step in the how to for scaling. After saving the values you have to return to terminal emulator and run the command setscaling.sh. I edited the howto to reflect this. Follow the steps again and let me know if it works.
 
Last edited:

alosenster

Member
Jul 18, 2010
16
0
0
Visit site
Running the setscaling.sh command did the trick. Thanks again!
I'm assuming the values in the tut are what you have running on your X. Those still working out well? I have mine set identically for now.
 

El Poblano

Well-known member
Jul 31, 2010
139
14
0
Visit site
One more thing. You mentioned SetCPU in your post. If you've gone through your tutorial, do you still need SetCPU for anything?

I should have clarified the scaling. While our method sets up the scaling points (or OPerating PointS (OPPS)), its up to SetCPU to set the MPU (microprocessor unit) at the defined speed. In otherwords, we define what we want SetCPU to do. Without this step SetCPU would auto detect the OPPS and you wouldn't be able to take advantage of clock/voltage adjustments you made. To sum it up, yes you need SetCPU. I'll edit the Howto to reflect this.
 

El Poblano

Well-known member
Jul 31, 2010
139
14
0
Visit site
How does this affect performance?

There is a modest gain to performance if you choose to overclock. I have mine set at 1.1 ghz (which might not seem like much but that's still 10%) and generally score in the high 1300s to low 1400s on the quadrant. However the biggest gain is in battery life. Mine is undervolted to less than half stock, even with the overclock. I can't kill my battery in a single day unless I only stream pandora!
 

UnicyclistRobe

Well-known member
Nov 22, 2009
108
1
0
Visit site
There is a modest gain to performance if you choose to overclock. I have mine set at 1.1 ghz (which might not seem like much but that's still 10%) and generally score in the high 1300s to low 1400s on the quadrant. However the biggest gain is in battery life. Mine is undervolted to less than half stock, even with the overclock. I can't kill my battery in a single day unless I only stream pandora!

So undervolting doesnt have any negative effect on performance?
Well then what the heck! Why isn't everyone doing this?! :)
I will be seting this up as soon as i have free time. This sounds brilliant.
 

El Poblano

Well-known member
Jul 31, 2010
139
14
0
Visit site
So undervolting doesnt have any negative effect on performance?
Well then what the heck! Why isn't everyone doing this?! :)
I will be seting this up as soon as i have free time. This sounds brilliant.

Nope, no negative impacts on your hardware from the undervolt. The reason manufacturers don't lower the voltage is due to stability. This is discussed more at length in the how to, but it basically boils down to this: while many chips can handle the lower voltage without issue, not all can. This is in fact entirely random even in the same batch of chips. My phone personally didn't like anything over 1.1 ghz unless I actually overvolted, but 1.1 runs just fine. However, others have had theirs up to 1.25 with a minimal undervolt.
 

GTvert90

Well-known member
Jun 26, 2010
673
2
18
Visit site
If I took the time to learn and do this.... Would it disappear and go back to stock once 2.2 was rolled out? Would it lock at the 1.1 and what ever I undervolt it to? Or would I still be able to change it?

Thanks
 

thebizz

phone addict
Nov 8, 2009
3,568
42
0
Visit site
Thx for editing the title because I've been following this on df and knew it didn't work on 2.2 kinda wished it did I want a slight overclock/undervolt
 

El Poblano

Well-known member
Jul 31, 2010
139
14
0
Visit site
If I took the time to learn and do this.... Would it disappear and go back to stock once 2.2 was rolled out? Would it lock at the 1.1 and what ever I undervolt it to? Or would I still be able to change it?

Thanks

So without getting in to too much linuxery, the overclock.ko is a kernel module that isn't loaded on bootup. So every time you restart your phone, it's back to stock. This includes going to 2.2- the files will be there, but not loaded. Note, however, that it is not compatible with 2.2. As for changing clock speed/voltage, you can change it as much and as often as you'd like in 2.1 using the command setclock.sh. This is discussed at length in the Howto.
 

thisisbenji

Well-known member
Aug 7, 2010
50
0
0
Visit site
When I type
overclock.sh 1100000 34
into the terminal it spits out an error saying
insmod: init_module '/system/lib/modules/overclock.ko' failed (Exec format error)

Does anybody have an idea why that keeps happening?
 

dbcalo

New member
Sep 4, 2010
2
0
0
Visit site
since this needs to be run every time you start the phone to get it setup correctly, has anyone tried using tasker to auto run the code?
 

El Poblano

Well-known member
Jul 31, 2010
139
14
0
Visit site
When I type
overclock.sh 1100000 34
into the terminal it spits out an error saying
insmod: init_module '/system/lib/modules/overclock.ko' failed (Exec format error)

Does anybody have an idea why that keeps happening?

Are you running 2.2? I had this exact error when i first loaded the leak.
 

thisisbenji

Well-known member
Aug 7, 2010
50
0
0
Visit site
Nope I'm running 2.1, I'm confused as to what I did wrong. I just got my phone yesterday, I wonder if that has anything to do with it? Are there different versions of 2.1?
 

Forum statistics

Threads
943,165
Messages
6,917,619
Members
3,158,857
Latest member
tress