Building An Open Source ThinkPad Battery

If you own a laptop that’s got a few years on the clock, you’ve probably contemplated getting a replacement battery for it. Which means you also know how much legitimate OEM packs cost compared to the shady eBay clones. You can often get two or three of the knock-offs for the same price as a single real battery, but they never last as long as the originals. If they even work properly at all.

Which is why [Alexander Parent] decided to take the road less traveled and scratch built a custom battery for his ThinkPad T420. By reverse engineering how the battery pack communicated with the computer, he reasoned he would be able to come up with an open source firmware that worked at least as well as what the the third party ones are running. Which from the sounds of it, wasn’t a very high bar. From a more practical standpoint, it also meant he’d be able to create a higher capacity battery pack than what was commercially available should he chose to.

A logic analyzer wired in between one of the third party batteries and a spare T420 motherboard allowed [Alexander] to capture all the SMBus chatter between the two. From there he wrote some Arduino code that would mimic a battery as a proof of concept. He was slowed down a bit by an undocumented CRC check, but in the end he was able to come up with a fairly mature firmware that even allows you to provide a custom vendor name and model number for your pack.

The code was shifted over to an ATtiny85, with a voltage divider wired up to one of the pins so it can read the pack voltage. [Alexander] says his firmware still doesn’t do a great job of reporting the actual battery capacity remaining, but it’s close enough for his purposes. He came up with a simple PCB design to hold the MCU and support components,  which eventually he plans on putting inside of a 3D printed case that actually plugs into the back of his T420.

This project is obviously still in a relatively early stage, but we’re very interested to see [Alexander] take it all the way. The ThinkPad has long been the hacker’s favorite laptop, and we can think of no machine more worthy of a fully open hardware and software battery pack.

13 thoughts on “Building An Open Source ThinkPad Battery

  1. Why would anyone use a logic analyzer to reverse-engineer the battery pack, when one needs only to look-up the BMS chip in the battery pack and find the datasheet? Usually the only thing left out of them is the password for programming them and/or programming commands for the parameters. These are locked behind an NDA. I don’t remember any of BMS chips I found in battery packs not to include information on reading them in the datasheet. Really old ones have all the information available in the DS – quite good for developing your own smart battery packs…

    1. I tried to lookup the BMS chip for my EEEPC, but they do not have the same part available. i.e. custom part The chip also relies on RAM contents which was destroyed when the battery was left uncharged for far too long. Machine needed a replacement motherboard, so by the time I got around to finding one it was too late.

      tl;dr BMS datasheet nor info is not always available publicly as it is geared toward OEM manufacturers.

    2. Actually – they all are standard. Atmel even had microcontrollers for battery applications (atmega8hva and others). with application note and all. The only thing that needs to be sniffed is battery authentication if it is used.

      Given that smartbattery tells how it should be charged and reports current to charger – this design raises all sorts of questions from me

    1. I for one have a stack of cells the size of a 2.5″ hdd and I’d like an internal ‘battery bridge’ for my X230

      I think I can tap into the dock where the ‘slice’ battery would plug in.
      And/Or just fill the regular battery void with smaller cells to net a slimmer x230 with better balance.

      Many reasons.

    2. Controller boards can fail over time. The main reason for doing this, though, is to allow people to use newer battery cells that can hold more power and take up less space. The packs that exist now are using older cells, and battery technology has improved a lot in the past few years and will continue to improve.

    3. There are quite a few reasons to bother. The controller in the battery tracks the loss of cell capacity so a simple cell replacement won’t restore it to original condition. Removing cell voltage during the change will often wipe the controller completely. As a final hurdle, many battery packs have a special fuse with four connections. Two for the usual main over current protection and two that allows the controller to heat up an internal resistor enough to blow the main fuse. This lets the controller to disconnect the pack permanently if it detects an “unsafe” condition. Of course sudden loss and restoration of cell voltage is often considered “unsafe”. There is software around to overcome these problems but only for some of the controllers and the software is often quite expensive.

      Most cheap, non-OEM replacement packs use knockoff reverse engineered controllers. They rarely implement the full suite of safety features that are found in OEM packs. I tore down a low cost replacement and an OEM pack for a Dell laptop recently. The difference was stark. The OEM pack had individual PTC fuses on each cell and a thermistor attached to the cells to monitor pack temperature The aftermarket unit had only the main fuse and appears to report the temperature of its controller IC and not the actual cells (no thermistor). So while there’s clearly plenty of profit in OEM packs unfortunately the low cost alternative carries some risk.

    4. Some ThinkPad batteries brick themselves once you disconnect the cells, so care needs to be taken ensure the chip remains powered while you remove the old cells and add the new ones. Tedious at best, and it adds a frustrating risk to the process.

    1. I was going to say this, but the linked article seems to imply that the designer knows this. You can get an ok estimate of remaining life if you do a lookup table of voltage vs. capacity rather than try to fit some straight line function. I’ve found that you can’t even really trust coulomb counters though. Many old devices go from 30% to completely dead in seconds.

  2. What about adding a battery pack via the existing charge port sitting in the CD-ROM bay but route internal connections through an SSR. so if main input is off it defaults to the charger pack.
    Might be a bit safer but not quite as tidy, if a fair condition pack is available then it can be manually rebalanced though this carries some risks its a relatively simple procedure if pack is one of the sort with cells hidden under a label.

    I looked into this for another laptop which had a battery problem, ended up rebuilding it with used tabbed cells and it lasted a while longer until someone stepped on it.

  3. Try heat conduction from the cpu paper like screensaver panels for the monitor screen and other things to make the battery self recharge for that legion 9i gaming creator laptop with that dastardly intel core i9 bloodsucker that overheats too much.

Leave a Reply to MorycCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.