Controlling USB device

Has anyone set something up to control a USB device through a smart device? I'm thinking of using a ZEN16 I have sitting around to break the power legs of a USB device to remotely restart it. Essentially get a USB extension cable, then splice into it from there.

If you've done something like this, what was your experience?

Would the following device meet your needs:

1 Like

unfortunately not. my use case is i have a USB device plugged into a server. on this server, it's running ESXi. when the host reboots, it doesn't detect the USB device, so i need to physically reseat the USB device for it to be recognized. instead of me having to go to my server room each time a reboot happens, i could just use the ZEN16 to cut the connection to a power leg (hopefully turning off the device), then turn it on a few seconds later to simulate reseating the device.

while i get the data pins will still be connected, it hopefully shouldn't matter if i cut the power

What if you plugged powered USB hub into the server, and then the USB device into the powered hub?

That might just solve the problem altogether. If not, just plug the USB hub’s power supply into a smart outlet, which you can then control.


I'll chirp in with what feels like my default reply =p

Nodemcu with a relay, used to break the USB contact temporarily.

Not sure if cutting the power to a hub will work, or if it will just convert it into a non-powered hub. Think it possibly depends on the hub. =)


i have a ZEN16 sitting around collecting dust now, so i would just use that (although i do still have a 120V relay from my garage door project. Also have a spare NodeMCU since it comes in packs of 3, and 4 3.3V relays from my dog feeder project)

1 Like

hmmm, that is interesting. i do have a powered hub, but it also pulls power from the USB port so i don't think that would fully work. i think the mains power was just to help if i plugged a bunch of USB3.0 devices into it, it would help not overload the USB port, but it did work without the mains power to power smaller USB devices (flash drives n such)

Ah, wasn't familiar with a zen16, but that'd be the same I guess. Not sure if you would just need to break the power line, data or ground. I'd guess power.

yea, figure it's just like any other power source, and as long as i break the hot or neutral leg, it will function as expected. they have USB devices with physical switches on them for RPi, so i would just be digitizing it

1 Like

Don’t break the neutral. I believe that’s a code requirement in many places.

1 Like

hmmm, they have cables that i could use, but i already ordered the extension

(just in case anyone else is interested)

I have not tried these settings. I set it up in the usual way.

From my work with a number of USB host controllers, typically the USB interrogation of downstream devices is triggered on the rising edge of VBUS or in the case of OTG, a change in state of USB_ID. If a type C then a change in state of of either of the CC pins may also trigger this as well but it seems controller dependant.

My assumption is you server does not power down the USB VBUS or powers it back up too early for the onboard USB host controller to see the transition. On boot up the server should send a USB restart to the host controller which also will retrigger the USB interrogation, but I guess that is not occurring.


after fighting with the small wires in the usb extension, i finally got it

this was just testing off the server, now to plug it all up :slight_smile:


What was the sequence of actions when setting up? I wonder if it will suddenly come in handy, because the problem, as I see it, is not frequent, but requires a solution.

just breaking the +5V cable from inside the USB extension, then running that into the relay


Cool! It turns out that it is very simple and does not require titanic efforts!

Download the Hubitat app