Final: Soft game controller

For my final project I want to re-do the game controller, but with the haptic feedback we did for the music controller. In my first attempt at the game controller, I made a hard controller but with soft buttons using conductive fabric (which is typically how I make soft buttons). The biggest takeaway I had was that people couldn’t tell if they had pressed a button or not, as they did not hear the typical clicking noise you get when you press a regular tactile push button. I thought for this project I could have a vibration feedback to help the user know when they press a button. And since I wanted to also challenge myself to make a soft controller, I thought a vibration would be easily felt throughout the controller, regardless of where the user’s hands are placed.

My inspiration for the outside design:

I am not sure what these portable tables are called, but the closest definition would be a cushion table. To achieve this, I started by making a pillow using a jersey fabric I found in the soft lab and stuffed it with stuffing to make it soft. I made a button board using copper tape  (my new found love for making soft buttons), a soft felt, and a harder felt. I decided to do this, so I could easily take board out to fix all the buttons together. It took a long time of testing to get the buttons working consistently, as soft buttons tend to wear down, or stick together.

 

Materials:

Arduino Leonardo

Breadboard

Wire

220 ohm resistors

vibration motor

jersey fabric

copper tape

felt

foam

stuffing

cardboard

Fritzing:

//code//

#include <Keyboard.h>

//keyboard variablesiables

int buttonA = 3;
int buttonD = 4;
int buttonW = 6;
int buttonS = 7;

int reload = 8;
int enter = 9;

int feedback = 10;

int previousButtonStateA = LOW;
int previousButtonStateD = LOW;
int previousButtonStateW = LOW;
int previousButtonStateS = LOW;
void setup() {
// put your setup code here, to run once:
pinMode(buttonA, INPUT);
pinMode(buttonD, INPUT);
pinMode(buttonW, INPUT);
pinMode(buttonS, INPUT);

pinMode(feedback, OUTPUT);
Keyboard.begin();
}

void loop() {
// put your main code here, to run repeatedly:
//8
if (digitalRead(reload) == HIGH) {
Keyboard.press(135);
Keyboard.press(‘r’);
Serial.println(“reload”);
analogWrite(feedback, 125);
delay(1000);
} else {
Keyboard.releaseAll();
analogWrite(feedback, 0);
}
// 9
if (digitalRead(enter) == HIGH) {
Keyboard.press(176);
Serial.println(“enter”);
analogWrite(feedback, 125);
delay(1000);

} else {
Keyboard.release(176);
analogWrite(feedback, 0);

}

//yellow
int buttonStateA = digitalRead(buttonA);

if ((buttonStateA != previousButtonStateA) && (buttonStateA == HIGH)) {
Keyboard.press(KEY_LEFT_ARROW);
Serial.println(“left”);
analogWrite(feedback, 125);
delay(500);
} else if (digitalRead(buttonStateA) == LOW) {
Keyboard.release(KEY_LEFT_ARROW);
digitalWrite(feedback, LOW);
analogWrite(feedback, 0);
}

//blue
int buttonStateD = digitalRead(buttonD);

if ((buttonStateD != previousButtonStateD) && (buttonStateD == HIGH)) {
Keyboard.press(KEY_DOWN_ARROW);
analogWrite(feedback, 125);
delay(1000);
Serial.println(“down”);
} else if (digitalRead(buttonStateD) == LOW) {
Keyboard.release(KEY_RIGHT_ARROW);
analogWrite(feedback, 0);
}

//red
int buttonStateW = digitalRead(buttonW);
if ((buttonStateW != previousButtonStateW) && (buttonStateW == HIGH)) {
Keyboard.press(KEY_UP_ARROW);
analogWrite(feedback, 125);
Serial.println(“up”);
delay(1000);
} else if (digitalRead(buttonStateW) == LOW) {
Keyboard.release(KEY_UP_ARROW);
analogWrite(feedback, 0);
}

//white
int buttonStateS = digitalRead(buttonS);

if ((buttonStateS != previousButtonStateS) && (buttonStateS == HIGH)) {
Keyboard.press(KEY_RIGHT_ARROW);
analogWrite(feedback, 125);
Serial.println(“right”);
delay(1000);
} else if (digitalRead(buttonStateS) == LOW) {
Keyboard.release(KEY_DOWN_ARROW);
analogWrite(feedback, 0);
}

}