How to Power a Raspberry Pi from Rechargeable Batteries

This article covers how to power a Raspberry Pi from 6 rechargeable NiMH batteries. I’ll show you a device that I’ve used to drive robots and crittercams.

Universal Battery Eliminator Circuits (UBEC)

People who own and operate RC (radio controlled) planes, helicopters, cars and drones had a problem. They would need one high voltage battery to run motors and another battery to run lower voltage electronics. This would make the vehicle heavy which is something they wanted to avoid - especially when flying.

They wished they could still power their electronics without having to add another battery. Hence, the invention of the universal battery eliminator circuit - or UBEC for short. Essentially a small light weight circuit that converts high voltage to a lower voltage.

Don’t they have that already?

Now I know what you are going to say - this is nothing new. Any step-down 5V regulator can do that. So what is so special about a UBEC?

What makes a UBEC handy is that it comes in a nice package that is easy to put into an RC vehicle, crittercam or bot. Some even come with a ferrite core to prevent interference. All you have to do is wire one end to an input voltage, like a 6 pack of rechargeable batteries. Then just wire the 5V output on the other end to your Pi.

Where to buy an UBEC


In the US you can buy a set of two Hobbywing UBEC’s on Amazon using my affiliate link:

How to connect a UBEC to a Pi

Raspberry Pi and UBEC

The Hobbywing UBEC that I use has a 3 point connector that easily fits over pins 2, 4 and 6 on a Raspberry Pi (see: pinout guide). There is no wire going to Pin 2. The middle wire on the connector goes to Pin 4 (5V) and the black wire on the end goes to Pin 6 (GND - ground). The output wires have a ferrite iron core wrapped around them to reduce interference. You should definitely leave that on there.

UBEC Pi Diagram

If you look at the specs you will see that the input voltage can be anywhere from 5.5V - 26V - DC only. That way you can tap into the same battery used to power motors without frying your Pi.

For input to drive a Pi I would use at least 6 NiMH rechargeable batteries. Each battery produces approximately 1.2V - or approximately 7.2V. If you put a meter on your battery pack you may find this is a little higher. That’s not a problem since the input can be as high as 26V.

The UBEC’s I used have averaged an output of 5.2V. This should not be a problem for running a Pi.


When doing a search you may see BEC, UBEC and ESC all used in the same article. To go into a detailed explanation of why all these devices exist is beyond the scope of this article. All you need to know is that among the various devices built for RC vehicles, a UBEC is best suited for powering a Pi. I’ll link to a post at the end of this article if you want to know the details.


  • What are ESC, UBEC and BEC [1]
  • BCM 24 at Raspberry Pi GPIO Pinout [2]

About the Author

Mitch Allen has worked for software companies in Silicon Valley, along Boston’s Route 128 and in New York’s Silicon Alley. He currently works for a robotics company in Massachusetts.