Monday, January 31, 2011

Did I say “Pull the Plug”? Meant to say “DO NOT pull the plug”

This could be a mea culpa post. It is rare that I’m wrong; it is even rarer that I admit it! So listen up folks.


In the early days of this blog, one of my dedicated (?) readers had asked me about the urban myth about not keeping the laptop plugged in to extend the life of the battery. In response, I had written a post titled “Pull the plug, your battery will thank you”. This post is the single most popular post on this blog. Almost a year after the post was made, it still gets the most hits.


The logic behind doing this is very sound. As you can read from that post, it has to do with side reactions that occur in the battery at the top of charge. Letting the battery discharge a bit is good for life because the rate of these side reactions decreases with decrease in the voltage. Suffice to say that I recommended you wait for the battery to charge and then you pull the plug and let it self discharge. This way you can extend its life.


I follow this rule pretty diligently. And I thought it had worked well for me. I have one laptop that is 2 years old, has had 297 cycles and has lost 4% of its initial capacity. Not bad. This is my workhorse. I use it every day and although I pull the plug diligently, my usage is such that I keep it pretty close to fully charged. So over the last 2 years, it has spent its time at close to, say, 4 V.


I have another laptop which is 3 years old. It is my personal laptop which we (my wife and I) use typically only over the weekend. We pull the plug diligently, but then the computer sleeps all week; self discharges; and by the end of the week is pretty much discharged. This battery, as of last week, had not lost any appreciable capacity even after 350 cycles.


These two data points tell you something about batteries. The cell with more cycles and with more time is cycling better! No magic. Just a simple fact that the battery was sitting at a lower state of charge and so the side reactions were not as worse. Ergo, better life.


Did I mention that both these are Macs? I have a third laptop given to me by a startup where I spend some of my time. This is a PC assembled by a company whose name starts with a D and ends with an L and has 4 letters to it. That computer is on its 4th battery in 2.5 years. After I lost my first battery I spent significant time trying to understand why my rules were not working and trying to tweak the rules. Soon, I came to the conclusion that with some batteries there really is no point trying to find ways to extend life. They are beyond help.


Actually, these rules have been helping this battery also. But different battery companies make batteries with different quality (achieving tightly-bound quality metrics has been a challenge in the manufacturing of batteries). So when you start with a battery with bad quality, there is only so much you can do.


But let us get back to my Mac.


Well... last weekend, my 3 year old Mac with no capacity fade suddenly appeared to have a dead battery. Not a battery with some loss in capacity; or one with 20% loss in capacity (which is considered dead). It was just plain dead. No charge; pull the plug and it would shutdown. It was on life support, literally!


The only way this battery would have a second life was if it were a Hindu and had not attained enlightenment and so was eligible (I suppose doomed is a better word) to be reborn. Somehow it seemed like even with the 1000 (or is it 10,000) Hindu gods there was no way to get this battery back up.


My first reaction was one of disbelief. There was no way a battery can go from no fade to completely dead in a matter of 1 week of self discharge. It had to be a software glitch that was not allowing the battery to be used.


Two hours, a bit of heartburn, and a detailed scouring of the world wide web later, I found various tricks to reset the battery management software and a software to measure the voltage of the battery and came to the conclusion that it was indeed dead. The (average) individual cell potential appeared to be close to 1.5 V! The typical cutoff potential of these cells is around 2.5 V.


So I pulled the plug and my battery died!!


A call to Apple confirmed that I was out of warranty and was told to go to the Apple store for a “detailed diagnostics”.


So I dragged myself to see the “genius” at the store (I’m not being condescending here; they really call the tech support guys genius’. Apparently if Einstein were alive today he would be working at the Palo Alto Apple store!).


Albert plugged a USB stick into my laptop; my screen turned into a series of numbers. Albert then turned and says that my battery is dead. Clearly he was on his way to writing a paper on the unified field theory.


I apologetically told him something like “I understand a bit about batteries and I don’t expect them to fail like this” and he said “I would not expect them to do that early on, but after 3 years I fully expect this”. Not “its possible”, but “fully expect”!!!


I debated giving up versus trying to argue on the finer points of battery chemistry but it seemed like a lost cause. I’ve been very reluctant using my celebrity status as the author of TWiB, and I have to say that it is intimidating arguing with a “genius”!


So I shelled out $130 for a new battery; thanked the guy for his help; and left.


I drove back re-examining my whole life and everything I know. I always thought there was some merit to the George Costanza (of Seinfeld fame) principle of doing the opposite of what our instincts tell us. Maybe I had it all wrong. Maybe you should not be pulling the plug. Maybe my jingle on battery rules needed to be rewritten.


A couple of days later my confidence started to return. I decided to do what anyone looking for credible information does: perform a google search to see if plugging in your laptop battery is bad. I came across my original blog post on this topic.  I sounded so convincing in the post that I started to get re-convinced that I was right about my rules.


So what is going on? How can a battery die when it is self discharging on sleep?


Here is my take.


All you PC folks are familiar with the hibernation mode that you can either force your computer to enter, or set it such that the power management utility moves the computer to hibernation after a while of being at sleep.


In sleep the computer stops many of the processes from running and thereby decreases the processing needs and hence drains the battery slowly. In hibernation, the computer (presumably) stops pretty much everything; stores the state in memory; and basically shuts down. This means there is very little drain on the battery.


In a Mac there is a sleep option, but there is no hibernation option. However, if you are in sleep and if your battery drains down to some small state of charge (say 5%), then it automatically moves into a “hibernation” mode; freezes the state and stops all the processes.


One thing we had noticed in the dead Mac (before it died) was that when we opened it over the weekend it was pretty much in hibernation with little juice left in the battery.


Ideally hibernation in a low state of charge is a good thing. Remember the rule “don't charge them too high”? Higher the voltage of the battery, worse will be its capacity fade. So storing it at a low state of charge (or low voltage) is actually good for the battery.


Did I mention that keeping the voltage way too low (i.e., over-discharging) is a bad thing?


This is because many cathode materials can get irreversibly damaged on over-discharge. More importantly, if an anode is over-discharged you can start dissolving the current collector (copper).


When you discharge the battery and it reaches its end of discharge voltage, depending on the battery chemistry (i.e., the anode and cathode that it uses) and on the design of the cell, the battery is limited by either the anode not having any lithium left, or the cathode not being able to accept any more lithium.


As you cycle this battery there are side reactions in both the electrodes. The extent of these side reactions depends on the design of the cell, the chemistry of the electrodes, the composition of the electrolyte, the level of impurities in the manufacturing, the way the battery is formed etc.


In other words, the side reactions are pretty complicated.


However, what we need to understand is that these side reactions can actually change the way the electrode reaches the end of discharge. They can even change which electrode limits the end of discharge.


So here is my take on what happened to the Mac battery.


The battery management system had a methodology of estimating the state of the battery and deciding if its needs to jump from sleep (the usual mode) to hibernation. This estimation was probably pretty accurate at the beginning of the life of the battery.


But years pass (3 in my case); the side reactions chug along; and they start changing the shape of the voltage curves, especially at the end of the discharge. Slowly, but surely, the management system was making errors in its estimation on the remaining charge.


The battery was not fading appreciably. Instead it was becoming harder to predict the time it would take to go from, say, 5% SOC to being fully-discharged.


I think that as my battery kept fading, the transition from sleep to hibernation was not getting triggered correctly, the battery over-discharged.


This is why when I checked the battery voltage it was sitting at 1.5 V.


I have a sneaking suspicion that my battery may actually come back to life if charged but that the power management software is not allowing any charge to reach the battery because the battery voltage is so low. I should have asked for my old,dead battery to try to resuscitate it myself!


If this sounds like an easy explanation considering how complicated all this is, its because it is the only plausible explanation I can come up with. If Steve Jobs would like to disagree, I’m listening.


So I still believe that if you “pull the plug, your battery will thank you”. I am glad I don’t have to go back and change 7 of my posts and apologize to my regular readers (all 7 of them!)


So what can one do about all this? Download the desktop hibernation widget at http://deepsleep.free.fr/ This gives you a way to move your Mac directly into hibernation instead of to sleep. This is probably a good thing anyway to conserve battery on long trips etc.


Or you could buy one of the new Macbook air computers which comes standard with hibernation.


In the meantime, my rule stands: Pull the plug, and your battery WILL thank you.


When Albert at the Apple store told me he “fully expected” my battery to behave this way, maybe, just maybe, he actually knew all this. After all, he is a “genius”.


Venkat