Cyborg Computer Mouse
Many studies suggest that the posture of using a conventional computer mouse can be hazardous.The mouse is a standard piece of computer equipment. Computer users use the mouse almost three times as much as the keyboard. As exposure rates are high, improving upper extremity posture while using a computer mouse is very important.
For this abstract project we will be making a wearable that allows people to move through a computer screen without the necessity of external technology. That way we could use the hands natural movements instead of clicking a device on a horizontal surface. This also allows to use screens while standing, making oral presentations more pleasant.
As for the prototype will be using the index as a joystick, the middle finger for left clicking, ring finger for right clicking and the pinky for turning on and off the device. The thumb will act as the surface where the buttons get pressed at. All of which will be added into a glove.
Supplies
- (x1) Arduino Leonardo
- (x1) Protoboard
- (x1) Joystick module
- (x3) Pushbutton
- (x20±) Wire jumpers
- (x3)Resistors of 1KΩ
- (x1) Glove sewing kit
- Velcro Hot silicone
- Wire Soldering kit
- 3D printed part
Set Up the Hardware
We have included a Fritzing sketch for a better understanding of the design. We recommend mounting the components on a protoboard first. That way you can check that everything is working before soldering.
Downloads
Upload the Code and Test
Once the connections are made connect the USB A (M) to micro USB B (M) from the computer to the Arduino Leonardo and upload the sketch. Feel free to copy, modify and improve on the sketch.
WARNING: When you use the Mouse.move() command, the Arduino takes over your mouse! Make sure you have control before you use the command. It only works for Arduino Leonardo, Micro or Due
Here is our code for this project:
// Define Pins
#include <Mouse.h> ; const int mouseMiddleButton = 2; // input pin for the mouse middle Button const int startEmulation = 3; // switch to turn on and off mouse emulation const int mouseLeftButton = 4; // input pin for the mouse left Button const int mouseRightButton = 5; // input pin for the mouse right Button const int joystickX = A1; // joystick X axis const int joystickY = A0; // joystick Y axis// parameters for reading the joystick: int cursorSpeed = 10; // output speed of X or Y movement int responseDelay = 5; // response delay of the mouse, in ms int threshold = cursorSpeed / 4; // resting threshold int center = cursorSpeed / 2; // resting position value int mouseMiddleState = 0;
boolean mouseIsActive = false; // whether or not to control the mouse int lastSwitchState = LOW; // previous switch state
void setup() { pinMode(startEmulation, INPUT); // the switch pin pinMode(mouseMiddleButton, INPUT); // the middle mouse button pin pinMode(mouseLeftButton, INPUT); // the left mouse button pin pinMode(mouseRightButton, INPUT); // the right mouse button pin
Mouse.begin(); // take control of the mouse }
void loop() { // read the switch: int switchState = digitalRead(startEmulation);
// if it's changed and it's high, toggle the mouse state: if (switchState != lastSwitchState) { if (switchState == LOW) { mouseIsActive = !mouseIsActive; } }
// save switch state for next loop: lastSwitchState = switchState;
// read and scale the two axes: int xReading = readAxis(A1); int yReading = readAxis(A0);
// if the mouse control state is active, move the mouse: if (mouseIsActive) { Mouse.move(xReading, yReading, 0); // (x, y, scroll mouse wheel) }
//LEFT // read the mouse button and click or not click: // if the mouse button is pressed: if (digitalRead(mouseLeftButton) == HIGH) { // if the mouse is not pressed, press it: if (!Mouse.isPressed(MOUSE_LEFT)) { Mouse.press(MOUSE_LEFT); delay(100); // delay to enable single and double-click Mouse.release(MOUSE_LEFT); } }
// else the mouse button is not pressed: else { // if the mouse is pressed, release it: if (Mouse.isPressed(MOUSE_LEFT)) { Mouse.release(MOUSE_LEFT); } }
//RIGHT // read the mouse button and click or not click: // if the mouse button is pressed: if (digitalRead(mouseRightButton) == HIGH) { // if the mouse is not pressed, press it: if (!Mouse.isPressed(MOUSE_RIGHT)) { Mouse.press(MOUSE_RIGHT); delay(100); // delay to enable single and double-click Mouse.release(MOUSE_RIGHT); } }
// else the mouse button is not pressed: else { // if the mouse is pressed, release it: if (Mouse.isPressed(MOUSE_RIGHT)) { Mouse.release(MOUSE_RIGHT); } }
//MIDDLE // read the mouse button and click or not click: // if the mouse button is pressed: if (digitalRead(mouseMiddleButton) == HIGH) { // if the mouse is not pressed, press it: if (!Mouse.isPressed(MOUSE_MIDDLE) && mouseMiddleState == 0) { Mouse.press(MOUSE_MIDDLE); mouseMiddleState = 1 ; //actualiza el estado del botón } }
// else the mouse button is not pressed: else { // if the mouse is pressed, release it: if (Mouse.isPressed(MOUSE_MIDDLE) && mouseMiddleState == 1 ) { Mouse.release(MOUSE_MIDDLE); mouseMiddleState = 0; } }
delay(responseDelay); }
/* reads an axis (0 or 1 for x or y) and scales the analog input range to a range from 0 to */
int readAxis(int thisAxis) { // read the analog input: int reading = analogRead(thisAxis);
// map the reading from the analog input range to the output range: reading = map(reading, 0, 1023, 0, cursorSpeed);
// if the output reading is outside from the // rest position threshold, use it: int distance = reading - center;
if (abs(distance) < threshold) { distance = 0; }
// return the distance for this axis: return distance; }
Mounting the Prototype
The first step is sewing the velcro to the glove, you have to sew four strips of velcro one to each finger. We sewed the soft part of the velcro.
Each pushbutton has two wires, one that starts at the respective pins and connects to the positive leg of the button and another on the negative leg. At the other end of the negative wire we solder the resistances of each button plus the negative wire of the joystick to one last wire, which connects to the GND of the Arduino board. The same parallel connection works for the positive side. (3 buttons and joystick positive leg)
After soldering the jumpers we will put on the hard velcro-strips, so that the wires will get stuck in between. Lastly we thermo-glued the joystick module to a 3D printed piece. Below you can find the .STL file.
Downloads
Start Using Your Hand As a Mouse!
Vote for us in the Assistive Tech Contest if you enjoyed the project.