I don't know if it is the right forum to ask the question but I just post it here.

I have a power bank connected to my rpi b+ and I want to ask if it is in general possible to read the current load of a battery via usb. Of course every power bank is different, but maybe someone had the same problem and solved it. The reason I am asking is that on my power bank and on many different there is normally a LED which shows how much load is left in the battery, of course it is not this accurate but just to know the load would be really helpful to prevent a sudden shutdown.

Hope anybody can help me!

Maybe it is the wrong forum and someone could give me a suggestion in which forum of stackexchange or maybe on another site I should ask for advises.

Cheers Max

5 Answers 5


You won't be able to use the microUSB to interrogate the voltage as only the power lines are connected at the Pi end. The data lines are not connected.

Your best bet would be too identify the manufacturer of your power bank and google to find out if it provides a management interface (unlikely I'd say). If it has, and it has another USB output, you could interrogate the pack by plugging the other cable into a spare Pi USB socket.

  • thx, yeah I have sent an email to the company but they didn't respond yet. Thought there is an easy solution for my problem. So I think I just switch to read-only mode for the sd card.
    – Max
    Nov 24, 2014 at 1:06

USB Power banks cannot provide anything via USB because they act a a host, at least power-wise. USB protocol doesn't provide any means for end-point devices to request anything from the host, the communication always goes the other way around.

So, if your power bank doesn't provide any additional connectors besides USB-A, you can be certain it doesn't provide any info about the charge level that your RPi could use. No need to request the manufacturer about it.

Custom solutions are possible (like hooking up charge indicator LEDs to GPIO pins or exposing and measuring raw cell voltage), but details depend on how a particular power bank is made.


There is really no easy way of achieving what you are asking for. As pointed out by others, USB doesn't provide any information on battery level (or any other information really).

You would have to place an analog-to-digital circuit directly over the battery itself (inside the power bank) and feed that into the Pi via SPI/I2C/etc.

A less elegant solution would be to characterize your power bank to know for how long it lasts for every charge, then program that "remaining time" into the Pi.


You can test the Pi from the two test points on the board.

Or I have a "Charger Doctor" which has a USB socket in and one out that sits inline with the power bank or any usb device/psu to report the voltage and current alternately. They seem to be popping up in most Raspberry Pi retailers.

  • thanks but it doesn't really helps me in my case course it has to be autonomous.
    – Max
    Nov 24, 2014 at 1:07

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.