You’ve probably seen USB hubs with physical switches for each port, they provide a handy way to cut the power to individual devices, but only if you’re close enough to flip them. They won’t do you much good if you want to pull the plug on a USB gadget remotely.
That’s why [Jim Heaney] created the I2C-USB-Hub. The device takes your standard USB 2.0 hub circuit, and adds in a MT9700 P-MOSFET load switch for each port. The enable pin on each of these switches is in turn connected to one of the output pins of a PCA9557PW I2C I/O chip. That means controlling each port is as easy as sending the proper sequence of bits over the wire, though [Jim] says he does plan on writing up an Arduino library to make flipping the digital switches a little more user friendly.
Since the 8-bit chip had a few extra pins left over, [Jim] wired one up to serve as a master control for the LED indicator lights on the PCB. Another is used to adjust the current limit on the MT9700 between 500 mA and 1 A.
While naturally we’re big fans of spinning up your own hardware here at Hackaday, we’ve also seen similar results achieved by modifying an off-the-shelf USB hub.
That is the time to use a Per-Port Power Switching hub.
https://github.com/mvp/uhubctl
Sadly, not many currently available hubs work with it. Nearly all of the ones on the “compatible” list aren’t available any more, and an attempt to buy a similar model to one of the listed-compatible ones from the same manufacturer (RSHTech) led to failure.
Plenty of USB hub chips com with this functionality built-in, and it is indeed, controller by i2c. So cool hack to do it manually, but I wonder if theres even any cost benefit … What was the purpose/itch needing a scratch here?
Per-port power switching is actually part of the USB standard, but one that is not very widely supported. If you happen to have a compatible hub, it’s a matter of sending the right USB commands, no I2C required.
See https://github.com/mvp/uhubctl
Per-port power switching is supported in USB-compliant hub ICs, however the the project owner isn’t using a compliant hub in their schematic.
Wondering if this could help to program Digispark with out removing them as they have a 1K5 resistor between D- and VCC
Thank you for the link! I knew per port power switching existed and had a ton of trouble finding software/hubs that supported it.
This was a reply for dqd /Andrzej. The reply form needs javascript to reply to someone properly
It’s well understood by those who frequent that the comments system is a “hack”.
A temporary permanent one too it seems, as it’s lasted for iintolerably more than “aday”
Soon we’ll be able to play Doom in it.
The Cypress Cy4609 Evaluation board (4 port USB 3.0 hub) supports Port Power Switching, though you have to build your own case.
https://www.digikey.com/en/products/detail/infineon-technologies/CY4609/4869280 – only $66USD, not bad. Less than buying multiple hubs to try and find one that supports power switching (almost none of the ones on uhubctl’s compat list are available any more)
Why do this instead of implementing a standard USB hub based on a USB2514bi or similar design? Each of those more or less requires a USB port switch. USB port switches have built in overcurrent limiting, short circuit protection with thermal overload all built in. I2C is only needed if you want to change the hubs settings from default.