Close
0%
0%

LiFePO4wered/Pi+

Next Gen LiFePO4 battery / UPS / power manager for Raspberry Pi, ideal for headless and IoT use

Similar projects worth following
Many IoT and other projects are based on the Raspberry Pi, but usually little thought is given to the power supply. Most project use generic cell phone adapters or USB power banks, which is fine for one-off projects where the duct taped parts and cabling don't matter and it's expected that SD cards will die because power was removed with the Pi running.

But when you need reliable non-stop operation for your prototypes, or you're ready to turn your project into a good looking product, or you want to use different power sources such as solar, it's time to look for a serious power manager for your Pi.

Built on the solid foundation of the #LiFePO4wered/Pi, this project provides Pi bootup and shutdown management based on button or touch, input voltage, battery voltage and time, all while making sure the Pi always performs a clean shutdown before power is removed.
In addition it provides significantly higher power, RTC functionality, Pi current measurement and imp

It was a hard decision to start from scratch with a new project for this next gen effort since the #LiFePO4wered/Pi project has such good traction and a gazillion likes, but the more I thought about it, the more I realized that starting with a clean slate would allow me the freedom to make this what people want it to be instead of feeling shackled by legacy, and at the same time prevent confusion about the different generations. A new project also allows me to enter it for the 2017 Hackaday Prize. :)

There are some issues with the current #LiFePO4wered/Pi design that I hope to address in this Next Gen effort:

1. Make it easier to assemble. The two-PCB arrangement with the charger on the bottom and power manager on top makes for a nice and compact unit, but it takes too much time to assemble. The original design sprang from a desire to provide an example application for the #LiFePO4wered/USB, but the #LiFePO4wered/Pi has turned out to be a much more popular product in its own right. So this will be a single-board setup with the charger and power manager both on one PCB, significantly reducing assembly time and cost. It is the best way to reduce cost and support higher volume.

2. Alleviate power limitations due to physical size. Power supplies unfortunately generate quadratically more waste heat as the current goes up (P = I^2 * R), and the tiny PCBs in the current design have a hard time sinking this heat away. Customers always want more power, but recent experiments with higher power on the current physical design have convinced me that the only way to allow more power is a bigger PCB with more copper.

3. Improve hackability. For a product targeted at hardware hackers, the current design is not the most hacker friendly, mostly because there is very little room due to the small size. Customers want to connect different power sources, have the on/off button and LED remotely located, etc. The current design has some tiny surface mount pads to allow such things, but decent sized through-hole pads and more configuration and customization options would definitely be welcome.

4. Make load current independent of charge current. Some people don't need a big battery for long untethered run time, they just want a little bit of juice, enough to shut the system down safely when external power fails. But in the current design, maximum UPS load current is linked with charge current, which in turn dictates battery size. I hope to separate these two concerns and provide high load current with a small battery as well.

5. Improve physical stability. This isn't usually a problem, but the current mounting method with one screw and the weight of the battery supported on the 4-pin connector between the boards is not ideal. I plan to use a 40-pin header and connect to at least 2 screw holes.

So here is my current plan to make this happen:

  • Start with a Pi Zero-sized PCB, extended past the GPIO header so the battery can still sit next to the Pi, but upside-down. Have one PCB design that can accommodate both the 14500 and 18650 cells. The 18650 will be located more forward than in the current design, making sure it doesn't stick out farther than the USB ports on a Model B+ any more.
  • The circuitry will be over the Raspberry Pi as is the case for most HATs. The components will be mounted on the bottom of the PCB, with only the on/off button (mechanical switch) and LEDs mounted on top. Most of the top of the PCB will be copper plane for heat sinking, on which an additional heat sink can be mounted if deemed necessary for high power applications.
  • There will be through holes for remote on/off button and LEDs, to easily connect input power other than USB, give access to 3.2V battery power and switched 5V output power, connect external LiFePO4 cells and loads, and adjust the charger's MPP for use with solar panels.

Anything I've missed? Comments and requests are not only welcome but highly encouraged!

  • It's alive!

    Patrick Van Oosterwijck05/19/2017 at 23:35 0 comments

    After hacking on firmware for the past two weeks, I'm happy to report that the prototypes are working!

    Here are my two protos: running a Pi 3 and a Pi Zero W:

    The prototype in the back uses a 18650 LiFePO4 battery and stackable header, the one in the front uses a 14500 (AA) LiFePO4 battery and normal header. To remove the excess PCB used for the bigger battery from the unit with the smaller battery, I had added perforations to the PCB, but I was worried that the copper foil might peel when breaking it off. I decided to see what would happen with and without scoring with a knife, so I scored only part of the perforated area. Here's the result:

    The section of PCB broke off very clean, and I honestly cannot see any difference between the part that I had scored and the part that I hadn't. Very good news! I'll have to see what happens when breaking off the bigger section when I'm ready to build a prototype with external battery.

    On the firmware side, I worked on the following:

    • Different pin assignments since I had to switch to a 20-pin package to accommodate an extra signal and had run out of pins.
    • The extra signal allows measuring the Raspberry Pi current consumption.
    • Separate single point calibration values for VIN, VBAT, VOUT and IOUT instead of a single calibration value based on VBAT. Since the range of VIN is now huge (24V) compared to the range of VBAT (5V), the single calibration value wasn't working well.
    • Added shadow buffering to the I2C driver. This allows atomic read and write of multi-byte values to prevent race conditions, and will be very important when implementing RTC functionality.
    • Timeouts for boot and shutdown phases. At the moment they are hard coded to 5 minutes for boot and 2 minutes for shutdown, but the idea is that they will be settable in 10 s increments. This improves behavior when the Pi is not present or unresponsive.
    • Support for mechanical switch (default for LiFePO4wered/Pi+) in addition to capacitive touch. As you can see in the pictures, the prototypes have a side-facing switch as well as a top-facing one. The side-facing will likely be standard and the top-facing an option. There are also pads to connect an external button or cap touch pad.
    • Improvements to reduce power consumption when off (still monitoring voltages and button), around 3uA now. Initially I had a problem where the current was ~80uA if the Pi wasn't connected.

    Once functional, I could do some preliminary testing, and things look promising:

    • With a Pi 3 running at 100% on 4 cores (~950 mA), the board was warm but not hot. This is promising for extra power capability!
    • The split sense resistor scheme to allow much higher load current than charge current seems to work! The prototype with the small battery was able to power a Pi 3 @ 100% while also charging the battery quickly, but not above its rating when under low load.
    • The 40-pin header with 2 screws seems to be mechanically solid.

    Next I'll need to do more detailed high-power testing to see where the limits are. I still need to add registers to set the boot and shutdown timeouts and implement RTC functionality.

  • First prototype build

    Patrick Van Oosterwijck05/08/2017 at 23:53 0 comments

    I decided to build up my first prototypes of the LiFePO4wered/Pi+ today. Since I wanted to do all 3 boards I received from OSH Park, and there are quite a lot of components, I figured using solder paste and reflow was the way to go instead of manual soldering.

    I had not ordered a stencil so I used the laser cutter at the Tinkermill to cut my own stencil from plastic film. It never turns out as well as the professional ones you can buy, but it's free and usable. :) Below is a picture of the stencil over a bare PCB:

    Time to apply solder paste:

    The result with the stencil removed is fairly decent, even for the tiny and weird TPS61236P boost converter pads:

    I decided to paste all 3 boards and then build them up in batch:

    The disadvantage of doing this is that the paste tends to dry out during the long build. Placing the components took around 2 hours and the paste was definitely getting dry, but it seems to have had no ill effect. Here are the boards with all components placed except the inductors:

    And here's a closer shot, ready to go into the reflow oven:

    Here's the first board after reflow:

    Looking good! :) Even the TPS61236P connections seem to have soldered fine. I was a little worried because the stencil wasn't exactly accurate for those tiny pads.

    Here are all three boards done:

    I still need to add the LEDs on the other side of the boards, and maybe a top button. As you can see, there is a side-facing button already on the boards but I want to evaluate different options such as side-facing and up-facing. I also need to add the 40-pin GPIO headers and battery holders.

    Then I need to take the existing #LiFePO4wered/Pi firmware package and port it to this new platform. This new design needed more pins than were available on the micro I was using before, so I'm using a different part from the same family and some pin assignments have changed. Plus, I need the firmware to sample a physical button instead of a touch button and use the 32kHz crystal instead of the internal RC oscillator.

  • First prototype layout

    Patrick Van Oosterwijck04/17/2017 at 23:49 0 comments

    My prototype layout is done!

    Some OSH Park renderings below:

    All in all I'm pleased with the result. It was harder than expected to cram it all in, especially the larger (higher current + lower cost) inductors take up a lot of space. This board has the following features:

    • Micro USB or through hole 0.1" connections for VIN. Voltages up to 15V should be supported, making it possible to hopefully power this directly from 12V car power or a <15V Voc solar panel.
    • Footprint for 3 types of tactile buttons, two on top and one side facing. The idea is to evaluate different button options (only one would be populated). There are also 0.1" connections for an external button. The firmware will likely still support capacitive touch for the external button, but not on the PCB itself, and a mechanical button will be the default. This will likely reduce quiescent current as well below the current <4uA.
    • The charge and power LED are right by the micro USB and button, making the user interface nice and concentrated on one side. There are also 0.1" connections to connect external LEDs if desired.
    • MPP voltage is adjustable by adding a resistor to the 0.1" MPP connections. 4.65V by default for USB use, but if you use solar you can customize this now.
    • Switched 5V output to the Pi (hopefully 2A+) is also available on 0.1" connections to drive external load like a screen.
    • The PCB has break-off areas to accommodate either a 14500 (AA) or a 18650 size battery holder, or they can be broken off completely and a battery can be attached to 0.1" connections. Without the battery holder extensions, the PCB is Pi Zero size. The break-off quality is not tested yet and to be evaluated.
    • A solder jumper is available to configure either 0.55A (14500 battery) or 1.5A (18650 battery) charge current. The current sense resistor is split to try and implement the higher-load-than-charge current system described in the previous log.
    • A solder jumper is available to reduce the output voltage from 5V to 4.25V. The Pi and many peripherals can run at lower voltage and it makes the power system (on both the LiFePO4wered/Pi+ and Raspberry Pi) more efficient.
    • An external 0.1" connection for VBAT is available for loads through a 1.5A resettable fuse, but if you use this you need to make sure to manage low battery conditions yourself and draw very little power when the system is off! If loads connected to this are switched from Pi GPIO outputs, it should be fine because they should turn off when the Pi is turned off. But mind the quiescent current, discharging the battery too much will kill it!
    • With the new boost converter it should be possible to measure the 5V load current to the Pi and read it over I2C!
    • Footprints for several types of 32kHz crystal are present, to implement RTC functionality.
    • An EEPROM is present to implement the HAT spec! (Although the physical shape still won't meet the spec.) Hopefully this will result in easier software setup in the future.

  • Experiments on current LiFePO4wered/Pi

    Patrick Van Oosterwijck04/04/2017 at 18:38 0 comments

    Since electrically this project is an offshoot and/or combination of the #LiFePO4wered/Pi and #LiFePO4wered/18650 projects, the current hardware I already have makes a good platform to do experiments on.

    In fact, one of my recent experiments, which now really belongs here more than on the LiFePO4wered/Pi project page, was already documented in this LiFePO4wered/Pi project log. I was testing the TI TPS71235P, a new high power boost converter I intend to use for this project. In fact, now that I will be having enough space for a resistive divider to set the output voltage, I intend to use the TPS71236P instead, which will allow me to configure the output voltage myself instead of using a fixed 5.1V. Since efficiency and current capability get better when there is less difference between the input and output voltage, I want to have a default output of 5V but provide a solder jumper that allows the user to reduce the voltage to 4V for more efficient operation if their system allows it.

    In the current physical form factor of the LiFePO4wered/Pi, the booster was able to support a continuous current of 1.6A at 5.1V, and as this thermal image shows, the inability to shed heat was the limiting factor that made the thermal protection kick in at higher currents:

    The image clearly shows that the heat stays very concentrated in the little PCB. My hope is that with the LiFePO4wered/Pi+ going to a larger PCB with 2 oz copper, this heat can be sinked away from the chip more effectively and I hope to be able to support at least 2A continuous output current.

    Another goal for the LiFePO4wered/Pi+ is to make the maximum load current independent of the charge current. To do this, I intend to split the current sense resistor on the charger and connect the load to the midpoint. By choosing the right resistor values, the charge current can be limited to a safe value for the battery while the load can pull significantly higher current directly from the power source. The principle is demonstrated in the graph below:

    In this case for the 14500 cell, the charge current under no load is about 550 mA, but as the load current increases, the total current pulled from the input goes up to accommodate the load. As the load current gets higher, it takes more and more from the input until eventually at 3A there is no charge current left for the cell and the cell will start to provide current instead.

    You may have noted that I'm designing the charger for 3A instead of the 2A that I mentioned above for the load current. This is because the boost converter trades current for voltage, so that even with ideal components and no losses, a load current of 2A at 5V requires an input current of 3.33A at 3V. So I really should go for a higher current than 3A for the charger, but the test below was done at 3A charge current and has me worried to go any higher:

    The problem is that the charger uses an asynchronous buck design and the Schottky diode always drops around 0.5V at high current, making it dissipate a lot of power. I need to see what temperatures I get on a bigger PCB before I start thinking about pushing the charger current any higher. I may also need to see if I can find a synchronous charger instead, but it's hard to beat the CN3801 I use currently on value.

    Also, the CN3801 is not a low leakage chip, and leaks quite a lot of current from the battery when it's not charging. That's why I currently use a MOSFET to disconnect the battery from the charger when it's not being charged, similar to what can be seen in the #LiFePO4wered/Solar1 schematic (Q4), which reduces the leakage to less than I can measure (<1uA). The problem is that the current topology doesn't work with the split current sense resistor scheme described above. So I need to disconnect the battery differently.

    I did an experiment yesterday with moving the MOSFET up to right after the inductor instead:

    Hackish, but it did the job well enough to test the concept. :) This reduced the leakage from 100+uA (with no battery...

    Read more »

View all 4 project logs

Enjoy this project?

Share

Discussions

Magnus Eriksson wrote a day ago point

Hi. Patrick Van Oosterwijck
It looks very interesting.
I wonder if I can buy 2 pieces of LiFePO4wered / Pi
Then I'm building a bit of a Rasberry pi 3 type that I'll have in my vehicles
I am also interested in being able to drive them with solar cells.
I'm most interested in the model with 18650 cells.
Sincerely
Magnus Eriksson

  Are you sure? yes | no

doubleodoug wrote 2 days ago point

Could you post your schematics? Ideally as pdf. I would really appreciate it.

  Are you sure? yes | no

x893 wrote 2 days ago point

Super project !!!

Can you publish schematics for LiFe.../Pi+ ?

  Are you sure? yes | no

denplis wrote 05/11/2017 at 19:53 point

Could it be possible to use a few 18650 cells ?

  Are you sure? yes | no

oshpark wrote 05/09/2017 at 18:45 point

Awesome project!

  Are you sure? yes | no

SlumberMachine wrote 04/06/2017 at 23:40 point

Looking forward to your progress.  I have 2 of your lifepo4weredpi and they have been working great for me.  They even helped me detect and deal with a bad charger I had received by safely shutting down the pi because the usb charger was giving intermittent power (also started smelling like burnt plastic).  Probably would have cost me some corrupted SD cards if it wasn't for your lifepo4weredpi.  BTW - I'm using it for a time lapse setup which I leave connected to usb battery bank. 

  Are you sure? yes | no

Patrick Van Oosterwijck wrote 04/30/2017 at 20:56 point

Thanks for the feedback and glad to hear the LiFePO4wered/Pi are working well for you, I always enjoy hearing how people are using them. :)

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates