I recently got a Raspberry Pi Pico W because I wanted to try out making wearable technology. The Pico is a microcontroller similar to an arduino. I like the Pico because I can program it using Python.

I recreated alien invaders using java for my final class project. I wanted to add a more immersive experience to playing the game. I did some research into microcontrollers that can emulate Human Interface Devices (HID). Joysticks, keyboards, and mice are some examples of HID devices. There are HID libraries for the Pico that enable it to emulate a keyboard, joystick, and even multimedia controls. Each finger acts as a momentary switch that is triggered when it comes into contact with my thumb.

List of Materials

To build this glove, I used the following:

  1. Raspberry Pi Pico – $4 or Pico W – $6:
  2. Headers for the Pico (alternatively, you can buy a Pico with the headers pre-soldered, but where’s the fun in that?)
  3. Inertial Measurement Unit (IMU) MPU 6050 – $13
  4. Jumper Wires
  5. Soldering iron
  6. Solder
  7. Aluminum Foil
  8. Tape
  9. Old Glove
  10. Scissors
  11. Needle and Thread

All of the code and libraries I wrote/used are on this Github repository: https://github.com/Bobcati/pico-glove-rev1

Building the Glove

Cut five pieces of aluminum foil with the dimensions of about 2 cm by 12 cm. Take 4 jumper wires of any color other than red or black and strip about 1 cm of insulation off. Do the same for 4 black jumper wires. For the black wires, tape all four of them onto one strip of aluminum foil. For the other four wires, tape each of the exposed wires to a strip of aluminum foil like so:

Wrap the tin foil strip with the black wires around the thumb. Then wrap each tinfoil piece around a finger on the glove.

Sew the MPU6050 IMU onto the back of the glove using a needle and some black thread.

On the MPU6050, attach a yellow jumper wire to the SCL pin, a white wire to the SDA pin, a red wire to the VIN pin, and a black wire to the GND pin.

Connect each finger to the corresponding GPIO pin on the Pico. The ring finger should attach to GP6, the pointer finger to GP9, the pinky finger to GP21, and the middle finger to GP2. Connect each of the black wires attached to the thumb to the GND pins closest to each GPIO pin the finger wires are plugged into.

Take the MPU6050 and connect the SCL (yellow) to GP15 and SDA (white) to GP14 on the pico.

Setting up the Pico

I had to install the CircuitPython firmware to use my pico with the Adafruit libraries. Adafruit is a great company that builds every sensor or HAT imaginable for SBC or microcontroller related projects.

Hold down the BOOTSEL button on your Pico while plugging it in to a computer.

For the regular Pico, download the CircuitPython firmware here: https://circuitpython.org/board/raspberry_pi_pico/

For the Pico W, download the CircuitPython firmware here: https://circuitpython.org/board/raspberry_pi_pico_w/

Watch this video…

or follow along with this tutorial to install the firmware (skip the first step – the firmware is already downloaded): https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/circuitpython

In order to make the Pico function as an HID device and read sensor input from the MPU6050, I had to add several libraries to the Pico. Every Pico has a “lib” folder, where all of the libraries must be stored. The Pico acts like an external USB flash drive when it is plugged into a computer labeled “CIRCUITPY.” Download the files from my github repository and paste them into the “CIRCUITPY” drive.

Et Voila: when the Pico is connected to the computer, the arrow keys will be triggered depending on hand tilt and tapping the thumb and pointer finger together will trigger the space key.

Tapping the pinky switches to manual mode, where the middle finger becomes the right arrow key and the ring finger becomes the left arrow key.

To edit programs on the Pico, download either the Thonny IDE: https://github.com/thonny/thonny/releases/tag/v4.1.1

or the Mu code editor:

https://codewith.mu/