# Power solution for Raspberry Pi robot

I am building a Pi car with 4 gear motors (190-250mAh each max). Now I want to use my 10000mAh USB power bank to power up raspberry pi along with the 4 gear motors.

I can power up the raspberry pi directly but I want to use my power bank as the only source of power for the Pi Car. How can I connect both my RPi and motor controller L298N to my USB power bank?

• I believe you mean 190 - 250 mA each not mAh. – Bence Kaulics Sep 3 '16 at 19:48
• Yes you are correct :) – Tanvir Rajeev Sep 5 '16 at 14:36

I'm actually in your exact situation, and have decided to do the following:

I got a power bank with two USB outputs. I intend to connect the first output directly into the raspberry Pi, and then connect the second output to a breadboard to power the motors.

              USB 1 -> Raspberry pi
/
Power Bank
\
USB 2 -> Breadboard -> Motors


However, if my power bank just had one USB output, I would have connected it to the breadboard and powered the pi from there as well (through the 5V pin on the PI, I believe):

                                     Raspberry Pi
/
Power Bank -> USB -> Breadboard
\
Motors


PS: Remember to connect the grounds

In order to connect the USB to the breadboard, I will either cut open an old USB cable and solder the power wires to the board from directly, or look online for something premade that does this neatly for me.

PPS: I haven't tested this yet, so do it at your own risk :)

• Yes i already thought about your second option. but the problem is 5V GPIO output pins has no over voltage protection. If i do something messy this could break the pi. Do you have any suggestions on this? I mean is there any way to protect the GPIO's using diod, fuse or something? – Tanvir Rajeev Sep 5 '16 at 14:30
• You are right about the lack of protection with this solution. It is probably possible to add some protection, but I don't currently have a solution for that. – Tormod Haugene Sep 5 '16 at 14:41

I would rather use:

1. Two separate voltage sources with ground connected (5V PSU from powerbank + LiPo battery for engines)

or

1. One bigger LiPo battery with 5V regulator circuit for logic.

But if You want to use your powerbank as only energy source, yes, it is possible. However:

• Take care of proper decoupling of 5V line. I mean, check datasheet of bridge you want to use, search for recommended connection schematic and use same capacitors, or at least close to them, as described.
• In order to protect your Raspberry from overvoltage, use Zener diode, reverse polarized, rated at 5.3V. It should short-circuit supply voltage line at voltages exceeding its nominal value. It shouldn't happen, since your powerbank has already voltage regulator, but if you want to connect H-Bridge with it, I recommend using it.
• Also, I'd recommend You to use different H-bridge, like TB6612FNG. It is capable of powering engines up to 13.5V at 1.6A per channel. It is also smaller and more energy efficient than L298N.

Use a split USB cable. Something like this should work.

https://shop.pimoroni.com/products/split-microb-usb-power-cable

You might need a breakout board to run your motors if your motor driver can't take a USB source directly for power.