A Power Hat for raspberry pi is a great solution if your project needs to be portable. There are ready-made solutions available on the market but they can be quite costly, some even as costly as the pi itself. In this blog we will make a cheap version of a raspberry pi power hat.
Ingredients for the Pie Power Hat
- A TP4056 board – $1/₹75
- 2X40 female header pin(long) < $1/₹75
- Switch, JST socket and wires < $1/₹75
- Prototype board 60X55mm < $1/₹75
- A 3.7-4.2V lithium ion battery < $6/₹500
Note that the TP4056 has the rating 5V and 1A. However, the underpowered sign might still show up on the raspberry pi. Make sure that you don’t put a lot of load on the PI GPIOs. You might end up frying the TP4056. It is possible that you might not find a 2X40 (long)female header pin in your local market(For some reason they are always out of stock), if you decide on using a 10X1(long) headers instead, make sure that you sand down the header on one side(not too much or the metal part of header might fall off). You can also use a smaller prototype board if your batter is relatively smaller and you are confident you won’t have any issues soldering on a smaller board.
- Solder the header pin to the board. For this, solder two pins at each end of the header box. Check whether the header box is precisely perpendicular to the prototype board. If no then adjust while heating the solder points. If yes then solder the rest of the pins.
- On the other end of the prototype board solder a JST socket.
3. Between the JST socket and header pin box insert solder the TP4056 using it’s “IN+/IN-” pins. This will only to keep the TP4056 in place.
4. On the opposite side of the header pin solder a switch of your liking,(If I had a good small switch I would have used that instead). Just make sure you nothing peeks out on the other side of the proto board, as we don’t want anything sharp near the Lithium Ion Battery.
5 Solder connections using small wires according to the following diagram. For soldering wires to the header pins, flip the board and solder on the pin sides of the Power hat. Make sure all the wires are close to the prototype board and not sticking out as they might touch the components on the pi when you put the Hat on your raspberry pi.
6. (Optional) Solder male header pin to the board(along the board not through) for additional components that might need power. Like an audio module. Just make sure it doesn’t require a lot of current. connect these header pins to OUT+/- pins of TP4056.
7. (Optional) Make a housing for the battery on the board itself. If your application is going to go through a lot of wear and tear it is recommended that you create a housing for the battery aswell to keep it away from anything sharp.
- Although TP4056 is rated 5V/1A, the Pi might still show that it is under-powered. If you don’t draw much current from the Pie You will do just fine. I used it with a waveshare knock off 3.2 LCD display+arduino pro micro usb gamepad just without any issues. But when I plug in a phone, the pi switches off.
- It would be good if your battery has an internal protection board to prevent over discharge. As you can see this doesn’t have any way of telling how much charge is left in the battery. So you might have to do some calculations on the rating of your battery and how long it lasts with your application.
- If you draw too much current the protection board on the battery or the TP4056 might get fried.
- When buying the TP4056 module do lookout for if the board has the “OUT” pins aswell. There are variants available which are only used to charge a battery.