BMS/power supply design for safely powering CM4 from battery?

Hi there! Do you have, or can you recommend any guides for designing battery/bms circuits for safely powering raspberry pi or similar? I’m designing a board to work with CM4 and don’t want to mess up this part. It will run entirely from battery, but will need to support charging the battery while it is running, and I’m not entirely sure where to begin with this part, as I am not overly familiar with the implications of battery SoC/voltage when it comes to powering embedded devices. Last time I did anything bms related was a number of years ago and I was part of a team.

I’m not looking for a board recommendation here, more of a starting point for designing and evaluating my own as I have a specific form factor I need to meet with my PCB :slight_smile:

So I suppose there’s really two parts to this:

  1. BMS that supports charging and discharging a Lithium battery at varying rates
  2. Safely providing power to the CM4 regardless of state of battery

Looking forward to hearing from you with any resources or direction!

3 Likes

Hey Luke,

Nice, are you running your CM from the IO board? If so, it’s actually 12V tolerant over the barrel jack so you should be able to run it off most run-of-the-mill UPS as long as they can supply the appropriate power output for the CM4 rather than setting up a rig with a battery management system and trying to customize it to suit the board.

2 Likes

Hi Bryce,

Appreciate the reply, but you’ve misunderstood my question. I am currently using the IO board, yes, but am planning a custom PCB to replace the IO board (I got the CM4 because I plan to develop with it). I have done some work with DC-DC converter design in the past but not in the context of running embedded hardware from battery, so just looking for some guidance so I don’t end up damaging the Pi :slight_smile:

My end goal is a project that will be constrained to a very tight formfactor and will be entirely battery powered, but I want to be able to also charge the battery without shutting off the compute module.

Thanks

3 Likes

I’d recommend checking out the PiJuice hat schematics as a reference:

You can generally have two setups:
First, where it’s always powered from the battery, and the charger keeps the battery topped up:

Or second, where the battery is disconnected when power is available:

There are some great IC’s available that take care of everything, eg.
https://www.microchip.com/wwwproducts/en/en027785

Which is what Adafruit use in their chargers:

Since you’re running a Pi, which is a 3.3v device, if you don’t need 5v you’re probably best to go with the former setup since it’s simper to implement. That way you just need a LDO 3.3v regulator/buck converter (though if you want to eek the last bit of life out of your batteries you’d need a buck/boost converter for when they get really flat. You’ll probably just need to pick a chip that can supply enough current to charge the battery and power the device simultaneously.

3 Likes

Hi Oliver,

First of all, thank you so much for your in depth reply. And apologies for the late response from me.

I have been looking into this and have one last question I need to solve. The option that Adafruit uses, where the battery disconnects when the usb is available- from what I’ve read this is the preferred option for battery health and efficiency. However, do you know what would happen if a higher current is needed than supplied over USB? So for example, if the Pi draws 1.8A (assume this is its maximum draw), and the USB can supply 1A (or 500mA even), will the battery continue supplying power (assuming it can supply the full 1.8A without USB) or will it disconnect and therefore the Pi will not get its needed power?

I hope this makes sense and is not too confusing to read!

Thanks mate.

2 Likes

No worries, glad I could help :slight_smile:

If that’s a concern, you should definitely go for the former option.

Else most likely what will happen is that the external supply will be overloaded so its supply voltage drops, and the switch (probably a transistor) on the battery positive won’t open fully, leading to lots of heating of the transistor and in general a bad time.

The latter option is only a good choice if you’ve got a supply that can easily provide all the power needed for the device with plenty left over to charge the battery.

3 Likes

Thanks for that. Lots to take into account! One last thing, the PiJuice schematics you referenced, do they implement the former option?

3 Likes

It uses the latter option, but it’s all taken care of within the (rather fancy) charge IC:

https://au.mouser.com/ProductDetail/Texas-Instruments/BQ24160RGET?qs=o1A9MY8yOkXeglqxxD5xeA%3D%3D

The main advantage of the latter option is instant power on with a dead battery (or even no battery). The former method is very simple, and you don’t need to worry much about how much your supply can provide as the battery will take care of any demand spikes. As long as the supply capability exceeds the average demand from the device the battery will still charge - and tbh it works fine, though you’ll probably want to include some brownout protection - safe shutdown and boot prevention for low battery.

A lot of smartphones use the first option - which you’ll notice when they get very old and get stuck in a power on loop where they need to turn on to charge, but the power demand of booting drops the voltage down and they reset (you’ll find lots of people with this issue if you google “dead battery boot loop”).

2 Likes

Hi…you need to improve your plan. BQ24075 doesn’t have a lift controller to venture up the battery voltage. The yield shifts between 5V while charging and the battery voltage when it’s anything but charging. The CM4 PMIC will trigger the undervoltage lockout and closure since you’re far beneath the base voltage it needs to run.

4 Likes

Hi Babb, welcome to the forums :slight_smile:

I haven’t checked out the BQ24075 but the BQ24161 used on the PiJuice (the one I linked above) definitely does

3 Likes