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.



  1. wolfy02 says:

    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.

  2. ryan says:

    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…

    • Mortimer Neuss says:

      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.

      • impromptuParade says:

        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.

        • John says:

          A startup and shutdown are the same input, shorting the power button pins. A shutdown triggered by the power button doesn’t give the user any options, it just shuts down.

  3. ojh says:

    Next step, port knocking for secure login: http://en.wikipedia.org/wiki/Port_knocking

  4. LeSpocky says:

    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 */
  5. pcf11 says:

    Knock on, knock off, the Knocker!

  6. DainBramage1991 says:

    Nice hack, but why not just use a push button to pull the green PSU lead to ground? Much, much simpler to do, though less elegant.

  7. Waiting for this to show up in a juke box hack in the near future so someone can be the Fonz

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,704 other followers