Main Content

Automatic USB mains switch for USB-controlled power strip

I wanted to buy a USB-controlled power strip which shuts the devices down when the PC is put to sleep. Life is not so easy: all available USB power strips are quite dumb - they simply use +5 V from USB port to drive the relay. The problem is that most motherboards don’t disable USB supply voltage in sleep mode; the PC has to be turned off completely to be that case.

I realized I had to build custom switch which detects USB bus inactivity. This great tutorial about USB physical layer specifies that host generates start-of-frame packet every millisecond, otherwise the device should enter suspend mode. Communication ceases when computer is suspended. This is ideal for my situation.

Let’s look at the screenshot visualising signal on USB D- line. Indeed, every millisecond there’s a short negative pulse. The idea is to make an extremely simple USB device with no communication capabilities (no endpoints defined), which just listens to the bus activity and shuts the relay down after some time of inactivity.”

Link to article