I am trying to cheat the auto-shutoff feature of a commercial power bank, something along the lines of these instructions.

Contrary to the article I am simply using one port of an Attiny85 to output several types of pulse trains. The port is switching the load (R=60 ohms is what I have proven to keep the power bank alive when driven continuously) by means of a MOSFET (BS170). The circuit as such works as expected (proven with a DSO), but the conditions under which it keeps the power bank alive are tricky.


  • My first attempt - ordinary PWM at 1 kHz with duty cycle up to ~20% failed. I didn't drive it to higher duty cycles because my goal is saving power.
  • My second attempt - manually switching the port at low frequency (<< 1 Hz) with on-time ~1 second, off-time ~4 seconds was successful
  • Third attempt - reducing on-time to 0.5 seconds or increasing off-time to more than 4 seconds failed (1 second "on" seems like the minimum for the power bank to recognise intermitting load)
  • Fourth attempt - on/off = 1 s/8 s with intermittent 10 ms pulses works for some time (longer than the auto-shutoff time of ~15 s), but eventually fails (shuts off)

What I conclude from these findings:

  • the power bank's controller somehow integrates current (otherwise the high load peaks of the ordinary 1 kHz peaks would be enough to keep the unit awake)
  • 20%-duty cycle at 1kHz (not working) is not the same as 20% duty cycle at 0.2 Hz (working), so the power bank integrating current cannot be the whole story
  • the sensitivity to peak load seems to get lower for longer pauses (8 seconds), but can be reactivated by very short maximum load peaks

Does anyone know something about commonly used strategies for implementing the auto-shutoff in commercial power banks?

Is there any easy explanation for the behavior that I have observed?

Any ideas on how I could reduce the duty cycle substantially further while keeping the unit alive?

  • \$\begingroup\$ You can post your solution as an answer and accept it to mark it solved if you don't get any good answers. Good work. \$\endgroup\$
    – Transistor
    Jun 1, 2018 at 14:11
  • \$\begingroup\$ Thanks. I'll post it as an answer, but I would rather wait if somebody has an answer that provides some more in depth info about these battery controllers. \$\endgroup\$
    – oliver
    Jun 1, 2018 at 14:14

1 Answer 1


After some experimentation I have found out that increasing the on-time to slightly above 1 second (1.25 seconds) allows me to choose an off-time (11.75 seconds) much closer to the auto-shutoff time (~15 seconds). My guess is that the occasional failures with 1 second on-time are due to the on-time being somehow disadvantageously timed against the sampling time of the battery controller that measures current.

My best optimized version is now, on: 1.3 seconds, off: 11.7 seconds (that is a duty cycle of 10%, couldn't get it any lower), meaning total cycle time of 13 seconds. I have decided to keep some reasonable safety distance to the regular auto-shutoff time of 15 seconds. Otherwise slight variations in the parameters (due to e.g. temperature) might cause the circuit to fail occasionally/randomly.

With 10% duty cycle and 60 ohms I have now ~8 mA on average which means my 10 Ah battery will last max ~1.5 months which is quite okay.

See the corresponding Arduino sketch below. Although the values are likely to be very specific for my power bank model, I hope it saves somebody some work by giving a reasonable starting point. Remember that the Arduino software has to have the right config files for Attiny85 for correct timing and pin numbers.

void setup() 
  pinMode(0, OUTPUT);

void loop() 
  digitalWrite(0, HIGH);
  digitalWrite(0, LOW);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.