Introduction: A Smart Glove Computer Mouse
This is a "Smart Glove" computer mouse that can be used with any PC, Mac, or Linux computer. It's made using a Binho Nova multi-protocol USB host adapter, which lets you connect sensors and other components to your computer and then control them using code running on the computer (as opposed to programming a microcontroller).
With this Smart Glove, you can move the mouse cursor around, left click, or right click. Dragging isn't currently programmed, but the mouse control library does support that functionality if you want to add it. This can be adapted for a number of assistive mouse devices, such as a headband for those who don't have use of their hands.
To build this, you'll only need a few components. Those include:
- Binho Nova
- Binho Qwiic Interface Board
- SparkFun Accelerometer (Qwiic)
- SparkFun Flex Glove Controller (Qwiic)
- Long Qwiic Cable
- Short Qwiic Cable
- A glove of your choosing
- M3 screws and heat-set inserts
You will also need access to a 3D printer to print the enclosure and flex sensor guides.
Step 1: 3D Print Your Parts
You'll start by 3D-printing the enclosure and flex sensor guides. Supports aren't necessary.
After the parts are printed, you can use a soldering iron to heat up the M3 inserts and then push them into place.
Step 2: Install Software and Libraries
Before you do anything else, you'll need to install Python 3. You can find an installer for your operating system on the Python website here: https://www.python.org/downloads/
You'll then install the libraries used by the Binho Nova. This is easy to do with Python's built-in package manager (Pip) through your terminal or Windows PowerShell. Full instructions are here: https://support.binho.io/getting-started/quickstar...
pip install binho-host-adapter
Finally, you need to install the PyAutoGUI library. This library lets you programmatically control your computer mouse with Python. PyAutoGUI can also be installed with Pip, and full instructions are here: https://pyautogui.readthedocs.io/en/latest/install...
pip install pyautogui
Step 3: Understanding the Python Script
The attached Python script contains all of the code you need for the Smart Glove. The only change you have to make is to the COM port. It's currently set to COM3, but you'll need to change it to match the COM port that your Binho Nova is registered to.
In Windows, you can find that information by going to your Device Manager (right click the Start icon in Windows 10) and looking under Ports.
You also may want to adjust the "clickThreshold" value if mouse clicks aren't occurring as expected. Increasing this value to something like 14000 will make the flex sensors more sensitive to clicks, while lowering it to something like 10000 will make them less sensitive (requiring you to move your finger further).
You can read through the comments in the code to get a better understanding of how it works, but in a nutshell:
- Import the required libraries
- Set the PyAutoGUI fail safe in case the mouse acts erratically
- Define the COM port and set initial values
- Get the Binho Nova ready for I2C communication
- Initialize the connection to the accelerometer
- Start looping. Every loop, check the values of the flex sensors and accelerometer. If appropriate, move the cursor or click the mouse.
- Close the Binho connection. The code shouldn't actually reach this point unless it gets kicked out of the loop somehow
Step 4: Assemble Your Smart Glove
Assembly is very straightforward. The flex sensor board will connect to the accelerometer board with the short Qwiic cable. Then the accelerometer board will connect to the Binho Qwiic interface board with the long Qwiic cable. Finally, that interface board is attached to the Binho Nova's built-in cable. Now you can run the Python scrip to test that everything is working properly.
If it is, then place your components inside of the enclosure and secure the two halves together with short 10mm M3 screws. Both the flex sensor board and accelerometer board should be facing up! Now you can use some hot glue or fabric glue to attach the enclosure and the flex sensor guides to your glove. Make sure the screws are facing up, in case you need to open up the enclosure later. It's also best to mark the positions while you're wearing the glove in order to ensure that they're in a comfortable spot.
That's it! Now you've got a cool wearable computer mouse! You can, of course, do a lot more with the Binho Nova, this is just an example of how easy it is to work with I2C components like those in SparkFun's Qwiic lineup.
Runner Up in the
Assistive Tech Contest