Laptop With Raspberry Pi Inside Learns To Speak Battery

Early in November we took a look at a one of the best Raspberry Pi laptops we had ever seen, using the shell of a Sony VAIO. Laptops used to be hulking beasts, and that played into [Frank Adams’] hands as he got rid of the motherboard and had enough space to replace it with a Raspberry Pi and a few other support boards. This took advantage of the laptop’s screen, keyboard, LEDs, etc. But what’s a laptop without battery power? [Frank] hadn’t cracked that nut until now.

Inside of Sony VAIO laptop turned Raspberry Pi computer
VAIO battery and charging PCB seen to lower left

Adding battery power is trickier that it sounds, but [Frank] managed to get the Raspberry Pi to talk to the original Sony VAIO internal battery. His work on the project is shared, but this part of the story is best found starting on page 29 of his PDF project details.

Using the original battery is a good move since it’s designed to fit and has a charger ready to interface with the port on the laptop case. But these batteries have logic inside them, and there’s the rub. Communications use the 2-wire System Management Bus (SMBus) which is well documented. But the when trying to use the Pi’s I2C [Frank] couldn’t figure out to send a repeated start command.

He ended up writing his own C program that bit-bangs the communications he needed and now has the Pi speaking to the battery and listening to what it hears coming back. Reading through his description of this is fun since he includes his observations from a logic analyzer captures. He suspects an occasional bad read is due to Linux interrupting code execution. He watches for and catches these bad reads in software and can now reliably read all the battery vitals.

The hack leaves him with a system that functions in much the same way the original computer did: plug it in and it charges. He did add some hardware that lets him take a voltage reading from the battery using an ADC on the Teensy that was already present to control the keyboard and case LEDs. This adds a small constant draw on the battery, but for now he doesn’t leave the battery connected when the laptop is not in use.

If you’d like to read our original coverage of this laptop, here it is.

6 thoughts on “Laptop With Raspberry Pi Inside Learns To Speak Battery

  1. >But the when trying to use the Pi’s I2C [Frank] couldn’t figure out to send a repeated start command.

    Blegh. Peripherals. You’d think something like the Raspberry Pi would have this sort of thing worked out, but you never know where you’ll find quirks and small hardware errata. It seems like it’s always the peripherals where those end up.

    Hey, does this sound familiar? “Errata: In order to , must be set.”

  2. It funny But it does seam like The I2c,SPI and all the other special I/Os systems all have major Problems.
    You would think that they would be working by now.
    Me my self I really like using I2C. But on the PI it is a real pain in the behind. one way or another.

    Nice work here. I will be looking more closely at what you did with the I/O’s to get them to work better.
    I was think of using a DAC interface for voltage readings as well, But I had the same problem of it eating up battery power as well.

  3. Why? The Pi is not designed or advertised as a mobile platform. My desktop computer doesn’t have the hardware to read the state of an attached battery either, but I wouldn’t expect it to either.

    When you’re selling these things for as low as $5, adding unnecessary chipsets/hardware is simply a no-go.

Leave a 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.