Arduino Leonardo Game Controller for Quadriplegics
by kerchoo_22 in Circuits > Assistive Tech
986 Views, 0 Favorites, 0 Comments
Arduino Leonardo Game Controller for Quadriplegics
CLICK HERE for instructional video.
The goal of this project was to create an adaptable controller for quadriplegics/tetraplegics that could serve as a less expensive alternative to current controllers on the market. This controller utilizes head motion to access the controls, through relatively simple arduino wiring. Most of the materials used to make the controller are pretty common household items, or able to be bought for pretty cheap. The only exception is the arduino leonardo (or the Makey-Makey alternative), which will be linked below to buy in the supplies. Anywhoo, hope you enjoy!
Supplies
- Cardboard
- Duct tape or other sturdy tape
- Alligator clip wires and other wires
- Hot glue
- Velcro
- Perfboard
- Solder
- Resistors (1 Megaohm) - this is the secret ingredient and MUST be 1 Megaohm
- Arduino Leonardo board - CLICK HERE to buy
- MakeyMakey (more expensive/simpler alternative to using the Arduino Leonardo) - CLICK HERE to buy
- Pre-made space invaders game file (though any computer game will work with this controller) - CLICK HERE to download HTML, CSS, and Java Script files
- Arduino Leonardo Code - CLICK HERE to download
- "Moving Average Filter" Arduino library - CLICK HERE to download
Wiring the Circuit Board
Start by making the circuit board. The key ports you will be using in your Arduino Leonardo are the ground (denoted by the letter G), 5V port, and the Analog in ports (A0, A1, A2, and A3). You can see the circuit board diagram above. The 5V port must be wired to one end of the resistors, and the other end of each resistor must connect to each Analog Port. Each of those wires (connected to the analog port) must then be wired to an alligator clip wire that you can later attach to your controls/buttons. Additionally, the ground port (G) must connect to an alligator clip wire that will attach to the headband/inner ring (the "ground").
Constructing the Inner and Outer Rings
THE INNER RING: This is a headband that will attach to the ground wire (typically a black wire). Begin by making a circle out of duct tape that fits the wearer's head. Surround the duct tape with tinfoil to make it conductive, making sure that all tinfoil parts are connected (I made four separate tin foil sheets and connected them using conductive tape but you can just cover the whole headband in tinfoil).
THE OUTER RING: Make a square out of cardboard and duct tape that's larger than the circumference of the wearer's head. Tape large pieces tinfoil to each of the inner sides (the pieces must be separate from each other). These will serve as your "buttons" and should each be wired to a different analog output.
- A0 should be wired to the front button (the "W" key in the arduino code)
- A1 should be wired to the left button (the "A" key)
- A2 should be wired to the back button (the "S" key)
- A3 should be wired to the right button (the "D" key)
To add stability to the outer ring, you can tape small cardboard lattices in the inner corners so it retains it shape.
Adding the Backing
To make the backing, fold and tape a long piece of cardboard into a large square. Hot glue/tape the backing to the outer ring using a cardboard strip as seen in the pictures (triangles are engineering's best friend after all).
Attaching the Arduino Leonardo Wiring
This is where it's important that you make the backing large enough because you're going to fit your arduino/perfboard inside it. Construct a smaller cardboard square that fits inside the cardboard backing and has a tab coming from the top to slide it in and out. Hot glue the completed arduino and perfboard to the insides so that all the alligator clip wiring is coming out the top. From here you can slide it into the backing, tape the tab to the outside of the backing to keep it in place, and connect the wires to your buttons.
Alternatively, you can just glue the arduino/perfboard directly onto the inside of the backing but this gives you less mobility in case you want to edit your wiring.
Finishing Touches
THE CHAIR ATTACHMENT: Cut out a large rectangle from the cardboard and fold it twice at the top so most of it can fold over the back of the chair. Hot glue/tape the short end to the front of the backing (same side as the outer ring), so that the outer ring is at the same height as the wearer's headband when you fold the cardboard attachment over the chair. Next, glue two cardboard "straps" to the bottom ends of the cardboard attachment, and add velcro so that they can connect. These will wrap around the chair and cardboard backing so that the whole thing stays in place.
HEADBAND HOOK (optional): Make an itty bitty cardboard box using hot glue, tape, or whatever else floats your boat. glue this to the cardboard backing as shown in the image above so that you can hang the headband on there when it's not in use.
Final Product
To play, plug the arduino into your computer and open up the arduino code file (linked in the supplies list). Make sure that in the tools setting your board is listed as "Arduino Leonardo" and your port is also your arduino.
Extra Details
EDITING THE ARDUINO CODE: The downloadable version of the arduino code (linked in the supplies list) uses the W, A, S, and D keys to control your game. If you want to play games that use different keys, you can change each of the Keyboard.print("letter/key here"); lines to a different letter or key. So for example, the right button is currently controlled by the "D" key so in the last key code it says Keyboard.print("d"); and to change that to, say 1, you can swap a 1 for the d (so it'd read Keyboard.print("1");).
THE SPACE INVADERS GAME CODE: Although this controller works with any 4-key control computer games, I've linked a downloadable space invaders game code in the supplies list. Click on the zip file to download the javascript, CSS, and HTML codes. To open the actual game, just click on the HTML file. If you choose to switch the control keys (instructions above), and still want to play the space invaders game, make sure you change the javascript code to reflect this.
That's all! Good luck and have fun gamers!