I am making a robot with arduino mega r3. I want to power the arduino with a usb power bank. How should I do that?
I have a "USB power bank" with two USB ports, which I use to power some projects.
I have discovered that my bank (i.e. your mileage may vary!) shuts off unless my project draws at least 50mA. If your project does draw at least that at ALL times, you should just be able to plug a USB cable directly from the powerbank to the project.
For some other projects, I have bought a USB cable (USB A to USB A) which I cut in half, stripped the wires, then used a multimeter set to "Volts" to work out which wire was +5V and which was GND; I connect these straight to the 5V/GND on my project. To make sure at least 50mA was drawn at all times, I put a 100 Ohm resistor from +5V to GND (at LEAST 1/4 watt!!). This obviously wastes a lot of power (turning it into 1/4 watt of heat), but it keeps the power bank "awake". By using a USB A to USB A, I now have two cables.
My power bank also has a "torch" (led) integrated; if the torch is on, it also stays awake.
Powerbank is a term for those external batteries that output USB. Usually used to recharge a phone when you don't have access to wall outlet and USB charger.
Battery (3.7v) --- Some Circuit --- USB female
You have a bank
You have USB cable
Plug USB to Arduino and you are (pretty much) done.
For those who use ProMini and/or want to skip the USB port
Cut the USB cable and take the red (+) and black (-).
Put it directly to Vin and Gnd and you are good to go.
Unfortunately for us (fortunately for most) most Powerbank has auto-shutoff where it will shut off the power if there's no load (usually ~50mA, vary with every brand). Since Arduino may not draw that much, the battery thinks it is not connected to anything.. thus it will auto-shutoff after a while
I found this trick helps (a lot!! thank you!):
Not clear what a usb power bank is. I assume you actually have a battery, perhaps with a regulator. The data sheet http://www.arduino.cc/en/Main/arduinoBoardMega at says: Microcontroller ATmega1280 Operating Voltage 5V Input Voltage (recommended) 7-12V Input Voltage (limits) 6-20V Digital I/O Pins 54 (of which 15 provide PWM output) Analog Input Pins 16 DC Current per I/O Pin 40 mA DC Current for 3.3V Pin 50 mA
The Arduino Mega can be powered via the USB connection or with an external power supply. The power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
If you use the usb connector, use the correct pins an make sure you have it regulated to 5 volts.
I think this answers the question, if not please comment.