Introduction: Arduino Mouse Control Glove
So for my school project I made an Arduino glove that can control your cursor with an accelerometer. In a few simple steps I'm gonna show you how to replicate this process.
Step 1: Requirements
You'll need a couple of things to make this project yourself:
- 1 Arduino Pro Micro
- 1 MPU-6050 accelerometer and gyroscope
- 1 glove (preferably wool)
- Mini-USB to USB cable
- A couple/dozen of cables
- A 10k Ohm resistor
- An Arduino button
- Breadboard or preferably a copper board
- Soldering equipment
Step 2: Code and Software
Firstly you'll need to install the Arduino IDE software where you'll write the code. Secondly you,ll need to download a couple of libraries that help with communicating to the chip:
You will have to move the MPU6050 library to the folder libraries in your Arduino folder. Then we'll use this code as a base: http://www.mrhobbytronics.com/wp-content/uploads/2...
You can cut out the lines with "buttonstate2" and "button 2" unless if you wanna add a right click feature.
That's all you need, now let's get building!
Step 3: Wiring
Now you are lucky since the wiring is pretty simple! We'll need less than a dozen wires depending if you use a breadboard or copper board.
First we'll talk about wiring the sensor/accelerometer. To power the sensor you'll need to connect the VCC port on the Pro Micro to the first port of the sensor also called VCC. Then connect the ground pin to the second pin right beneath the VCC on the sensor. Then you need to get the data through so you use 2 extra wires. Those are connected to the digital pins ( digital pin 2 and 3). The SCL is connected to pin 3 and the SDA to pin 2.
Now let's connect the button! You'll also need to connect the button to the VCC and ground first so it get current. You'll have to connect the VCC to a 10k ohm resistor and then that resistor to the button. Then you'll need to connect it to a digital pin (here pin 6). If everything works the lights on the sensor and on the Arduino should burn when plugged into the USB port of your pc.
Step 4: Assembling Glove
Now at this moment personal tasts come into play. You already have everything you need but can decide to 3D print a casing or a custom glove. When prototyping you can just use special textile tape to keep everything in place.
The button has to be taped to the thumb with the button facing upward. You can tape around de button where de cables and button meet. You can also bind the wire or tape it multiple times if they are a bit long and unhandy.
Now with the sensor it's very important to position it right so that the control works right. When you test it out you'll see in which direction the cursor moves and can adept if necessary. But I would recommend making it so that the text for the pins can be read when you wear the glove. The sensor should go on the forefinger. Tape the sensor very well and also keep the wires connected to the pins.
Next up you''l need to connect the breadboard and Arduino to the glove or the case in which they reside. The most important thing here is that the mini-usb port should be pointed downwards so that the cable plugged-in doesn't tangle between your fingers.
Step 5: Testing Your Prototype!
Now to test everything you need to plug in the Arduino Pro Micro using the Mini-usb to usb cable. Then boot up Arduino IDE and open the AccelerometerMouse file. Upload the code to the arduino and done! You should see the mouse cursor move as you move the accelerometer on your finger.
Step 6: Additions
If you like the prototype you can always add some features. You can also add a neat casing. This can be lasercutted or 3D-printed,as long as it's portable on your glove. If you are advanced enough you could also add gestures for specific actions. The possibilities are endless!