Arduino Leonardo Game Controller for Quadriplegics
by gabriellaRenteria in Circuits > Assistive Tech
325 Views, 1 Favorites, 0 Comments
Arduino Leonardo Game Controller for Quadriplegics
The goal of this project was to create a controller for quadriplegics/tetraplegics out of cheap materials that can be an alternative to expensive controllers. This controller uses a headband and the movement of your head to press buttons that are wired to an Arduino Leonardo. It uses mostly household materials or things you can buy for cheap on amazon. The exception is the Arduino Leonardo or the more expensive alternative the Makey Makey. Have fun building!
Supplies
Cardboard Box (use any rectangular box)
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
Diy Makey Makey code:
//1
#include
#include
//2
MovingAverageFilter movingAverageFilter(20);
MovingAverageFilter movingAverageFilter1(20);
MovingAverageFilter movingAverageFilter2(20);
//MovingAverageFilter movingAverageFilter3(20);
//3
boolean check = false;
boolean check1 = false;
boolean check2 = false;
//boolean check3 = false;
//4
void setup() {
Serial.begin(115200);
}
//5
void loop() {
//6
float input = analogRead(0);
float input1 = analogRead(1);
float input2 = analogRead(2);
//float input3 = analogRead(3);
//7
float output = 0;
float output1 = 0;
float output2 = 0;
//float output3 = 0;
//8
output = movingAverageFilter.process(input);
output1 = movingAverageFilter1.process(input1);
output2 = movingAverageFilter2.process(input2);
//output3 = movingAverageFilter3.process(input3);
//9
//// key "d"///////////////////////////////////////////////////
if (output < 200 ) {
if (!check){
Keyboard.print("d");
Serial.println(output);
check = !check;
}
}
if (output >600) {
if (check){
check = !check;
}
}
//// key "a"///////////////////////////////////////////////////
if (output1 < 200 ) {
if (!check1){
Keyboard.print("a");
Serial.println(output1);
check1 = !check1;
}
}
if (output1 >600) {
if (check1){
check1 = !check1;
}
}
//// key " "///////////////////////////////////////////////////
if (output2 < 200 ) {
if (!check2){
Keyboard.print(" ");
Serial.println(output2);
check2 = !check2;
}
}
if (output2 >600) {
if (check2){
check2 = !check2;
}
}
}
//// key "H"///////////////////////////////////////////////////
//if (output3 < 200 ) {
//if (!check3){
//Keyboard.print("h");
//Serial.println(output3);
//check3 = !check3;
// }
// }
//if (output3 >600) {
// if (check3){
//check3 = !check3;
//}
//}
//}
Soldering the Circuit
- 1 jumper cable will connect to the 5V power on the Arduino to the first row on the perf board. You will need to run a wire length-wise across all 3 of the resistors from the power wire. The first and second images are color-coded:
- RED is the power;
- BLUE is the three separate resistors;
- BLACK is the ground.
- There are three jumper cables coming off of the Arduino: Yellow: A0; Green: A1; Orange; A2. Each one of those jumper cables runs to a different row on the perf board. Then each one of those jumper cables connects to a different end of a resistor. The other end of that resistor connects to the power wire. From the end of the resistor that the jumper cable is connected to you connect an alligator clip, whose end was cut off. That way you have three different alligator clip wires coming off.
- Then connect the ground wire, BLACK. Connect a jumper cable to one of the GND ports on the Arduino. From their solder that jumper cable to the far corner of the perf board, we DON'T want the ground to touch any of the wires connected to the power and resistors. From that spot solder another alligator clip, with no end.
- Lastly, clip an alligator clip to the black wire (the ground) and string it through the circular hole. (see picture, right).
- Plug in the micro usb cord into the Arduino Leonardo and string it through the rectangular hole. (see picture, left).
Build the Head Set
- Cut out 6 pieces to make a rectangular cardboard box to fit the circuit.
- Hot glue the sides of the box together but tape the top of it so it can be taken off if the wiring needs to be checked (the box will be vertical on the headset).
- Poke holes in the side for the wires
- Green = shoot; front
- Yellow = move left; left side
- Orange = move right; right side
- Cut a vertical strip of foam board (length is up to you, this will velcro around your head). Tip: Use a table and slide the foam board down the edge of the table to make it more malleable.
- Cut strips of velcro and hot glue one to the front of the strip of foam board and the other to the back of the strip.
- Cover a section on the front, left, and right, of the head band with aluminum foil. This is where you'll attach the color corrispinging alligator clips.
- Fold small pieces of aluminum foil to make stronger conductivity points. (Make 5 of them, 3 for the headset and 2 for the ground.
Wire the Head Set
- Glue the folded pieces of aluminum to where you clued the aluminum foil on the front and sides.
- Add a piece of electrical tape over for extra conductivity.
- Make sure to clip the alligator clips so there's clear contact between the aluminum and the clip.
- Green goes to the front of the band.
- Yellow goes on the left side of the band.
- Orange goes on the right side of the band.
Make the Shoot Button
- Cut a circle out of cardboard and cover it in aluminum foil to make it conductive.
- Cut a strip of wire and push it into the cardboard on top of the box. Hot glue that end in place.
- Then bend it into an L shape and glue the other end to theto the button.
Make the Ground
- Cut the one of the front panels on the box off, sort of making a window in the box.
- Then cut two arches in the sides of the box.
- Cut a pool noodle in half and then cut that half in half again vertically making two quarter noodles for each side of the box.
- Hot glue the noodles to the cut sides of the box.
- Fold aluminum 3 - 4 times to make strips and glue them roughly 2 inches from the top of the box on every side (its okay if it too long it will get folded over).
- Fold the ends of the strip over the sides of the box.
- Glue the pieces of folded aluminum to the button and the folded over end of aluminum on the right side. That will complete the ground for the controller.
- Add a piece of electrical tape over for extra security and conductivity.
Wire the Ground
- Use scissors to make a dime sized hole in the very middle back of the aluminum strip.
- Use 3 black alligator clips to daisy chain (clip the end of the alligator clips together) the ground and extend it through the hole you just made. Make sure the last two alligator clips are double up on one clip so you have two ground clips.
- Clip one ground to the shoot button
- The other ground goes to the right side of the folded over aluminum strip.
Plug It All in
- Plug in the micro usb cord from the headset to your computer (use the USB to USB-C adapter if need be).
- Upload the html space invaders game CLICK HERE
- And lastly, have fun!!!!