Introduction: Wireless Mouse Glove
This Instructable is for my final project for the course Wearble Technologies at the University of Colorado Boulder. The aim of this project is to make a wireless mouse using a Bluetooth technology. The main goal of the project is to make this mouse wearable using hand glove.The wireless feature of the glove makes it attracting to hobbyists.
Thus, by making it wearable the user should be able to use the mouse seamlessly. The mouse has following functionalities.
- Left Click
- Right Click
- Double Click
- Cursor Movement
- Screen Capture
Step 1: Required Hardware Components
Following are the components requried to build this project
Step 2: Setting Up Hardware
To set up the hardware for this project please follow these steps.
- To boot your Raspberry Pi, please follow this link to create a bootable SD card.
- Test your Pi
- Solder the accelerometer with the Male header pins. Sew the accelerometer with the glove as shown in the image. Twist the wires in the clockwise direction which will result in neat and clean product.
- To make the glove follow these steps.
- Keep the glove inside out
- Use snap buttons or M/F jumber wires. Sew the jumber wires with the glove as shown in the image.
- Connect the jumper wires to Pi GPIO pin headers.
- Twist the wires.
Finally, sew the Pi with your glove.
One can use the snap buttons and conductive thread to keep make the product more crafty and easy to wear. Due to current situation and unavailability of the soldering kit using snap buttons and conductive was not feasible to use.
Step 3: Wiring Your Hardware
- Wiring the Accelerometer
To wire acceleromter with the Raspberry Pi we need to know the pin functionalities of required pins on the Pi and accelerometer.
Follw this link to get yourself familiar with pin functionalities of the pi.
For the acceleromter look on the circuit carefully to idenfity each pins functions.
Here's the pin mapping for our accelerometer and RPi. Use F/F jumber wires for your connection.
Accelerometer Pin ---> RPi Pin
GND --> Ground
VCC --> 3V3 Power (1)
SDA --> BCM2 (SDA)
SCL --> BCM3 (SCL)
- Wiring Snap Buttons/Jumper Wires
The snap buttons/jumper wires are use to detect the click functions of the mouse buttons. As we will be using four fingers and a thumb here's the pin mapping to achieve the desired functionalities.
Thumb Wire --> 3V3 Power (17)
Index Finger --> BCM4
Middle Finger --> BCM17
Ring Finger --> BCM27
Pinky Finer --> BCM22
How the above connection will work to detect the click? In order to detect the mouse click, the user need to touch the finger with the thumb. Once the connection is made the RPi will detect the interrupt on the pin and mouse action will be triggered by sending the appropriate command via bluetooth.
Step 4: Developing the Software
To make your hardware work, you will need to write the software. This project involves following major software part.
- Bluetooth Client
- Bluetooth Server
- Accelerometer Integration
- Mouse actions
In our project, the mouse glove works as a bluetooth client while the laptop will act as a bluetooth server. We will use RFCOMM feature of the Bluetooth to communicate with the client and server.
The bluetooth client part also has the accelerometer to integrate to detect the mouse movements. Each part is discussed briefly in the following steps.
Step 5: Mouse Glove - Bluetooth Client Software
The code in the above image establishes a connection with the server.
uuid: is the ID of the custom bluetooth service we will be using
addr: is the address of the server ie bluetooth address (MAC address) of your laptop.
Our server will continusouly in the advertising mode. The advertising data will contain the service id, port number, service name and host address.
Once found we attempt to connect to the found address and port number.
In the other images, as you can see, we are using Pi GPIOs to setup and read pin/channel number to detect which finger was pressed and accordingly sending the message to the server.
Below is the interpretation of eahc fingure press.
Index Finger --> Mouse Left Click
Middle Finger --> Mouse Right Click
Ring Finger --> Mouse Double Click
Pinky Finger --> Screen Capture (Image will be saved automatically in the current directory)
Attachments
Step 6: Laptop - Bluetooth Server Software
To develop a software for the server, your laptop should be running on the Ubuntu Linux OS. Following are the dependencies required in order to make the software work as required. Follow the links for instructions to install them.
As you can see in the images above, we are opening a port for the communication and then starting the advertising of the bluetooth service.
Once client is connected the software continuously checks for the incoming messaged and takes required action.