Cyborg Computer Mouse

6,413

60

9

Introduction: 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

Step 1: 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.

Step 2: 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; }

Step 3: 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.

Step 4: Start Using Your Hand As a Mouse!

Vote for us in the Assistive Tech Contest if you enjoyed the project.

Assistive Tech Contest

Participated in the
Assistive Tech Contest

Be the First to Share

    Recommendations

    • Toys & Games Contest

      Toys & Games Contest
    • Arduino Contest

      Arduino Contest
    • Explore Science Challenge

      Explore Science Challenge

    9 Comments

    0
    BadshahS
    BadshahS

    1 year ago

    Great project, but unfortunately it will not work fine.
    your connections of fritz and connections in code does not matched..
    your Vertical/Y Axis pin of joystick connected to A2 of Arduino, but in code you define it A0.
    an extra token in line 1 when include mouse.h

    0
    abhishek.bisen2018
    abhishek.bisen2018

    1 year ago

    I have a question what protoboard are you using . double sided/single sided and the size. will be a great help. btw im making this for my project so it will be nice if you reply fast. :)

    0
    nico_rosell
    nico_rosell

    Reply 1 year ago

    You can use Leonardo, Micro and Due boards. We usted the Leonardo R3 from the brand KEYESTUDIO (model KS0248).

    0
    kamal.soni2019
    kamal.soni2019

    1 year ago

    Your Code is not working with arduino Uno micro.it showed the error on compling.

    Screenshot (3).png
    1
    Aryaveer
    Aryaveer

    Reply 1 year ago

    Bro Arduino Uno is Not Compatible with Mouse and Keyboard Functions. Only some Arduino Boards like Leonardo are Compatible. You can Google It. Also, with help of Python if you know you can use Arduino Easily. Hope this Answer Sastifies your Question

    0
    nico_rosell
    nico_rosell

    Reply 1 year ago

    Hy Kamal! I had some problems copy/pasting the arduino sketch code into my instructable. Apparently some symbols didn't get pasted right. I have checked it and now it should work right. If I could I would upload the .ino document, but I think they also have a bug with that :(

    Add " #include <Mouse.h>; " at the beggining of your code.
    Please do not hesitate to contact me if you have any further questions.

    2
    cr4wb4r
    cr4wb4r

    Tip 1 year ago

    Great project. Another idea is to press the middle and ring finger against the palm of your hand. This way one can move the mouse and click it at the same time.