The Raspberry Pi single board computer is awesome at what it does, but it requires a lot of power to do so. I think we've all been there - the Raspberry Pi isn't exactly the easiest thing to supply power to, as it's power draw fluctuates a lot, which basically makes powering it on the go impossible. In addition, several cables are needed to power to the Raspberry Pi. making it very immobile.

To solve this common problem with all Raspberry Pi's, I designed, prototyped, and engineered a mobile "Raspberry Pi Battery Pack", called the "Raspberry Pi PowerHAT"! It combines power management circuitry, a LiPo Battery charging circuit, and a Buck/Boost converter for external power supplies, such as a solar panel, to make an all-in-one Raspberry Pi PowerHAT. It has 5 different power input settings, while keeping a small form factor, to keep it portable, and can be powered with almost any power source, between 3 and 12 volts.

Keep reading to learn how you can obtain a FREE PDF version of this Instructable, a special FREE Raspberry Pi Power Patch, and a FREE 3-Month Pro Membership!!!
If you like (or hate) this Instructable, please vote for it in one or all of the selected contests!

Step 1: (Hand) Tools and Materials

Here are the materials and tools that you will need to complete this project. Each resource is a clickable link.
PDF files of the schematic and breadboard connections are made available, below.
Be sure to take advantage of the FREE PDF of this Instructable!

Before building and prototyping the circuit, we'll start off with sizing the headers included with the breakout boards, to the desired length, to fit the breakout boards. This can be done by using wire cutters, or angle cutters. Once you've completed that, insert the headers into a breadboard, and place the boards on top of the headers. Solder as normal, and be sure to check the straightness of the board.

Do the same with the Raspberry Pi HAT, but replace the breadboard with the Raspberry Pi. Stack the header on top of the Raspberry Pi, and place the HAT on top of the header. Make sure the board is straight! If there is any ugly solder flux left over on the board, now would be a good time to remove that by soaking the board in isopropyl alcohol.

Step 3: Prototype The Circuit

It's always a good idea to prototype and test all functions of the circuit, before soldering the components into the final layout. Use the schematic for reference to prototype the circuit on a breadboard. Use solid core prototyping wire of different colors to make circuit troubleshooting quick and simple. Two versions of the schematic are available above; a true schematic, and a visual wiring diagram.

The circuit has many power functions, so be sure to test all of them:

Power the Raspberry Pi with a LiPo Battery Only

Power the Raspberry Pi with a Micro USB Cable Only

Power the Raspberry Pi with an External Power Source Only

Charge the LiPo Battery and Power the Raspberry Pi with a Micro USB Cable Only

Charge the LiPo Battery and Power the Raspberry Pi with an External Power Source Only

The external power source can be any voltage from 3-12V and should be at least 500mA.

Step 4: Build It!

Start off by laying out the screw terminal, header, and switches on the Raspberry Pi HAT, as shown above. It is very important that you get these parts in the correct spots and orientation, or the other parts will not fit! Follow the first picture above, closely, for reference!

Once you have laid out all the components, carefully solder on the components, trimming the leads when done. Again, use the pictures for reference!

Step 5: Build It! Cont'd.

Next, we're going to add the Buck/Boost converter board to the HAT. Start by taking out the 2nd header pin (this is connected to the ENable pin), using a soldering iron and needle nose pliers. Insert the board into the HAT, on the back side of the board, in the correct orientation shown. The removed header pin should be above the cut-out on the HAT, for the Raspberry Pi Camera cable. Flip the HAT over and solder the pins to the board, trimming the leads once done.

Step 6: Wire It!

First off, we're going to wire the 5V output to the +5V rail, with a diode. The Raspberry Pi HAT is setup in a breadboard format, which makes everything easy to wire. Connect the diode to the last pin of the PowerBoost header, and the other pin to a hole on the +5V rail. Trim the leads when finished. The stripe on the diode should be closer to the pin entering the +5V rail. Check the pictures for reference.

Next, connect a solid core wire (preferably white in color) from the 4th pin of the PowerBoost header to the leftmost pin of the main power switch (in back of front switch). Connect another solid core wire (preferably black in color) from any pin on the GND rail (closest to the +5V rail), to the center pin of the main power switch. Cut the leads when done. Use the pictures for guidance.

Step 7: Wire It! Cont'd.

Before wiring any other parts of the circuit, it is a good idea to identify the positive and negative sides of the screw terminal block. The leftmost terminal should be positive (red in color) and the right is negative (black in color). I later went back and added + and - symbols on the HAT. Use the pictures to help color yours.

After identifying the terminals, we're going to wire together all the power inputs and outputs. The explanation below can be confusing at times, so refer to the schematic and wiring diagram for reference. Start by wiring the screw terminal pins to the corresponding pins on the Buck/Boost converter board (back side). Use a red solid core wire to connect the positive terminal to the VIN (voltage in)pin, on the bottom of the Raspberry Pi HAT. Do the same for both ground pins (on both the screw terminal and the Buck.Boost converter board), using black solid core wire, on the back of the HAT. Trim leads when done. These GND pins should both be connected to the GND rail, near the +5V rail.

Now, we'll wire the output of the Buck/Boost converter board to the second switch (external power switch), and then to the PowerBoost board. Use a piece of red solid core wire to connect the 5V pin on the Buck/Boost converter board to the rightmost pin (looking from back side) on the external power switch (front switch). Looking from the back side again, connect a red solid core wire from the center pin of the external power switch, to the USB input pin on the PowerBoost board (first pin on header). You will have to solder the wire in back of the header (1st pin, top view). Again, use the pictures and schematic for reference.

Lastly, connect a black solid core wire from the 5th header pin (top view) to a hole on the GND rail (near the +5V rail). Before moving on; it is a good idea to test that this circuit completes all functions properly. Troubleshoot (if needed) using the pictures, schematic, and wiring diagram.

If you would like to make switch identification easier, it is a good idea to add labels to the front, external power switch, as I have done in the pictures above. After testing the on/off positions of the switch, add the labels accordingly.

Step 8: Finish It!

Before using your Raspberry Pi PowerHAT, we need to secure the battery and PowerBoost board with foam tape.

To secure the LiPo Battery, size and cut a piece of double-sided foam sticky tape to fit on the bottom of the LiPo Battery. Peel off one side of the foam tape, and adhere it to the back (side without lettering) of the LiPo Battery. Peel off the other side of the foam tape and place the LiPo Battery on the HAT, using the pictures for placement guiding.

After doing that, take the PowerBoost board, and make a double-piece thickpiece of foam tape, to fit on the back (side with no components and almost all lettering) of the PowerBoost board. Peel off one side of the tape, and adhere it to the back of the PowerBoost board. Peel off the other side of the foam tape, and insert the board into the headers, so the tape will make a sandwich between the LiPo Battery and the PowerBoost board.

Finally, plug in the LiPo Battery into the mating JST connector on the PowerBoost board. Wrap the wires around, to the back side of the board, and tuck the extra length under the Buck/Boost converter board.

Step 9: All Done!

Before testing it with your Raspberry Pi, it is a good idea to test all the functions of the Raspberry Pi PowerHAT, confirming the output is always ~5.2V, with a multimeter.

Now, there are many different ways you can power your Raspberry Pi!

Power the Raspberry Pi with a LiPo Battery Only

Power the Raspberry Pi with a Micro USB Cable Only

Power the Raspberry Pi with an External Power Source Only

Charge the LiPo Battery and Power the Raspberry Pi with a Micro USB Cable Only

Charge the LiPo Battery and Power the Raspberry Pi with an External Power Source Only

The "external power source" could be anything. From anything as simple asanother battery, or more advanced power generation methods, such as athermoelectric generator, a solar cell, a wind turbine, a motor in reverse, and even a hydrogen fuel cell! The possibilities for powering a Raspberry Pi are now endless, making Raspberry Pi projects more advanced and portable!