Turning-on via OnOffShim connected to powerbank is failing when raspberry is turned off some time


Turning-on via OnOffShim connected to powerbank is failing when raspberry is turned off some time (I guess, 20+ min). After manually switching power cable between OnOffShim and powerbank on and off, turning-on via OnOffShim is working again.

  • Does OnOffShim works like a manual power-switching? (This was my expectation when reading the OnOffShim description.)
  • Do I have a bug in my setup? Do I need to configure somthing for using-with-powerbank-scenarios?
  • Does anyone have an idea what I can do, or test? (Can help me somehow)


  • Setup
    • Raspberry Zero is switched on via OnOffShim
    • Raspberry’s SD Card has raspbian, OnOffShim-setup performed via on-liner, no config changes, phoniebox software installed (see below)
    • OnOffShim is connected to powerbank with usb-cable having a manual switch
  • OnOffShim is connected to button on external case (but same behavior with OnOffShim’s onboard button)
    • (My build of a phoniebox(https://github.com/MiczFlor/RPi-Jukebox-RFID) - a music box triggered by RFID cards)
  • Unexpected behavior
    • Turning-on raspberry via OnOffShim does not work, if raspberry turned off for a some time.
      • I guess, duration “some time” is 20+ min, but real world scenario is: Turning phoniebox off over night and turning on in the morning.
      • I guess, powerbank suspenses if raspberry is off for some time, to avoid further power loss - what I have read so far, while researching this issue.
      • For now, I do not want to get around powerbank suspension with transistors, to keep up a power drain and avoid powerbank suspension
    • Key point is, After I unplug and plug usb-cable (or toggle manual switch of usb cable), I can turn on raspberry via OnOffShim (e.g., its onboard buttons). But I expect OnOffShim to do this cut from power supply and reconnect - reading the description. So, this sounds like it should work. What goes wrong?
  • Working cases
    • In following cases OnOffShim’s onboard button turns raspberry on and shuts it down as expected
      • OnOffShim is connected to power grid/line without powerbank
      • OnOffShim is just connected to powerbank, usb-cable is just plugged in (e.g., just after unplugging it)
      • OnOffShim is connected to powerbank but usb-cable’s manual switch is just switched on (e.g., just after switched off)

I have a very similar powerbank and it even shuts down when my Pi-Zero is idle and only draws 90mA. The powerbank assumes “charging complete” and that’s it. Probably your powerbank has some usb-cable sensing, otherwise your other results would not be explainable.

I also have some very cheap single-cell powerbanks, and they don’t have this kind of electronics built in.

_My current workaround is “not shutting down my Pi-Zero and continuously recharging”. Obviously this vasts ‘energy’ and renders OnOffShim (and button incl. power-on-led on case) useless. My powerbank does not shuts down when Pi is idle (Maybe because I have usb-connected RFID-reader and GPIO-connected miniamp-soundcard attached)

Referring to usb-cable sensing: How does the manual switch of my usb cable work different to the OnOffShim from perspective of the powerbank cable sensing mechanism? Do not both simply disconnect or reconnect phase (not ground) wire? (However, I’m far away from being a electrician expert… So if anyone knows…)

@bablokb I really appreciate your quick response, thank you.

USB-chargers use some tricks, e.g. they measure the capacitance between 5V and GND to detect if a cable is connected or not.

Do you know the Wemos Battery Shield? This could be an alternative for you, since it does not have any sophisticated electronics. It is not as beefy as your power-bank, but it could be a solution. Don’t use the larger, multi-cell variants unless you know you have identical cells (i.e. with identical inner resistance).

@bablokb thanks again for your suggestion, nice to know about such a Battery Shield, but most likely for another project.
The Phoniebox (my pi-project) is about playing sound all the afternoon (with 5W sound boxes, sound card, 6 LEDs and rfid-Scanner); so it comes down to the question “how long can I play sound until I need to exchange battery” (need to open a case…) - And to be honest, I’m not that good in calculating the capacity or measure power drain. I fear I would need to exchange battery every week or more often.

So, how does OnOffShim opens/closes the circuit so that capacitance-measuring does not drop enough between 5V and GND compared to un/replugging cable. I’m still puzzled about this.

Is my issue a common issue of using OnOffShim with Powerbank?

The OnOffShim is always powered, because the electronics has to react to the button being pressed.

Powerbanks are not like batteries. They are charging devices which try to prevent constant trickle charging. So in a way: yes, a (good) powerbank and an OnOffShim don’t make a good pair.

Thank you for your fast response (although it took me some time to reply).

I think this thread came to a (short) end, result of this thread concluded:

  • My powerbank shuts down, even if OnOffShim draws (too) low energy, to prevent constant trickle charging
  • Without powerbank providing energy, OnOffShim does not work; does not detect and react on button press
  • In contrast, hardware switch (in usb cable) works the way, that powerbank awakes and provides energy - afterwards OnOffShim is powered/working (again.)

Options to solve my situation:

  • use another powerbank, not shutting done automatically while OnOffShim is still powered
  • increase energy consumption (beside OnOffShim) by adding ‘consumers’, e.g. LED
  • change energy source, replace powerbank with batteries (no having a mechanism to prevent trickle charging)