Go Down

Topic: Powering Arduino from a power bank (Read 50781 times) previous topic - next topic

adwsystems

#15
Feb 27, 2018, 07:02 pm Last Edit: Feb 27, 2018, 10:20 pm by adwsystems
Heading along the same path as septillion. What is the difference between a power bank and lithium ion battery and a USB charger with a voltage boost circuit (such as https://www.adafruit.com/product/2465)?

Zotya

You don't need external circuit, you can use your Arduino itself for keeping the power bank running. Just put a 22R resistor between 5V of USB in and a pin (e.g. 1C) of ULN2803. Then supply signal to pin 1B of ULN2803 from Arduino for 250 ms in every 5 sec. This signal "sinks" the current provided by the power bank through the resistor. For me this configuration is working fine.

So the only external component you need is the resistor and a ULN2803. You can set the optimal timing of the signal in the sketch to find the minimal power consumption which still keeps the power bank running.

tduffett

To keep it real simple, I added an LED & resistor to my circuit off to the side and it apparently draws enough to avoid the auto shut off problem. Obviously uses constant power so depending on your application this may or may not be optimal.

Paul__B

look at it this way - would you think of taking a battery charger, solder cables to it's positive and negative terminals, and then try to power something with it?
Don't know about soldering cables, but using the clips, I use one to test motors and stuff and to run my tyre pump.   :smiley-lol:

plobit

I've found a very simple solution, that works at least with my power bank (Silicon Power SP power S105, sold by Costco).
This power bank does not switch off when it is being charged (through the micro-usb plug).
So, I just make it believe it is being charged by supplying 5V to the power pin of the micro-usb cable... Since connecting directly the micro-usb input to the other usb output or the 5V pin of the arduino would draw a lot of current (charging the power bank with its own power output!), I connected a 27 ohm resistor in between (I've not tried with higher values for smaller current yet).
It worked: no switching off for a whole afternoon and night while running an arduino uno measuring a chinese calliper, and very little power wasted. On the other hand, I had no luck with the pulsed load solution with my power bank...

pallen33

Hi all. Found this one which is mentioned which seems to do exactly what people need: https://www.voltaicsystems.com/always-on

Paul

Pugwash

#21
Dec 21, 2018, 12:54 pm Last Edit: Dec 21, 2018, 12:57 pm by Pugwash
I had the same problem but solved it with a 555 timer and 3906 PNP transistor, this circuit draws about 200 mA for 1.6 seconds every 13 seconds, but you have to experiment a bit with the main capacitor and the resistors on the timer side of the 555 chip, because these power packs have different cut-off current settings.

See the website for the circuit diagram.

https://www.instructables.com/id/Current-Pulsing-Keeps-Power-Bank-Active/


It works fine for me!

6v6gt

This seems to be a recurring theme here. I guess the search does not yield clear enough results:


https://forum.arduino.cc/index.php?topic=497195.0
https://forum.arduino.cc/index.php?topic=298552.0
https://forum.arduino.cc/index.php?topic=307935.0

Keywords:
Arduino
Power Bank
Suppress Power Bank Auto Shut Off
Stop unwanted power down
Inhibit power down of UBS battery

Pugwash

I wanted to see exactly what was happening so I hooked up my antique oscilloscope, after replacing the 47f cap with a 470pf cap to get a constant trace (see attached picture) and it shows the cycles being produced by the circuit mentioned above, just faster.

I picked up a 19000mAh powerpack for 20 Euros at Conrad Electronic, but similar to my other powerpack it is sealed. If I could open it I would probably be looking for a shunt resistor and capacitor controlling both current draw and the time until switching off. Both of which could be capped. Unfortunately opening this thing would mean destroying the nice case, not an option.

I am a bit skeptical about the 19000mAh so I am testing it first before recommending.

Usually, if it sounds too good to be true, it probably is!

6v6gt

The power rating of those power packs is anyway misleading. The mAh rating is at the internal battery voltage of 3.7 volts and not the (stepped up) output voltage of 5 volts. But even then, 19000mAh is quite respectable.

Pugwash

I think Google's motto is "Go break things", so I took that to heart!

I had an old 8000mAh powerpack and was wondering what happens if I feed
current from the output back to the input.

What happened was, the powerpack stayed on for five minutes, the normal cutoff
was about 20 seconds.

I don't know if I have done any long-term damage, but there seems to be no
short-term damage and it didn't explode or even get warm.

Johan_Ha

You don't need external circuit, you can use your Arduino itself for keeping the power bank running. Just put a 22R resistor between 5V of USB in and a pin (e.g. 1C) of ULN2803.
This seems simple. ULN2803 is a set of transistors in an IC, right? So a single transistor could work, too. That would maybe need an extra 330R resistor. This would also need one digital pin from the Arduino. If you use a PWM pin, you can easily set the frequency and the duty cycle, like every 5 seconds a 200 ms pulse. If you don't have a spare PWM pin, you need to set up a timer interrupt, which is basically the same thing. It would have a counter counting to 25, it would put say pin 4 high when counter is 0 and low when counter is 1.
____________________

If you ask for help and write 'u' instead of 'you' because you think it's convenient, I will write 'no' instead of 'yes'. For same reasons.

septillion

This seems simple. ULN2803 is a set of transistors in an IC, right? So a single transistor could work, too.
If you use a PWM pin, you can easily set the frequency and the duty cycle, like every 5 seconds a 200 ms pulse.
That's way to slow for the hardware PWM on most Arduino's. But it's slow so you can easily do it in code.

If you don't have a spare PWM pin, you need to set up a timer interrupt, which is basically the same thing.
Also no. Unless the Arduino is in sleep most of the time there is NO need for an interrupt.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Johan_Ha

Ok, the actual interrupt thing might be a little overkill, though it should be possible to set up an interrupt, which fires every 250 ms. If the following function would be called approximately every 250 ms, it would do the job, i.e. every 8th second a 250 ms high pulse is sent to port 4.
Code: [Select]

void keepAwake(void)
{
    static int last = 0;
    static bool hi = false;
    if (millis() - last > 8000) // cycle length 8 s
    {
        digitalWrite(4, HIGH);
        last = millis(); // record the time when pulse actually goes high
        hi = true;
    }
    else
    if (hi && millis() - last > 250) // wait until AT LEAST 250 ms has passed
    {
        digitalWrite(4, LOW);
        hi = false;
    }
}


For this to happen, one could use this library.
This library is not a real interrupt library. It is based on polling. You need a timer.run() call inside your loop. The faster your loop runs, the more accuracy you get in timing the pulse. But in this case it shouldn't be very critical. If it is, just put more timer.run() calls inside your loop.
Say you want the 250 ms pulse every 8 s, but your loop takes some 300 ms. Worst case is that your cycle will take 8299 ms and your pulse length will be 300 ms. This is quite unacceptable in many cases, but if the task is to keep your power bank on, it's quite ok.
____________________

If you ask for help and write 'u' instead of 'you' because you think it's convenient, I will write 'no' instead of 'yes'. For same reasons.

Infraviolet

One option, albeit rather wasteful of power, would be a small enough resistor in parallel with the arduino. If the 5V rail and GND rail of the USB power supply are connected by say a 1K ohm resistor then there will always be 5mA drawn, plus whatever current is necessary to satisfy the arduino (very very little). If you find what draw current the power supply shuts off below you can size a resistor to ensure it always draws enough current to stay on. Personally I was lucky and found a USB 5V lithium supply which doesn't cut off at low currents, a TECKNET 13000mAh device but they might hav chanegd the design since the one I bought was manufactured.

Go Up