0

I want to power my Raspberry Pi 4b with a powerbank. I know that I need a 3A powerbank. The question is: How can I measure it? I want to get a percentage of it (which will be displayed over a website).

Thank you for all of your answers!

2
  • Powerbanks aren't intended for this, they are intended for recharging mobile devices which themselves already have an internal battery, and it is the internal battery they run off of. The Pi does not have this, and it is a power hog compared to most comparable (processor speed, amount of RAM) mobile devices. The big issue is that a live electronic device like the Pi requires a rapidly fluctuating level of power. A powerbank is designed for the opposite purpose (to not allow for sudden rapid current draw) and usually they perform poorly (== brown outs)...
    – goldilocks
    Commented Jul 7, 2021 at 14:58
  • ...This is exasperated by the fact that there aren't really any 5V batteries; powerbanks step up the voltage from banks of 3V batteries inside, and their actual output voltage may often be less than 5V. If you are serious about powering the pi from a battery, you should use an add-on board designed for that purpose. These also step-up voltage, but with a circuit designed to deliver instantaneous power to a live device with no other power source. You can probably also get one that can indicate the remaining charge.
    – goldilocks
    Commented Jul 7, 2021 at 14:58

2 Answers 2

1

you can make your own battery bank - what is needed:

  1. a LiPo battery 3.7V
  2. 5V charger for LiPo (it will allow to charge your LiPo as well as it will deliver power to the next stage) - output voltage of this charger varies depending on the LiPo state - from around 3V to up to 4.2V (as per the requirements of the LiPo in its charging stages)
  3. boost DC converter: it will take the voltage from the previous stage (3V-4.2V) and it will deliver constant 5V (you can regulate it usually)

ad 1. any LiPo is ok - of course provided you know for how long you would like to use battery only (to be considered: power consumption by your RPi project, capacity of your LiPo etc.). I tried with any LiPo from 600mAh (for Pico) up to 4000mAh (for other RPis) ad 2. I am using standard 1$ board from Ali, based on TP4056 chip, few variants there: USB A, C, micro. This board by default has 1A charging capacity but you can change it by altering the resistor on board as per datasheet ad 3. another cheap board from Ali based on MT3608 chip

There you have it - it works for me like a charm, total cost: 1 coffee on the street. My RPi projects rarely require more than 1.5A (for Pico based we are talking less than 100mA) so the chargers from point 1 and 3 have to be delivering the required amount of current obviously to avoid continuous undercharge of the LiPo I was in your shoes and honestly: after checking many battery banks - usually unsuccessfully (as per above comments from other members) - I decided to do it my way ;-) I am also monitoring continuously both: Vcc (the input voltage for point 1 above) and Vbat (together with the light sensor) - see below how that behaves on the graph (the deeps in blue is when I used the project without the charger - battery only): enter image description here

2
  • Your anwser was very helpful...and how do you monitor the Vcc (with a script)? :D
    – Peti Opál
    Commented Jul 9, 2021 at 18:06
  • I am measuring voltage using Pico ADC: one is connected to Vcc and one to Battery (Pico has 3 ADC exposed to GPIO pins). Then Pico sends this data using UART interface to Raspberry Zero W that is in the same box. Script on Pico is very simple: getting the data from ADC in the endless loop and broadcasting on UART. If you need the details let me know please. However, since Pico does not have real time clock, I connected also RTC DS3231 to make sure Pico's results are with proper time/date. Commented Jul 9, 2021 at 19:11
0

As already mentioned, power banks don't have adequate voltage regulation to cope with the peaky power demands on a Pi4, so you'll typically get under voltage warnings, or worse it will crash when busy, or when you start adding USB devices to your Pi. But to read the voltage of the battery you need a board that has chip that can measure this voltage and make it accessible to your Pi, usually over the I2C interface through which your software can read it and force a safe shutdown when the voltage reaches around 3v.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.