On/Off Shim and powered USB Hub


#1

Hello, I’m trying to install an On/Off Shim on my Raspberry Pi 3. I have installed several on various Pi Zero (W)s and not had any major issues.

Tonight I’ve spent several hours trying to figure out why it wouldn’t power off completely. I reinstalled the On/Off Shim oneliner a few times, I finally plugged in an LCD (it’s headless normally) and still had no clear cause. I finally realized it’s my powered USB hub.

The power from the hub, I guess, powers the Pi 3 from the USB ports? I didn’t know that, but the power is never completely cut to the Pi 3 when the USB hub is plugged into the PI 3 (with power plugged into the hub).

Is this a known issue? Is there a workaround for this? Once it’s powered up and then shutdown, I can’t re-power it on. I have to pull all the power from the USB hub and the Pi and then replug it in. I have an LED on a 3v3 pin and it always remains on, along with the Pi 3’s onboard red LED…

I’m using the powered USB hub for two USB webcams and comm. with a 3d printer.

Thanks


#2

This is a known issue at least with the Pi- it’s had a long history of pulling power from powered USB hubs. The interaction between this fact, and the On/Off Shim, however, is new to me.

At this point, I’d splice open a spare USB cable and snip the +5v line, making sure to strip it back somewhat and insulate the result. The link between the Pi and hub only needs Data+, Data- and GND and your hub nor Pi shouldn’t care that there’s no +5v connection between the two.

I’m not in the office to test if this cable cuts the data lines (that would seem odd to me) but you could also try using this just permanently in its off position:


#3

Oooo very interesting! I have a switch, but I think it’s specific to power, not sure if it would have the data lines, but I can find out easily enough! Thanks. Will try one (or both if the one doesn’t work) solutions and let you know how it goes.


#4

So using the switch, I have proven two things (I think):

  • The power lines are the problem
  • The switch I have doesn’t have data line :(

With the switch on, I can reproduce it.

With the switch off, I can shutdown just fine.

In both cases, no webcam shows up in lsusb or /dev/v4l though. So time to go hacky hacky on a USB cable. Will report back again shortly :)

Ahh just checked the description of your product link - it says “no data lines, power only”. And it does indeed seem to be the same switch I have here…


#5

D’oh! I totally missed the “no data lines, power only” bit! Glad you had one on hand to test.

Good luck with the cable hacking, they’re usually colour-coded pretty obviously so it should be plain sailing.


#6

Unfortunately I’m now experiencing another interesting problem … Since snipping the black and red (+/- 5v), when I shutdown it seems to shutdown fully - and all the lights on the shim and Pi go out for about half a second or so then it immediately starts back up.

Is it possible it’s getting a signal from the USB data to start back up somehow? I just checked again: with no USB at all it does shutdown and remains shutdown. As soon as I plug the USB data-only cable into the hub, it just gets in this weird shutdown / restart loop (when I go to shutdown from the external button, internal button, or ‘sudo poweroff’ / ‘sudo halt’ commands).

I guess this is better than shutting down and not being usable at all lol but still hardly what I’m looking for :)

Thanks again for all the help. I’m feeling hopeful that we can solve this.

Btw, the data-only wires do seem to work. I was a little skeptical about Raspbian seeing the devices, but it does!


#7

It might be the lack of a ground wire that’s causing your problem, but I’m not sure. I’d consider this progress though!

I don’t think there could be any signal coming from the USB device, as such, but it’s possible some other electrical noise issue/glitch could be causing it. Perhaps coupling enough power into the +5v lines via D+ and D- to jump start the Pi? Without a scope on it, I couldn’t do more than guess!


#8

Hmm, I don’t know if it matters but i tried re-attaching the black wire and the same problem persists (red remains disconnected).

Unfortunately I don’t know enough about this stuff.

I opened a question over on the Raspberry stack exchange earlier, too:

Do you know if that diode that Milliways mentioned would work? Or do you have any other ideas of what I could try?

Thanks again…


#9

The diode is no better solution than simply cutting the power, since it would block current flow from Device -> Host but permit it in the other direction. Since you don’t need it in either direction then it’s easier just to cut the wire.

After speaking to @niko he reckons that voltage from the D+ and D- lines (at least one of which will be at 3.3v since they’re differential) could be bleeding through the Pi’s USB ESD diode and into the Pi’s 3.3v line. Not much current, but enough to reach the threshold of the N-FET on the OnOff shim and start it up again.

A possible quick and dirty solution would be to place a 1k Ohm resistor between 3.3v and Ground on the Pi to, hopefully, bleed off this current and prevent the on state from happening. If you’ve got some Male-to-Male jumper jerky and a spare resistor this should be easy enough to try.

A proper solution would be to employ a circuit that cuts off the USB data signals when the Pi is powered down.


#10

Man you rock! That fixed it. In fact, that even exposed / fixed another issue that hadn’t even crossed my mind - the fact that upon providing power, the Pi was turning on automatically (with the USB hub plugged in).

Added the 1k resistor between pins 1 (3v3) and 9 (Gnd) and now the power button works. Shuts down, stay off, etc. Gets power, stays off until I hit the button, etc Woot.

Thanks to you and @niko - much appreciated!

Just some info (for any wary travelers who run into this same issue in the future and happen to stumble across this post):

My USB hub was the Belkin F5U404 Hi-Speed USB 2.0 4-Port Mobile Hub. And according to this link is noted as having: Faulty/bad design; Leaks current back up the cable to the Raspberry Pi.

To reiterate the fix:

  • Cut the 5v+ wire on the USB cable (assuming you’re powering the hub separately - otherwise if you do want to power it from the Pi perhaps the diode trick which is noted here and here may work for you)
  • Add a 1k resistor that connects 3v3 to GND (pin 1 and 9)

#11

Great news! And you’re welcome.

You can now play with raising the value of that 1k resistor, if you have others spare. It would be kinder to the Pi. I have a suspicion that 10k would also work.


#12

One last question (hopefully) :)…

I have an LED that sits on pin 17 and 25 (the other 3v3 and a ground pin - it’s an illuminated button for the On/Off Shim). When I plug that in, it behaves funny again. The LED has a 220 ohm resistor. Is it becoming a new path of less resistance, thus reintroducing the problem?

Would I bump up the resistor between the LED and pin 17/25 to an additional 1k (1220 ohm total)? Or would I need to add the 1k resistor between the two pins directly and leave the 220 on the LED (like I did with pin 1 and 9)? Or is the problem different and I’m completely missing it…?

Thanks again :)


#13

So just some test results:

  • With the 1K the Pi seems to run fine for about an hour or two before it gets into it’s weird low-power limbo state. I’m assuming this is maybe related to the resistor.
  • Tried a 6.somethingK (i think 6.75K), didn’t have a screen plugged in but it seemed to go into limbo right away. SSH never worked, but out of 3 boot attempts, only 1 resulted in me being able to get a ping response (and it was a steady response). So NIC seemed to be underpowered.
  • Tried a 2.2k, boots up, had a screen attached and it was seemingly missing every other line of pixels. Also looked very washed out, almost black-and-whiteish. Underpowered GPU I assume. Powering off didn’t work (limbo). Ping and SSH worked fine.
  • Trying a 2K right now, so far it’s running. Graphics look ok… Powering off seems to work. Currently pinging, currently SSH’ing, will let it run for a few hours (if it survives that long).

Will try a 1K + 500Ohm and if that continues to have problems maybe I’ll try less than 1K?


#14

I’m surprised that higher values are causing strange bootup problems, if anything the lower values would cause more of a voltage drop on the 3.3v line and cause more issues. That’s really quite odd!

That a 2.2k causes problems where 1k does not is absolutely baffling!