Arduino Leonardo Game Controller for Quadriplegics
by samaker03 in Circuits > Assistive Tech
643 Views, 0 Favorites, 0 Comments
Arduino Leonardo Game Controller for Quadriplegics
In my engineering class our task was to design and make a game controller for quadriplegics using a DIY Makey Makey. The goal was to construct the controller using accessible and affordable materials for the ease of an everyday consumer. Using the knowledge I gained in the class I recreated a Makey Makey using an Arduino Leonardo, some additional circuitry, and simple coding. The mechanics of the game controller were made using PVC pipe, cardboard, and foil. Little to no previous coding, circuitry, and engineering skills are needed to recreate this game controller!
Very important note: You can easily use a real MakeyMakey for this project, just skip STEP 1, STEP 12 and parts of STEP 11 (basically anything that includes perfboard or Arduino Leonardo work). IF YOU ARE NOT USING A REAL MAKEYMAKEY, NO NEED FOR THE 4TH INPUT OR THE BUTTON ON THE TEE CONNECTOR. IF YOU ARE, USE IT AS THE CLICK BUTTON TO RELOAD THE PAGE.
Because of this, you should read this entire instructable in depth before beginning this project.
Supplies
- Arduino Leonardo - buy on Amazon here
- USB Micro B Cable - buy on Amazon here
- 5x7cm Perfboard - buy on Amazon here
- 3X 1-megaohm Resistors - buy on Amazon here
- 5X Jumper Wires - buy on Amazon here
- Around 15-20 Alligator Clips - buy on Amazon here
- Electrical Tape
- Solder
- Soldering Iron
- Computer
- Saw (whether that be a hacksaw, handsaw, or circular saw - whatever you have at your disposal will work)
- Belt Sander (or a tool that mocks its function)
- Around 7 feet of 1-inch (internal) PVC pipe
- Around 4 feet of 1 1/4-inch (internal) PVC pipe
- 1-inch Tee Connector (no threads)
- Bolt (of any size that's length is around 3 inches)
- Nut
- Drill (and drill bit that matches size of chosen bolt)
- 2X 1-inch PVC caps (no threads)
- 3X 1-inch 90-degree PVC elbows (no threads)
- PVC pipe Curve L (I do not know the name of this component since I found it on the floor in Home Depot. Guessing the internal diameter is around 1 inch)
- 2X 3-inch (internal) Slip Coupling
- 2X 1-inch PVC caps (no threads)
- Duct tape
- 2X Zip Ties
- 2X screws
- Cardboard
- Foil
- Hot glue
- Electrical Tape
- Around 10 feet of Velcro Strips (20 in total, for both loop and hoop) - buy on Amazon here
- Arduino Leonardo Integrated Development Environment (IDE) - provided in instructable below
- Space Invaders Code - provided in instructable below
- Moving Average Filter Library - provided in instructable below
- Optional: MakeyMakey instead of supplies #1, 2, 3, 4, 5, 8, 9, 32, 33, 34 - buy on Amazon here
DIY Makey Makey
Use the pictures above to construct your DIY Makey Makey. Notice there are 4 outputs on my perfboard. If you are making a DIY MakeyMakey, you only need 3. You will need the following supplies for this step:
- Arduino Leonardo
- USB Connector
- 5x7cm Perfboard
- 3X 1-megaohm Resistors
- 5X Jumper Wires
- 4X Alligator Clips
- Electrical Tape
- Solder
- Soldering Iron
- Computer
Unlike what I did, I suggest color coordinating the jumper wires and alligator clips so that corresponding jumper wires/alligator clips are the same color (as in picture #1, #5). It will make wiring easier both now and later. NOTES: Strip the alligator clips to connect them to the jumper wires (as in picture #5, #6). Position the components on the perfboard in a compact fashion so that solely solder will be used to connect them (as in picture #3). After the components are soldered, place a strip of electrical tape and lay it over the origin of the alligator clips to prevent cross-signaling between wires. The black jumper wire and alligator clip (as in picture #6) is the ground wire - once touched to the tips of other alligator clips it will complete each individual circuit. We will test our circuits later.
PVC Pipe Sawing, Sanding, and Drilling
This step is all sanding and sawing PVC pipe, so get out your favorite saw! The following supplies are needed for this step:
- Saw (whether that be a hacksaw, handsaw, or circular saw - whatever you have at your disposal will work)
- Belt Sander (or a tool that mocks its function)
- Around 7 feet of 1-inch (internal) PVC pipe
- Around 4 feet of 1 1/4-inch (internal) PVC pipe
- 1-inch Tee Connector (no threads)
- Bolt (of any size that's length is around 3 inches)
- Nut
- Drill (and drill bit that matches size of chosen bolt)
Measure the 1 1/4-inch PVC pipe to 30 inches and cut.
Measure the 1-inch PVC pipe to 26 inches and cut. Measure the remaining piece to 11 inches and cut. Measure the remaining piece to 8 inches and cut. Measure the remaining piece to 3 inches and cut. Measure the remaining piece 3 inches and cut.
Now for the drilling! In the 30 inch 1 1/4-inch pipe drill a hole centered at 6 inches from one end (drill through both sides). In the 26 inch 1-inch pipe drill holes 2 1/2 inches apart, starting at 8 inches from the 1-inch's end. Make sure to drill all the way through both sides of the pipe. After drilling, place the 1-inch pipe inside the 1 1/4-inch pipe and place a bolt through one of the holes and secure it with its nut. Now your controller's height will be adjustable!
Now for the sawing! I used a belt sander but I understand that most do not have this tool readily available. You can use alternatives such as making fine cuts or hand sanding it instead.
Take out your two 11 inch and 8 inch 1-inch PVC pipes and your 1 1/4-inch Tee Connector. From the end of both pipes, measure 4 inches and make a 1 1/4 line. From the horizontal section of the Tee Connector measure 1/4 inches and begin the 1 1/4 inch line there. Perpendicular to all three lines created, make a 2 1/2 inch line to make a 90-degree corner. Finish the started rectangle. Belt sand (or however you have chosen to go about this) that rectangle out from the PVC pipes and Tee Connector.
You can put your power tools away FOR NOW. Time to assemble!
Assembly of the Structure Part 1.
Now for the fun part. The following supplies are needed in addition to the last step's:
- 2X 1-inch PVC caps (no threads)
- 3X 1-inch 90-degree PVC elbows (no threads)
- PVC pipe Curve L (I do not know the name of this component since I found it on the floor in Home Depot)
On the end of the 8 inch 1-inch PVC pipes, place a 1 1/4-inch PVC cap. Take the 11 inch 1-inch PVC pipe and put one 90-degree elbow. On the other ends of BOTH the 8 inch and 11 inch 1-inch pipes, place the 1 1/4 inch 90-degree PVC elbows. Be sure to not force these too tight otherwise it will be difficult to remove later on.
Take the two 3 inch 1-inch PVC pipes and place them into the other ends of the 90-degree elbows. Facing the Tee Connector's hole inwards, place it between the 3 inch 1/2-inch pipes. See picture.
Fit the 1-inch pipe (that is inside the 1 1/4-inch pipe) inside the remaining hole in the Tee Connector.
Almost done with the bones!
Assembly of the Structure Part 2
This is part 2 of the last step. I figured I would break it up for ease of reading and comprehension. The following supplies are needed for this step:
- 2X 3-inch (internal) Slip Coupling
- 2X 1-inch PVC caps (no threads)
- Duct tape
- 2X Zip Ties
- Saw
- 2X screws
- Drill
This part of this step will need to be done customized to the chair you will be using for gaming. Using the approx. thickness of the back of your chair, cut a section out of both slip couplings to create a clamp. You can do this by laying the slip couplings flat on a table and using a ruler to mark two points of sawing (see pictures). Each chair will need a different opening in the slip coupling for the best fit.
Once this has been done, measure around 8 1/2 inches from each end of the lone 1-inch PVC pipe and make two marks. Place the slip couplings at this point, with the opening facing downwards, and screw them into the pipe (see picture#).
Fit the two remaining 1 1/4-inch caps around the ends of the lone 1-inch pipe. Find the middle of the pipe and make another mark (lots of marking!).
2 inches from the top of the 1-inch PVC pipe (outside the 1/2-inch PVC pipe) and place a mark on the nut-side of the pole. (Be sure to measure from the same end you did before). Making sure the two are perpendicular, take the pipe with with the slip couplings and line its middle-mark up with the 1 1/4-inch pipe's mark. Tighten zip ties around the intersection in a criss cross and secure with duct tape (see picture #1).
Phew! The main structure is done. Review the photos to make sure each component is facing the correct direction.
Buttons: Left, Right, Shoot, Click
We are making buttons! Yay! The following are needed for this step:
- Cardboard
- Foil
- Hot glue
- 4X Alligator clips
Cut three 1 inch X 2 3/4 inch cardboard rectangles. Cut a cardboard circle with a diameter of 1 1/2 inches. Make a cardboard box with dimensions with W: 1 1/4 inch H: 1 inch D: 2 inches. Connect all the sides using hot glue. Make four 3/4 inch in length rectangles.
Wrap foil around each of the components. Be sure to not use too much foil because the circuit will have a hard time completing otherwise. On each 1 inch X 2 3/4 rectangles AND the 1 1/2 inch circle, hot glue the 3/4 inch tabs, with each long side of the rectangles and tabs parallel to on another. Take the box and glue the short side (1 1/4) to one of the large cardboard rectangles.
Attach 4 different-colored alligator clips to each tab on the components. Attach on the short side of the tabs. Secure the connection with electrical tape.You are working towards creating the above image.
Wiring Alligator Clips
For this step you may need to disassemble some (or all) components to snake the wiring through. Keep that in mind through this entire step. The following supplies are needed for this step:
- LOTS of Alligator Clips
- Electrical Tape
Attach at least 4 additional alligator clips to EACH of the ends of the alligator clips originating from the tabs. This will create 4 long strings of alligator clips (they should all be the same color within the same string, but different from string to string).
Secure the connections between each alligator clip with electrical tape. Write down which color of wire corresponds to each button. The two rectangles are move left and right, the box is click/reload, and circle is shoot.
Now place the two rectangles snuggly in the holes in the 8 inch and 11 inch pipes. Drop the alligator clips in first and snake them through the PVC pipes/elbows to reach the Tee Connector so that they drop off the bottom hole and into the 1 1/4 inch and 1 inch poles. Then glue the rectangles to the hole.
Repeat for both the shoot and reload/click button. OPTIONAL: if you want to make your wiring extra clean, once the alligator clips drop from the Tee Connector you can tie them all together using electrical tape.
Velcro Straps
Now it is time to create straps for stability. The following supplies are needed for this step:
- 10 feet of Velcro Strips
- Hot Glue
Cut two around 4 foot velcro strips (hook). On each side of the reload/click button, hot glue the strips with the velcro facing downwards (as in picture #1).
Cut a 4-5 foot (depending on person and chair size) velcro strip (loop). Mark the middle of the velcro strip. Measure 2 inches below the hole in the 1 1/4 inch pole and make a mark. Hot glue the velcro strip horizontally to the pole (with velcro facing outside), meeting the two marks together (see pictures).
Cut a 3 inch velcro strip (hook) and glue it onto the inside of the 4-5 foot velcro strip.
DIY MakeyMakey Storage Box
You are almost done with the controller! You've made it this far! The following supplies are needed for this step:
- Cardboard
- Hot Glue
Cut a cardboard rectangle with a width of 2 inches and a length of around 6 inches. Wrap the rectangle around the 1 1/4 inch pipe and mark where there is overlap. Hot glue the rectangle into a fitted circle.
Cut a cardboard rectangle with a width of 7 inches and a length of 5 inches. In the center of the rectangle, use the cardboard circle to make a circle. Cut it out. Hot glue the circle into the created hole.
Cut another cardboard rectangle with a width of 7 inches and a length of 5 inches (bottom). Cut two rectangles with a width of 5 inches and a length of 4 inches (sides). Cut one more cardboard rectangle with a width of 7 inches and a length of 4 inches (back).
Ground Wire and Ring
This step is the simplest of them all! The following are needed for this step:
- 2X alligator clips (both the same color as the ground wire from perfboard)
- Cardboard
- Hot Glue
- Foil
Cut a rectangle that will fit into a ring around your pointer finger. Hot glue it in place. Wrap foil around the ring, careful to not layer too much foil.
Connect two alligator clips together then connect them to the ground alligator clip on the perfboard. Secure the connections with electrical tape.
Take the end of the long alligator clips and connect it to the ring. Secure the connection with electrical tape. In my first attempt of this project, I made an armband instead of a ring. The above picture is the same idea except not a ring.
Piecing It All Together
Glue the perfboard and Arduino Leonardo onto the bottom piece. Attach the perfboard alligator clips to the corresponding button alligator clips (you can choose any output you'd like, just write what goes where ex: Shoot is output A0). Glue the pieces together to make a box (see picture from Step 8). The above picture has an extra wire.
Download Arduino Leonardo IDE and Space Invaders
For this step you will only need your computer (PC or Mac).
- For the Arduino Leonardo Integrated Development Environment (IDE) download click here. Follow the prompts.
- For the Space Invaders code, open it here and download onto computer.
- For the Moving Average Filter Library, open it here and download onto computer.
Search in your computer library "Space Invaders" and the second download should appear. Open the file and double-click "index.html". The Space Invaders game will appear.
Reopen the Arduino Leonardo IDE and select "Sketch" in the navigation bar (for Macs). Hover over "Include Libraries" and select "Add .ZIP library...". In downloads, find Moving-Avarage-Filter and select.
To insert Makey Makey code, stay in the IDE and navigate to the "File" button in the navigation bar (for Macs). Select "Open..." and search for "DIY_MakeyMakey_Code_.ino".
Now, plug the USB connector from your computer to the Arduino Leonardo. Select "Tools" in the navigation bar (for Macs) and hover over "Board". Select Arduino Leonardo from the list. Select "Tools" again and hover over "Port" and select "Arduino Leonardo". On the main page of the IDE, select "Upload" or the right arrow button. In the upper right-hand corner select the serial monitor by clicking on the magnifying glass symbol.
Now test your circuitry skills! Touch the ground ring and button together and letters should appear on the monitor. Write down which button represents each letter.
Coding
Time to change the code of the Space Invaders game to match the code of the Arduino Leonardo IDE! The following supplies are needed for this step:
- Computer
- Space Invaders Code
Find the Space Invaders code located in your computer files. Click on the drop down menu provided in the fie and right select "script.js". For Macs, select TextEdit to open the file. For PC, select Notepad to open the file.
Find "function moveShooter(e)" and you will see "case 'ArrowLeft'" a few lines of code underneath it. Edit the ArrowLeft to the corresponding letter from the last step. Do the same for "case 'ArrowRight'", "case 'ArrowUp':".
You may now play a game with this controller for quadraplegics. Make sure to tie any long hair up, because typically hair is not conductive!
REMINDER:
- Left button- moves shooter left
- Right button - moves shooter right
- (Back button - reload/click)
- Mouth/circle button - shoots