Arduino Game PC Power Switch

Electronics

2016-04-04 12:24:39

This and a following article will explain how to build a simple hardware game with an Arduino and use it to turn on a Computer.

Two years ago I built a PC case of wood. I also used a standard lock to turn the PC on instead of a normal Power button. Now I thought it was time to upgrade that thing again. My Plan was to have a little Game that you had to "win" before being allowed to turn on the PC. I soldered some buttons, LEDs and an Arduino up for that and in this and a following article I'll explain how I did all that and how I actually used the Arduino to turn on the PC instead of using a standard switch.

The Game

So I wanted to have simple game that still was not too easy to just be boring. I came up with the idea of having two switches and LEDs above them and then a row of four LEDs further up. When the game starts, either the left or right LED will light up and you a couple hundred milliseconds to tap the corresponding button. If you get it right, the first, then the second etc. LED of the 4-LED Strip will light up. Once you've got all 4 right, you can power on the PC. If you fail at any one of them, you have to start all over again. I've tested some timings and having 270ms per LED with a delay of 100ms between each of them seemed challenging but possible, however 300ms or maybe even 330ms might be better in the long run when you want to power on the PC when you're tired or in a hurry.

The Wiring

I tested the whole concept on a breadboard before starting to solder it onto a prototype board. Here is a pictures of how it all looked on a breadboard when first trying out the game concept:

Arduino Breadboard Version

Making it real

After a successful first test, I decided to use an Arduino Uno instead of the Mega and bought real button instead of the tiny breadboard buttons. Also, I replaced the thrid button with the door Lock I alrady had installed in my PC previously. So you'd have to turn the key, then press the correct buttons and then the PC would turn on. To detect whether the key was turned, I installed a simple button underneath the lock which is pressed by the lock when turning the key. I know that someone without the key could still press the button by hand, but then again he could also short-circuit the whole thing and turn it on that way. Unfortunately the construction looks a bit messy and that led to problems later on. I thought about sharing the current code here, but it is very simple and still has some flaws, so I'll do that later on. Essentially it just waits for a press on the main button, then randomly lights up an LED, waits some time for a button press and does the same thing 4 Times, after that the Transistor that turns on the PC is activated. It works with a transistor since they share the same ground because the arduino is connected via usb (more on that later). Here is picture of what the first soldering looked like:

first soldered version