Lithium-ion battery preservation

Leaves with glowing edges

After seeing that the capacity of my iBook battery has fallen by 10% over the course of four complete cycles of discharging and charging, I went and read up on lithium-ion batteries. My previous conceptions about them turn out to be almost entirely wrong. Since almost all cellular phones, laptops, and music players with rechargeable batteries run on this sort, it is worth knowing how to keep them going for as long as possible.

1. Discharging completely, then charging completely, is not the ideal approach

Unlike other kinds of batteries, there is no ‘memory effect’ with Li-ion systems. Batteries that suffer from memory effects ‘forget’ how much charge they can hold if they are not completely drained and then completely recharged. As such, the strategy to keep them alive for the longest time is to always follow that pattern.

With Lithium-Ion batteries, full discharging is not only non-ideal, it is actually harmful. This is because it strains the weakest cell. Since a battery is composed of several cells, the failure of any one will mean the failure of the whole system. All lithium-ion rechargeable batteries have systems to prevent cell voltage from dropping too low (a microcontroller cuts it off before it reaches that point), but draining them to the point of cutoff is still harmful.

2. Temperature matters most

The biggest factor in battery life, especially for laptops, is the temperature at which the battery is kept. Judging by the figures from iStat Pro, mine is consistently at more than 40°C when the computer is running. Between reading, writing, listening to music, and just hanging around on Skype, that is probably more than twelve hours a day.

Just keeping the battery at 40°C will result in capacity loss of more than 15% over the course of one year, compared with a 2% temperature based loss if the battery is kept at 0°C and a 4% loss if it is kept at room temperature (about 25°C).

The most practical upshot of this is that it is intelligent to keep your battery outside of your computer when you are using it plugged into the wall. The most important reason for this is that it will thus be living at a much lower temperature, and thus for much longer. Since a laptop with no battery will shutdown instantly (and incorrectly) with any interruption in the external power supply, the best bet is probably to use a battery on its last legs (but still good enough for a few minutes) when plugged in, and a better one when working off battery power.

3. Storage or using at 100% charge is harmful

For reasons too complex for me to understand, a charge of about 40% is best for the long-term storage of Li-ion batteries. A Li-ion battery kept at 100% charge and 40°C will lose about 35% of its capacity in a year.

4. Li-ion batteries fail over time, regardless of anything else

According to Wikipedia: “At a 100% charge level, a typical Li-ion laptop battery that is full most of the time at 25 degrees Celsius or 77 degrees Fahrenheit, will irreversibly lose approximately 20% capacity per year.” This loss is because of oxidation (over and above heat damage, as I understand it), which causes cell resistance to rise to the point where – despite holding a charge – the battery cannot provide power to an external circuit.

For more information see Wikipedia and this page. The especially bold can learn how to rebuild depleted Li-ion batteries. Anyone with background in electrochemistry is strongly encouraged to comment on the accuracy of the above information.

Sa pgqr higupi lvgohqketvr mbpe lmzw eut, llp hmolruxej cs U cj wift gktn: r scwhm hoe vmwvvih epr temkahzgy, khbzgf kuee tj vwfehxcd izieyetiu qykgbrebi. Rq tiff, aa ih ifi xlrpbqwcj tw xla wpydmqtga iyxxhggvr ilnt vv mhtfphnre, yqh fle gslfrf wo hieksfx avtbvtl. Xzspcs wnq uki vl eg f hsdnywie xvoe kubwy gc fal wacetg stb cs gziqllcziu. Weqivv, yysk tym wpqfhvrzar bg dd wf. Ylg bqyzumkz iy oac sa xymts gmaug hjal rmcj ocw zw nezioxtrkxis. (CR: Seq)

Snazzy open source video player

Available for PC and Mac, the Democracy video player is free and open source software that can play and save a wide variety of video formats. You can, for instance, save Google Video and YouTube files. That includes all of my brother Mica’s videos. The interface is also a lot nicer than mucking around with web pages: especially since you can download batches of files at once and watch them when they finish.

More information is on Wikipedia.

Adieu to Oxford PhotoSoc

Old fashioned scale

Today, we had to choose whether to join the Photo Society and pay the money or stop attending the classes. I have decided to do the latter. With about forty people present, they are too big to get through any decent sample of the work in just an hour. Also, while some of the things being discussed are at a level that would be useful for me, a lot of really basic stuff gets talked about as well. I don’t need to spend an hour and pay £3 to learn something about Photoshop that Neal taught me in two minutes. If I was going to use the dark rooms, the £30 a year fee would be very reasonable, but the last thing I need is some other pursuit to draw me farther away from thesis and seminar reading. Indeed, I have a date with the latter for the rest of tonight that I expect to take a good chunk of it.

After my final PhotoSoc session, I had dinner at Lady Margaret Hall tonight with Richard Albert: a Canadian, formerly at Yale, doing the Bachelor of Civil Laws degree. Confusingly, it is a master’s level program, and it is entirely about common law. In any case, conversing with him was most interesting – an experience that will hopefully be repeated before our respective tenures in Oxford come to an end. Talking about Canadian constitutional law definitely tested my memory of classes with Gateman and Tennant. It is the sort of thing entirely too interesting to be devoted as little attention as can be spared for it.

No more attention can be spared for anything, at this moment, When your seminar is the next day, and the possibility of having to present fills you with dread, you know you are in for a long night of reading.

[Update: 1:00am] I think the page on the wiki for the Developing World option is starting to shape up nicely. It should be a good reference, in the end, for paper writing and exam preparation. Fellow members of the program, feel free to use it. Even better, sign up and add something to it.

[Update: 2:00am] Yes, I do realize that today’s photo is a perfect demonstration of why, instead of using the B&W mode built into my digicam, I should shoot in colour and then render into B&W using Photoshop’s channel mixer. I wish there was a mechanism by which I could compose with the LCD of my Canon A510 in B&W mode, but have it retain colour information for such purposes.

Chemistry and cooking: solvents

Oxford Covered Market

Having largely abandoned my former series How to Eat Like a Grad Student, I am starting a new series of indefinite length on chemistry that relates to cooking, human digestion, and metabolism. This is sometimes called molecular gastronomy. The former series suffered badly from the fact that my recipes were rather overenthusiastic on the spices, and much less characterized by nuance than is generally advisable when cooking for others.

Having now lived in Church Walk for about eight months, I have had a decent amount of time to spend improving my cooking. Being a vegetarian is actually an advantage in this regard: it saves me money, encourages me to cook for myself rather than eat fast food, and makes the process of cooking something of a political statement. As such, I devote more effort to it.

Cooking, which certainly does not mean baking to me, is primarily about two different kinds of chemical processes:

  1. The first are the collection of chemical changes that result from heating. This includes everything from the denaturing of Ovalbumin in eggs to the polymerization of some sugars and the breakdown of some large carbohydrates.
  2. The other major category of chemical processes has to with solvents.

Both polar and non-polar solvents are relevant to the limited kind of cooking I do. Water is obviously the most commonly employed among the former, while olive oil probably rules the latter camp. Polar solvents and solutes are also known as hydrophilic or ‘water loving’ while non-polar solvents and solutes are called lipophilic or ‘fat loving.’

For those unfamiliar with the distinction, it relates to the arrangement of electrons around the atoms and molecules in question. There are two broad kinds of arrangements. In the one case, electrons are more or less uniformly distributed in the space around the nuclei. Since electrons have a negative charge, this gives an essentially negative charge to the area around the molecules and thereby causes them to repel one another. Solvents (chemicals in which other materials dissolve) that are characterized by these kinds of symmetrical electron arrangements are called non-polar. In cooking, these are usually fats.

The same is true when the electrons are arranged in an asymmetric way, except that a differential of charge exists around the atoms or molecules in question. One consequence of this is that they tend to line up pole-to-pole, like bar magnets. This contributes to surface tension in water, as well as the operation of hydrogen bonding.

Polar and non-polar solvents act more or less effectively on different kinds of molecules. Normal table salt (sodium chloride) dissolves much better in a polar solvent, like water, than in a non-polar solvent. Capsaicin, the molecule that makes chillies spicy, dissolves much more easily in non-polar solvents than in polar ones. That is why it is easy to make spices flavourful by heating them in oil. It is also why drinking water does little to alleviate the pain from spicy food. Drinking milk – the fat within which is a non-polar solvent – does a much better job.

While it is definitely open to debate whether any of this information actually makes my dinners more palatable, it certainly does improve my ability to hypothesize about what has gone wrong, in the face of culinary disasters.

In closing, I should pass along a truly nerdy joke that you will now appreciate the logic behind: Why does the great bear of the north dissolve in water? Because it’s polar.

Replacement lithium ions

Now that I have realized how useful the wiki could be for storing notes, I have decided to buy a new battery for the iBook. Less than one hour of unplugged time does not mesh well with several seminars or lectures a day.

Having a searchable, durable database of notes is worth the $160 cost of the battery. Also, since I will have two, I can continue to abuse the old battery by recklessly depleting it a third or the way, then charging it again.

Unfortunately, there is no chance of me actually getting it before this Friday’s climate conference in Reading.

[Update: 11 October 2006] I have cancelled the web order for the battery, as it seems like I wouldn’t actually get it until mid-November. I expect Apple is backed up on battery orders because of the Sony fiasco. I will just buy a battery in a shop, either in Oxford or London.

[Update: 31 October 2006] After 214 cycles, the battery seems to have suffered a critical failure. Now, even when apparently 3/4 full it will sometimes fail completely, causing the iBook to abruptly turn off. This is not a calibration issue; I have tried re-calibrating the meter several times.

Thankfully, I will be able to buy a new one in London in eight days.

[Update: 13 October 2008] My original iBook battery has now failed completely. It cannot run the computer for even a fraction of a second, the LED charge display on the bottom of the battery doesn’t work, and the computer often cannot detect that the battery is present.

Protecting your computer

Beaumont Street, Oxford

At least once or twice a month, someone who I know endures a computational disaster. This could be anything from a glass of wine spilled on a laptop to some kind of complex SQL database problem. In the spirit of Bruce Schneier, I thought I would offer some simple suggestions that anyone should be able to employ.

The most important thing is simply this: if it is important, back it up. Burn it to a CD, put it on a flash memory stick, email it to yourself or to a friend. The last thing you want is to have your laptop hard drive fail when it contains the only copy of the project you’ve spent the last month working on.

Now, for a quick list of tips. These are geared towards university students, not those with access to sensitive information or large amounts of money:

  1. Do not trust anything you see online. If you get an email from ‘PayPal’ or your bank, assume it is from someone trying to defraud you. It probably is. Likewise, just because a website looks reputable, do not give it any sensitive information. This includes passwords you use for things like your bank.
  2. Never address email messages to dozens of friends. Lots of viruses search through your computer for email addresses to sell to spammers or use for attacks. If anyone in that fifty person party invitation gets a virus, it could cause problems for all the rest. If you want to send emails to many people, use the Blind Carbon Copy (BCC) feature that exists in almost all email programs and web based email systems.
  3. If you run Windows, you must run a virus scanner. All the time. Without exception. If you run a Mac, run one in order to be sure you don’t pass along viruses to your friends. Both Oxford and UBC offer free copies of Sophos Antivirus. Install it and keep it updated.
  4. Run a spyware and adware scanner like AdAware often. If you are not doing advanced things with your computer, be proactive and use something like Spyware Blaster. (Note, some of the patches it installs can cause problems in rare circumstances.)
  5. No matter what operating system you run, make sure to apply security updates as soon as they come out. An unpatched Windows XP home machine is basically a sitting duck as soon as it is connected to the internet. See this BBC article.
  6. Only install software you really need. Lots of free software is riddled with spyware and adware that may not be removed when you uninstall it. Especially bad for this are some file-sharing programs. If you do any kind of file sharing, the importance of having a virus scanner becomes imperative.
  7. Never use secret questions. If you are forced to, fill the box with a long string of random letters and numbers. If you cannot remember your passwords, write them down and guard them like hundred dollar bills.
  8. For your web browser, use Firefox. Safari is fine, but you should never use Internet Explorer. If a website forces you to (especially something like a bank), complain.
  9. If there is something you really want to keep secret, either keep it on a device not connected to any network or encrypt it strongly. A user-friendly option for the latter is PGP. Whether it is some kind of classified research source or a photo of yourself you never want to see on the cover of the Daily Mail (once you are Prime Minister), it is best to encrypt it.
  10. Avoid buying compact discs that include Digital Rights Management (DRM). Many of the systems that are used to prevent copying can be easily hijacked by those with malicious ends. See one of my earlier posts on this.
  11. If you have a laptop, especially in Oxford or another high theft area, insure it. They can be stolen in a minute, either by breaking a window, picking a lock, or distracting you in a coffee shop. Aren’t you glad you made a backup of everything crucial before that happened?
  12. If your internet connection is on all the time (broadband), turn your computer off when you aren’t using it.

Basically, there are three big kinds of risks out there. The first is data loss. This should be prevented through frequent backups and being vigilant against viruses. The second is data theft. Anyone determined can break into your computer and steal anything on there: whether it is a Mac or a PC. That is true for everything from your local police force to a clever fourteen year old. Some of the suggestions above help limit that risk, especially the ones about security updates and turning off your computer when it is not in use. The third risk is physical loss or destruction of hardware. That is where caution and insurance play their part.

If everyone followed more or less this set of protocols, I would get fewer panicked emails about hard drives clicking and computers booting to the infamous Blue Screen of Death.

[Update: 6 January 2007] The recent GMail bug has had me thinking about GMail security. Here are a few questions people using GMail might want to ask themselves:

  1. If I search for “credit card” while logged in, do any emails come up that contain a valid credit card belonging to me or to someone else? I only ask because that is just about the first thing that someone malicious who gets into your account will look for. “Account number” and similar queries are also worth thinking about.
  2. Can someone who gets the password to my Facebook account, or some other account on a trivial site, use it to get into my GMail account?
  3. Have I changed the password to my GMail account in the last few weeks or months?

If the answer to any of those is ‘yes,’ I would recommend taking some precautionary action.

Great circles and airline routes

When flying between western Canada and England, it sometimes seems surprising that such a northward trajectory is followed. On my way back to Vancouver, for instance, we were treated to an aerial view of Iceland’s unique landscape. Of course, the reason for the path is that the spherical character of the earth is not well reflected in standard map projections. The most famous – the Mercator projection – is arranged such that a straight line drawn on the map will correspond to a course that actually passes through each point on the earth depicted. This kind of map is called ‘conformal.’ As such, the notorious distortion (enlarging the apparent size of polar regions while reducing that of equatorial ones) is an emergent property of its design.

That said, the most efficient course between any two points on the globe is probably not the one that connects them on a Mercator projection line of the shortest distance. Mathematically, the most direct course is based on what is called a ‘great circle.’ That is to say, imagine marking your present location and your destination using a marker on an orange. The line you could draw all the way around, intersecting both, is the great circle. The line segment between the points is the shortest distance that can be transcribed between them on a sphere (or near-sphere, in the case of the earth).

Unless you are going due north, due south, or straight around the equator, actually following a great circle path requires constantly changing your heading. This is because of how the line you are on does not maintain a constant bearing with respect to either magnetic or true north. In the days before computers and long haul air travel, few people would probably have bothered to calculate great circle courses. A more venerable option can be found in the Rhumb line. Now, GPS and autopilot systems have made doing so all but automatic. Hence the genesis of those gracefully arcing lines printed in your in-flight magazine.

On a separate note, the precision of modern location and navigation systems in aircraft can sometimes cause problems. (Via Philip Greenspun)

The awesome power of hardware

Is anyone else surprised by how emulated versions of games originally written for a machine with a 16-bit, 3.58Mhz processor can strain the capabilities of a computer with a 1300Mhz processor? The second machine has 363 more processor cycles per unit time, and a staggering 10,000 times more RAM. Dedicated chips are awesome; hence, the superiority of digital cameras that use hardware interpolation (all Canon cameras, for instance), as opposed to those that use software to interpolate using generic chips.

That said, it cannot really be denied that Super Metroid is the best of the Metroid series, Super Mario World is the best Mario game, and A Link to the Past is the best Zelda. Final Fantasy VII may narrowly beat Chrono Trigger as the best console RPG.

On electronic voting

There is some controversy in The Netherlands right now about electronic voting. A group has gotten hold of a voting machine, discovered that the physical and software security therein is very weak, and otherwise established the possibility that determined individuals could significantly impact election results through electronic tinkering.

The advantages of electronic voting are fairly numerous. Firstly, it could be made to happen more quickly. This may advantage the media more than anyone else, but it may as well be listed. Secondly, electronic devices could be made easier to use for people with physical disabilities and the like. Another advantage the system should have is increasing standardization between voting districts. Skullduggery involving dated or problematic machines in districts likely to vote in a certain way has been noted in a number of recent elections. Also, having an electronic record in addition to a paper one could allow for cross-verification in disputed districts. In cases where the results very starkly do not match, it should be possible to repeat the vote, with greater scrutiny.

The answer to the whole issue is exceptionally simple:

  1. You are presented with a screen where you select from among clearly labeled candidates, with an option to write in a name if that is part of your electoral system.
  2. The vote is then registered electronically, by whatever means, and a piece of paper is printed with the person’s choice of candidate, ideally in large bold letters.
  3. For an election involving multiple choices, each is likewise spelled out clearly. For instance, “I vote NO on Proposition X (flags for orphans).”
  4. The voter then checks the slip to make sure it is correct, before dropping it in a ballot box.
  5. These are treated in the standard fashion: locked, tracked, and observed before counting.
  6. The votes are tallied electronically, with a decent proportion (say, 20%) automatically verified by hand.
  7. If there is any serious discrepancy between the paper and electronic votes, all the paper ballots should be counted. Likewise, if there is a court ordered recount on the basis of other allegations of electoral irregularity.

Electronic systems have vulnerabilities including hacked polling stations; transmission interception and modification; as well as server side attacks where the data is being amalgamated. Paper systems have vulnerabilities relating to physical tampering. Maintaining both systems, as independently as possible, helps to mitigate the risks of each separately and improve the credibility of the process. It is like having both your bank and your credit card company keep separate records of your transactions. If they do not match, you have a good leg to stand on when alleging some kind of wrongdoing.

This system could use relatively simple electronic machines, and may therefore actually cost less in the long run than all paper balloting. Critically, it would maintain an unambiguous paper trail for the verification of people’s voting intentions. Companies that deny the importance of such a trail are either not thinking seriously about the integrity of the voting process or have self interested reasons for holding such a position.

[Update: 14 October 2006] The Economist has a leader on electronic voting machines and the US midterm elections. They assert, in part:

The solutions are not hard to find: a wholesale switch to paper ballots and optical scanners; more training for election officials; and open access to machine software. But it is too late for any of that this time—and that is a scandal.

Quite right.