-
1Circuit
- Solder wire 1 to 5v on the Digispark
- Solder wire 1's other end to the push button
- Solder both wire two and the pull-down resistor to pin 5.
- Solder wire 2's other end to the other end of the push button.
- Solder the other end of the resistor to ground.
-
2Upload code to the Digispark
Set up the Digispark environment with instructions from http://digistump.com/wiki/digispark/tutorials/connecting
Upload the code in the attached ino file to the Digispark. -
3Figure out which device is USB hubUse the output of `lsusb -tv` to figure out which device is the USB hub. In my case the following was part of the command output
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M ID 1d6b:0002 Linux Foundation 2.0 root hub |__ Port 3: Dev 40, If 0, Class=Hub, Driver=hub/4p, 480M ID 05e3:0610 Genesys Logic, Inc. 4-port hub |__ Port 4: Dev 42, If 1, Class=Human Interface Device, Driver=usbhid, 12M ID 046d:c534 Logitech, Inc. Unifying Receiver |__ Port 4: Dev 42, If 0, Class=Human Interface Device, Driver=usbhid, 12M ID 046d:c534 Logitech, Inc. Unifying Receiver
I figured that since the Logitech reciever was plugged into the same hub I was going to use for my Digispark, 'ID 05e3:0610 Genesys Logic, Inc. 4-port hub' is probably the target USB hub. As far as I know if the target USB hub is an external USB to USB hub, it probably won't be a top-level (or root) device. The ID 05e3:0610 is the main takeaway from this step.
-
4Setup udev rule
Move the file provided with this project to /etc/udev/rules.d/50-wake-on-device.rules . And replace the IDs in `ATTRS{idVendor}=="05e3", ATTRS{idProduct}=="0610"` with the ID you obtained in the previous step.
Reload the udev system with the command below and plug/unplug the USB hub or reboot your computer.
sudo udevadm control --reload
-
5Plug in the Digispark and test
Plug in the Digispark and wait for it to boot up in about 5 seconds. Run the command below and monitor the terminal output while you press the button
dmesg -w
When you press the button, there should be activity on the terminal and the Digispark's LED should turn on (in addition to the power LED) for about 6 seconds. If that works, send your computer to sleep and it should work.
If something doesn't work try unplugging/rebooting and the usual stuff.
If the LED doesn't light up, it's probably a hardware problem or a problem with flashing the code.If the terminal doesn't output anything and the LED lit up, there may be other problems with the system. I'll try to respond to comments (if there are any) to this guide ASAP.
If all of that worked, you have made your computer wake up from sleep faster and you can successfully spend more time being impatient and disconnected from the real world! (that also applies to me lol)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.