Introduction: USB External Battery Packs on Arduino Turns OFF!
I've purchased a couple large battery packs (rated at a questionably high 20,000mah) for $20. Because they are inexpensive, they have cheap inexpensive electronic controls and the Arduino does not require enough power to keep the USB battery ON..... so the battery automatically turns OFF after a few seconds. :(
Paul Stoffregen posted this solution on pdxdorkbot and I'm just reposting with my results,
The solution is to use the Arduino to pulse power to a transistor that dumps a large amount of current (~250ma) for a short period of time. I found 50ms every 5 seconds was sufficient to keep the battery ON. That equates to a duty cycle of 1% or 2.5ma. Not great but better than turning OFF when you need it to stay on.
I've tried this on an Arduino Uno and Teensy 2.0.
Paul Stoffregen goes onto to include a nice little analog circuit you can make using a few capacitors and then do without the digital output from your microcontroller.
Here's my parts list.
-20 ohm (1/4 watt) resistor
- mosfet rated at 250ma (although you could use just about any mosfet or transistor here)
- 10k resistor to connect the Gate to Ground (so the mosfet doesn't wonder)
Here is the Arduino code:
/*
Battey ON.
Used 50ms every 5 seconds across a 20-ohm resistor.
*/
int led = 13;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH);
delay(50);
digitalWrite(led, LOW);
delay(5000);
}
Paul Stoffregen posted this solution on pdxdorkbot and I'm just reposting with my results,
The solution is to use the Arduino to pulse power to a transistor that dumps a large amount of current (~250ma) for a short period of time. I found 50ms every 5 seconds was sufficient to keep the battery ON. That equates to a duty cycle of 1% or 2.5ma. Not great but better than turning OFF when you need it to stay on.
I've tried this on an Arduino Uno and Teensy 2.0.
Paul Stoffregen goes onto to include a nice little analog circuit you can make using a few capacitors and then do without the digital output from your microcontroller.
Here's my parts list.
-20 ohm (1/4 watt) resistor
- mosfet rated at 250ma (although you could use just about any mosfet or transistor here)
- 10k resistor to connect the Gate to Ground (so the mosfet doesn't wonder)
Here is the Arduino code:
/*
Battey ON.
Used 50ms every 5 seconds across a 20-ohm resistor.
*/
int led = 13;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, HIGH);
delay(50);
digitalWrite(led, LOW);
delay(5000);
}