Introduction: MouseGlove 2.0 - for Everyday Use and VR
This is a project I've been working on for a couple of months. It uses a gyroscope sensor to detect how the glove moves, and move the cursor accordingly, and flex sensors to detect if your fingers are bent and activate the left and right mouse buttons. When you click, the glove buzzes a motor to simulate feedback, as if it were an actual mouse click. If your ring finger is not bent, the cursor will not move, this feature allows you to adjust the position of your hand easily. The microcontroller I used for this project was the Adafruit Bluefruit Feather (I intended to use Bluetooth and make it function wirelessly), but Adafruit's Pro Trinket is a cheaper alternative. In the GIF, I'm playing Skyrim with the glove, the ring finger sensor allows me to easily pan around, and the glove makes the game feel a lot more interactive!
Gyroscope Sensor -
Cheaper Adafruit Model (accelerometer)-
Flex Sensors - You will need a flex sensor for each finger you intend to map
Adafruit ProTrinket - I suggest the 3V version, it's all you'll need to power the flex sensors
Vibrating Motor - The one I used was from RadioShack
10K resistor (Brown Black Gold) - at least 3, used with the flex sensors
Step 1: The Flex Sensors
The flex sensors are really what ties this project together. In the previous edition of my mouse glove, I used tinfoil on my fingers as a sort of contact sensor with my thumb, but the flex sensors are a lot easier to use, and they were fairly easy to incorporate into my design and code. Like with all of their projects, Adafruit supplied an extensive tutorial on the proper use of flex sensors. You'll need the resistors here, but Adafruit explains that.
The sensors were sown into the glove, and glued at the tip so they could not slide out, so far this method has been very successful, although if you plan to solder the sensors to wires, you'll want to go ahead and do that before you glue them in. I also added some extra glue to the headers, so that I wouldn't have any problems in the future with a crossed wire.
An example of some code you could use with the flex sensors:
int ringPot = analogRead(A0);
if(ringPot < 750) //less resistance, as finger is bent more, test this with serial output, until you find an acceptable limit
//insert function here
Step 2: The Motor
The vibrating motor was a very simple addition to the glove, I just had to connect the positive end to a GPIO pin (and the negative to ground), and then I used PWM to operate it, but digitalWrite(HIGH) will work just as well.
An example of some code that you could use to activate the buzzer:
if(ringPot < 750) //statement from previous step
digitalWrite(BUZZER, HIGH); //turns motor on
delay(25); //waits 25 ticks
digitalWrite(BUZZER, LOW); //turns motor off
//function to click mouse
/*don't forget to declare the motor in your setup and use a constant variable to declare BUZZER as a pin*/
Step 3: The Code
Since I wouldn't recommend the gyroscope I used, I won't post the code I wrote for the glove. Fortunately I found a tutorial on Adafruit that explains how to use an accelerometer with the Arduino Mouse Commands and an I2C connection (Unfortunately I didn't see this before I made my glove).
This is a link to the official Arduino MouseKeyboard reference that I used. It has a Mouse.move() and a Mouse.press() function, both of which I used in my code.
Step 4: The Final Touches / Fully Operational
Finally, I used heat-shrink tubing to strengthen my soldering connections, and prevent them from wearing out. As you can see in the picture, I used a breadboard to make the connections to the microcontroller, but Adafruit also sells some pretty cool permaboards that would work well also, if you were interested in a more permanent project.
If you do plan to use a non-flexible board, I would suggest only using one long strip of hot glue to attatch the board to the glove, this prevents the board from pulling on the fabric. I spread the glue from the knuckle of my index finger, down to the bottom right of (the top of) my hand.