Let Your PC Control Peripheral Devices Using This USB-Controlled Power Strip
Michał Słomkowski created an automatic USB mains switch for a USB-controlled power strip that shuts devices down when his PC goes to sleep.
With the innovation going into modern power strips, you want your USB-controlled power strip to be smarter than ever before. However, most of the power strips in the market tend to drive the relay taking the +5V from the USB port even in the sleep mode. The sleep mode in the PC is a very low-power mode that continues to draw a small amount of power to keep that RAM powered on. But if you want a power strip to shut the devices down when the PC is put to sleep, then Michał Słomkowski has solved just the solution: a custom switch that detects USB bus inactivity.
For hardware, Słomkowski used an existing Chinese relay module that integrates an onboard ATtiny45 MCU. To upload the firmware, the ISP is soldered and secured with a glue gun.
The most important part of this project is the firmware that was inspired by an existing USB relay board firmware available to the open source community. This firmware gave Słomkowski confidence to implement this using the V-USB without a quartz oscillator onboard. "The general idea of the program is to trigger timer interrupt every 10 ms and check whether usbSofCount value has changed," he explains." If so, the timeout counter is reset. After 30 seconds of inactivity, the relay is shut down. When activity is resumed, the relay is turned back on.”
More details on the project can be found in Słomkowski's blog post.
Abhishek Jadhav is an engineering student, freelance tech writer, RISC-V Ambassador, and leader of the Open Hardware Developer Community.