Hello, friends! I want to share with you a device I made specifically for AR glasses like Google Glass, Meta, Moverio BT, or VR devices like Oculus Rift, Samsung Gear VR, vrAse, and Durovis Dive. These products are amazing, and they need a new way of input. Here, I will share how to make your own Bluetooth glove with gravity sensing and touch control. Of course, I will also give you some tips on making a Durovis Dive device so you can enjoy a complete mobile virtual reality world. Since this glove is most suitable for VR games, I wrote a Unity3D plugin for Android to control communication between the glove and the app. This means you can play games using the glove. The Android code I wrote to control communication between the glove and Android devices and the Java classes will be open-sourced so that you can modify them according to your needs.
The glove prototype supports the following wireless communication data: 1. The user’s wrist positioning data in space, thanks to the FreeIMU module. 2. The pressure of each finger.
The glove communicates with Android smartphones or computers via Bluetooth (I won’t mention computers here). Check out the video for an overview of its functions and uses. If you want to create an Arduino system that communicates with Android phones/tablets via Bluetooth, or if you want to input touch commands into your Arduino wirelessly using FreeIMU devices, this thing is quite useful.
Step 1: Glove Preparation
You need to prepare the following electronic components: Arduino board, FreeIMU board (10 dimensions: 3x gyroscope, 3x accelerometer, 3x magnetic field, 1x pressure sensor), Bluetooth module, 5 pressure-sensitive resistors, 9V battery and battery connector, about 3 meters of wire with a cross-section of 0.2 square centimeters (diameter of 0.5 mm), I used 4 colors of wire. 5 10K metal film resistors (like these) and a soldering board (like this).
Tools needed to make the glove (the links here are just for reference; you can purchase your own tools): 2mm PVC board for the wristband, 50x46mm hard cardboard with a thickness of 1mm, for fixing electronic components, one side is adhesive, the other side is Velcro tape, 2mm double-sided tape, 10mm elastic band, stapler.
The glove consists of 5 (you can reduce the number for easier operation) touch devices and a wristband, with a hard cardboard frame fixed on the wristband for holding electronic components. The hard cardboard frame has two layers (from bottom to top): the first layer consists of the FreeIMU module and 5 metal film resistors, and the second layer consists of the Bluetooth module and Arduino module. The battery is taped to the wristband.
Step 2: Basic Structure: Wristband
The wristband is the basic frame for placing all electronic components. Draw the shape shown in the image (in millimeters) on the PVC board with a pencil, and cut it out with scissors. When you are ready with the wristband, cut a 57x50mm rectangular piece of hard cardboard to fix the electronic components. Now we need to adjust the hard cardboard on the wristband, cut two 50mm long pieces of thick double-sided tape and stick them on the cardboard (see the image), then attach the cardboard to the wristband. Cut a 45mm piece of Velcro and stick it on the wristband as shown.
Step 3: Circuit Overview
Before soldering, let’s take a look at the circuit diagram. As you can see, this diagram is quite simple.
Power Supply
The Arduino board is powered by a 9V power supply from the Vin pin. We use the 5V voltage provided internally by the Arduino to power the FreeIMU and Bluetooth, connecting their 5V power input to the Arduino’s 5V output. To learn more about the maximum voltage and minimum operating voltage that Arduino can handle, refer to the Arduino documentation.
Arduino-Bluetooth Communication
The Bluetooth module purchased from Sparkfun communicates with Arduino via serial (Tx/Rx). Connect Arduino’s Tx pin to the Bluetooth module’s Rx pin, and connect Arduino’s Rx pin to the Bluetooth module’s Tx pin. If you want to learn more about how Bluetooth modules work, refer to the instructions on the Sparkfun website.
Arduino-FreeIMU Communication
The FreeIMU version 0.4 communicates with Arduino via I2C protocol. It uses the SDA (data) pin and SCL (clock) pin. Connect Arduino’s SDA pin (pin 2) to FreeIMU’s SDA pin, and connect Arduino’s SCL pin (pin 3) to FreeIMU’s SCL pin. Note: The SDA and SCL of the IMU operate at 3.3V, while the Arduino normally operates at 5V. However, there are pull-up resistors inside the Arduino chip, allowing them to communicate without adding external devices.
Touch Detection
The touch sensing system works like a voltage divider. I used pressure-sensitive resistors that reduce resistance as pressure increases; the change in resistance causes a change in voltage across Rv, which we measure using Arduino’s ADC function (A0 to A5 pins). The range of resistance changes from 1M ohms (no pressure) to 2.5K ohms (maximum pressure). The current flowing through the five voltage dividers is supplied by Arduino’s 5V pin. I want to ensure that the current through each voltage divider does not exceed 500uA, which means that the resistance (R + Rv) must equal 10K ohms when the minimum value is reached. Since the minimum value of Rv is 2.5K, R must be 7.5K. This is why I chose R to be 10K (R cannot be less than 8.2K, this minimum value was measured in my lab). When there is no pressure, the voltage across Rv is 5V, and at maximum pressure it is 1V.
Step 4: Making the First Layer Board: FreeIMU and Resistors
As mentioned earlier, the circuit is divided into two layers. Now let’s make the bottom first layer, where we place the FreeIMU board and the 5 10K resistors.
10K Resistors
As shown in the image above. The white wires connect to the finger touch devices, the black is GND, and the red is the 5V power supply. Five gray wires will connect to Arduino’s A0 to A4 pins (ADC). Note: We do not need the upper red wire in the lower left corner of the first image; cut the pad into a piece with a remaining hole of 7*9 (as shown). As shown in the image, solder 5 resistors, cut 10 wires, and the wires need to be long enough to reach from your wrist to your fingertips (the white wires in the image). I suggest making the wires longer (35cm) so that when making the touch devices, we can cut them to the appropriate length. Then solder these wires according to the image, cutting two red wires and two black wires, as shown. Solder 5 separate wires of 12cm or use 5-wire ribbon cable, as shown. Check your soldered circuit board against the image to ensure everything is correct.
FreeIMU Board
Solder the red and black wires coming from the resistor board to the FreeIMU board as shown in the image. Cut two differently colored wires, 12cm long, as shown, and solder them to the FreeIMU board. These two wires need to connect to Arduino’s I2C interface (SDA and SCL).
Fixing the Circuit Board to the Wristband
Use thick double-sided tape to stick the two circuit boards onto the hard cardboard, then cut another piece of hard cardboard (50*57mm) of the same size as a fixing board for the second layer. Use thick double-sided tape as a support for the two-layer board, allowing 10 wires to be drawn from the first layer, as shown in images 3, 4, and 5. When the support thickness reaches 1.5cm, stick the second layer of cardboard.
Step 5: Making the Second Layer Board: Arduino Micro Module and Bluetooth Module
The Arduino micro module is quite tricky to use with a breadboard; to fix the Arduino and achieve the appropriate height, I bent the Arduino pins as shown in the image. Use needle-nose pliers to bend each pin to 90 degrees, being careful not to damage them. Once all the pins are bent, you can solder the wires. The wires that need to be soldered are:
9V Power Supply Wire:
Red (9V) to Arduino’s Vin pin, black (ground) to Arduino’s ground pin.
5V Power Supply Wire from the First Layer:
Connect the red wire coming from the first layer to Arduino’s 5V pin, and connect the black wire coming from the first layer to Arduino’s ground pin (we have 3 GND wires; Arduino has two GND pins, and we need to share one GND wire with one pin).
Ribbon Cable:
A0: Index Finger, A1: Middle Finger, A2: Ring Finger, A3: Pinky Finger, A4: Thumb.
I2C (PWI):
The green wire coming from the first layer connects to Arduino’s SCL (pin 3), and the white wire coming from the first layer connects to Arduino’s SDA (pin 2).
Bluetooth Module:
5V power: Connect the red wire coming from the first layer to the Bluetooth module’s 5V pin. Ground (GND): Connect the black wire coming from Arduino’s GND pin to the Bluetooth’s GND pin. Data Receive (RX): Connect the white wire coming from Arduino’s Rx pin to the Bluetooth’s Tx pin. Data Send (Tx): Connect the green wire coming from Arduino’s Tx pin to the Bluetooth’s Rx pin.
Compare your work with the images to ensure everything matches. If there are no issues, stick the Arduino and Bluetooth module onto the second layer using thick double-sided tape.
Step 6: Making the Finger Touch Device
The essence of the touch device is a pressure-sensitive resistor, which operates by changing the voltage across the resistor when pressure is applied to the device. The pressure-sensitive area of the resistor is the black dot part, which can be well matched with finger pressing. To make a fingertip touch device, we need: 1 pressure-sensitive resistor, thin double-sided tape, PVC board that can be used like the wristband board; if you find it thick, you can use a slightly thinner board (the one I used in the image is 1MM thick PVC board), and two staples.
Cut the PVC into a 9*90 rectangle, stick the resistor using thin double-sided tape as shown in image one, gently bending the two legs of the resistor so you can solder wires from the back of the wristband, as shown in image two. Before soldering the wires, we must cut them to the appropriate length. Put the wristband on your wrist and estimate the length of each pair of wires to the fingertips (two wires for each finger). Note that when bending the wrist down, the wires must be long enough to allow you to make a fist (refer to the first image of this article). Here, I remind you of the corresponding wires for each finger. A0: Index finger, A1: Middle finger, A2: Ring finger, A3: Pinky finger, A4: Thumb. After cutting the wires, solder them to the corresponding resistor pins as shown in image two. Cut a 60mm rubber band and use staples to fix it to the PVC board as shown in image two. The rubber band is placed inside the folded PVC board, meaning the staple will go through 3 layers (PVC – rubber band – PVC) to form a loop with the rubber band. Also, use another staple to fix the other end of the PVC (the end with the resistor legs). The order from inside to outside is: rubber band – PVC – resistor – rubber band. Be careful not to poke the staple into the resistor, as this may cause a short circuit. Finally, the finished product should look like images three and four.
By now, the hardware part is ready. Let’s start coding and witness the miracle.
Step 7: Testing and Calibrating FreeIMU
FreeIMU is an open hardware for positioning and motion sensing, which can communicate with Arduino using the FreeIMU library. Download the latest library and detailed installation instructions from the official website.
Here are the steps to get started: 1. Download the FreeIMU library for Arduino. 2. Set up your Arduino environment according to the library file addition section in the Arduino documentation. 3. Use the calibration tool provided by the FreeIMU group to calibrate your FreeIMU; the result of the calibration will be a “calibration.h” file, and stable data from FreeIMU is required during calibration.
After downloading the library file, set up your Arduino environment according to the Arduino library addition guide. Selecting manual installation will give you a deeper understanding of the structure of the Arduino environment.
Testing FreeIMU:
Connect the Arduino to the computer and open the Arduino programming software. Open: File -> Examples -> FreeIMU -> FreeIMU_serial. In the Tools -> Board section, select the board type as Leonardo, and choose the serial port used by Arduino (Tools -> Port) and note down the name of the port (Windows is in COM2 format, Mac is in /dev/tty.usbmodem1421 format). Upload the example to the Arduino and perform a simple check to see if Arduino responds: Open the serial monitor (Tools -> Serial Monitor).
Check that the serial port parameters are set to “Newline” and “115200 baud rate”. In the input field, enter ‘v’ and press Enter; if everything is normal, Arduino will return:
FreeIMU library by Fabio Varesano – varesano.net, FREQ:16 MHz, LIB_VERSION: DEV, IMU: FreeIMU v0.4
You can also input other commands to see Arduino’s response (be sure to check which commands are available).
The FreeIMU library comes with an application for testing whether FreeIMU is functioning correctly called “FreeIMU_cube.pde”. This is a Processing file, and you need to download and run Processing. The interface is very similar to Arduino’s. Open the “FreeIMU_cube.pde” file located at: “FreeIMU-20121122_1126/processing/FreeIMU_cube/FreeIMU_cube.pde”. We need to tell the software which serial port Arduino is using: In Processing’s code, find this line:
final String serialPort = “/dev/ttyUSB9”;
Replace /dev/ttyUSB9 with the serial port name you noted earlier (which is the name of the serial port used by Arduino). Run the program, and if the previous steps were done correctly, a window should appear with a 3D cube on it. This cube represents your FreeIMU, and it will move as you move the FreeIMU. If the cube does not move, do not panic; we need to calibrate FreeIMU. If there are errors or the program does not start (blank window), try restarting Arduino and rerunning the program. If that doesn’t work, check the FreeIMU official website for troubleshooting.
Calibrating FreeIMU:
Download the calibration tool (only supports PC and Linux) and follow the instructions to obtain the calibration file “calibration.h”. Then copy it to the FreeIMU folder to replace the existing file (libraries -> FreeIMU -> calibration.h). Rerun the Processing “FreeIMU_cube.pde” program. This time, the cube should move along with FreeIMU.
Step 8: Testing the Touch System
Here, I will introduce how to test the Arduino code, which needs Arduino to detect touch events generated by the fingertip touch device. As previously mentioned, Arduino determines whether a touch event has occurred by measuring the voltage change across the pressure-sensitive resistor. I introduced a threshold value “touchThr” in the code; when the detected voltage is greater than this value, we consider the device’s state as “NO_TOUCH (not triggered)” or released; when the detected voltage is less than this value, we consider the device’s state as “TOUCH (triggered)” or pressed.
To test the code on Arduino, download the Five_Touches.zip file, unzip it, and open it. Connect Arduino and upload it. After successful upload, open the serial monitor, and you will see the touch events generated by the fingertip touch device being sent to the computer. Remember to select “New Line” and set the baud rate to 115200. Now, when you press one of the fingertip touch devices, you will see the data in the serial monitor (image one). Each line represents an event: “f” represents finger, “p” represents pressed, “r” represents released, and the number 0-4 represents the A0 to A4 pins connected to the touch devices. For example, if you get “fp2”, it indicates that the second touch device (the one connected to A2) has been pressed. If it is “fr0”, it indicates that the first touch device has been released. The rest follow accordingly.
Step 9: Sending Events to the Phone via Bluetooth
How to give your Bluetooth a gentle name: 1. Upload the “Bluetooth_cmd” program to your Arduino. 2. Open the Arduino serial monitor. 3. Confirm that the serial monitor parameters are:
Newline
Baud rate: 115200
4. In the input field, enter “D” and press Enter to get the basic settings of the Bluetooth module; the result should look like screenshot 1. 5. Enter “SN, your desired new name” and press Enter. In screenshot 2, I named my device “Gravity touch”. 6. Enter “D” again to confirm the module’s name.
You can find and try other commands in the Bluetooth module manual’s appendix B. When you’re ready to use the module, enter the restart command: “R,1”.
Next, we test the Bluetooth communication between the Android phone and the glove. 1. Download the “Gravity_Touch_Bluetooth.zip” file, unzip it, and upload it to Arduino. 2. Install the “GravityTouchTest.apk” file, which can be downloaded directly to your phone or uploaded from your computer.
Open the phone’s Bluetooth, run the “Gravity Touch Test” program (ensure your phone has enough battery before running). When the green LED lights up, it indicates that the phone and the glove are connected. If all goes well, when you press the corresponding fingertip touch device on the glove, you will see the cube on the screen turn green.
I have attached the [Java code](http://obook.qiniudn.com/Gravity%20Touch%20Glove%20Java%20src.zip) I wrote for handling Bluetooth communication on Android. This code has three parts: MainActivity.java, GloveTouchThread.java, and BluetoothNoSupportedDialog.java. We won’t explain these here; if you’re an Android programmer, you should be able to understand them. Note: In this project, I used the relatively new and more reliable low-energy Bluetooth standard. Check here for a general understanding of how to handle communication between Android devices and low-energy Bluetooth.
At this point, the glove sends positioning signals and touch signals, and the phone receives these signals. As I mentioned at the beginning, the purpose of this glove is to serve as an input device for VR or AR games. So, what we need to do next is to send these signals to the Unity3D game engine. Why Unity3D? Because it is the preferred tool for mobile 3D game development.
Step 10: Gravity Sensing and Touch Plugin for Unity
If you are a Unity developer and want to use your glove to control your game, you can download the Unity package “gravity_touch.unitypackage” and import it into your Unity project. Check the “Test” interface to get an intuitive understanding of the software development tool structure. I promise I will provide some links and suggestions to help you create your own VR device for under $50. The best method is Durovis Dive. Durovis Dive consists of a kit called OpenDive and software development tools that can track the phone’s positioning. You can make an Oculus Rift (a head-mounted display designed for video games) using Durovis Dive and a smartphone. To make OpenDive: 1. Download the STL files from this link (the files are used to make the kit’s frame with a 3D printer) and find the nearest 3D printer to you. I spent $35 on my device, and it took less than 4 days. 2. The OpenDive lenses can be purchased on Amazon. 3. When you are ready with the frame and lenses, follow the assembly instructions in the video for Durovis Dive to put them together.
Now you have the glove and VR headset, enjoy!