Turn A PC On With A Knock And An ATTiny


Pressing the power button on your computer usually isn’t too much trouble, unless your computer is stored away somewhere hard to reach. [Joonas] has been hard at work on a solution that would also impress his friends, building a knock sensor to turn on his PC.

For around $10 in parts he put together an ATTiny45 that emulates a PS/2 device, which takes advantage of his computer’s ability to boot upon receiving PS/2 input. The build uses a Piezo buzzer and a 1M Ohm resistor as a knock sensor exactly as the official Arduino tutorial demonstrates, and one of those PS/2-to-USB adapters that are most likely lurking in the back corner of every drawer in your office.

[Joonas] used AVRweb to disable the 8X clock divider so there’d be enough clock cycles for PS/2 communication, then loaded some test code to make sure the vibrations were being detected correctly. You can check out his Github for the final code here, and stick around after the break for a quick video demo. Then check out a similar hack with [Mathieu’s] home automation knock sensor.

14 thoughts on “Turn A PC On With A Knock And An ATTiny

  1. Did something similar on a tower i modified before. It was an old IBM that had a broken plastic button for the power. Decided to bondo over it and install a reed-relay. Any time i wanted to turn it on, i just waved a magnet in the bottom corner(far far away from any components) and voila almost like magic. To turn it off i just hovered it longer than usual.

    Would be great if someone could get a NFC switch working where it either turns on with the right phone or logs the user in automatically.

    1. Just ordered some NFC tags…going to try it out using a homemade app…need to bypass the 3-app junk mentioned in the link – looks like there’s a good NFC plugin for Eclipse.

    2. Except for archaic diskettes and floppies you really can’t hurt your computer with ‘normal’ magnets. I’m sure if you had some 2T beast of a magnet the RAM wouldn’t be happy but the HDD is encased in mu metal which block magnetic fields, mostly to keep it’s magnets from screwing w/ the computer.

      1. See: http://www.kjmagnetics.com/blog.asp?p=hard-drive-destruction
        (They sell strong magnets at reasonable prices, and I love their blog). In summary, they tried to “damage” a hard drive with strong magnets, and could not corrupt the files. They stopped trying when they got to magnets so large, that it was actually deforming the hard drive and they heard rubbing sounds. Squishing the hard drive was not the method whey wanted to use to corrupt the data…
        – Steve

  2. Rather than a ps2 device, it seems like it would have been much simpler just to trigger the power pins on the motherboard. Great idea regardless, now where’s my arduino so I can copy it…

    1. Problem here: It works for wake up and shut down, as you synthesize the function of pressing the power button. So if you knock while using the pc, it would shut down. The PS2-Bios thing is a simple way to only have a wake-up signal.

      1. So… just don’t simulate shutdown presses? Even if it was completely dumb, if you knock while the system is on your OS is just going to ask you if you want to shut down.

  3. Setting the fuse bits for changing CKDIV8 is one way. If you don’t want to fiddle with those, you can easily change this at runtime with those two lines:

        /* set clock */
        CLKPR = (1 << CLKPCE); /* enable clock prescaler update */
        CLKPR = 0; /* set clock to maximum */

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.