The Data Glove - Control Bluetooth Devices With Gestures!
by Donut Studio in Circuits > Wearables
0 Views, 0 Favorites, 0 Comments
The Data Glove - Control Bluetooth Devices With Gestures!


How cool would it be to control your bluetooth devices with hand movement and gestures? Imagine holding a presentation and changing pages with a swipe of your hand! May I intruduce you to the Data Glove? It features acceleration and gesture detection as well as an ir receiver and much more!
The brain of the system will be the XIAO nRF52840 (Sense) coupled with five hall sensors. All the components are connected to a small pcb and secured to a bicycle glove. Every movement of your finger changes the magnetic field inside of the sensor which changes the input voltage. Thus, a gesture can be detected and used to trigger different events! All project files and examples can be found on this github repository: https://github.com/KonradWohlfahrt/Data-Glove
The whole project was made possible by Seeed Studio and their XIAO Series MCU! Special thanks to them for supplying me with the circuit boards and microcontroller for this project! More on them later!
With a brief overview of the project, let us get started building the Data Glove!
Supplies

SMD components:
- 3x 10k 0805
- 2x 33r 0805
- 2x 1k 0805
- 2x MMBT2222ALT1
Through-hole and other components:
- 1x 5mm LED (ir or any other wavelength)
- 1x TSOP38238
- 2x tactile button 6x6x6mm
- 1x vibration motor 10x2.7mm
- 1x LDR
- 1x 50/100mAh LiPo battery
- 1x SK12D07VG5
- 1x XIAO nRF52840 (Sense)
- 5x ph2.0 3 pin 90 degree header
- 5x SS49e hall sensor
- 20x neodymium magnet 8x3mm
- 3x M2.5x6mm screw with nut
- a few cables
- a bicycle glove
- custom pcb
Tools & machinery:
- 3d printer
- soldering iron, solder and tweezers
- ph2.0 crimping ratchet
- super glue
The Circuit



At first I tried using through-hole components but I had to switch to SMD ones later on, due to size. As said before, the brain of the whole system will be the XIAO nRF52840 (Sense) MCU from Seeed Studio. It should be machine learning ready and has enough pins for the different components.
After testing, I designed a circuit in EasyEDA: the analog pins are connected to the hall sensors and the remaining pins to the other components like the vibration motor for haptic feedback, the ldr, the ir receiver, buttons and the led. Check out the schematic for more information.
Like the Arduino UNO, the XIAO nRF52840 MCU is easy to use and can be directly integrated into the circuit without any hussles. Another cool feature of the chip is the battery charging circuit! It easily makes this project portable without a difference in size! The 'Sense' version of the MCU includes two more built-in sensors for you to use. One being a digital microphone and the other one an 6-axis IMU for detecting acceleration and orientation. This chip will be very handy if you would like to capture movement as well! However, in my case I will be using the plain XIAO nRF52840.
After the schematic was complete, I designed the pcb. I wanted to integrate a lot of different sensors for you to play around with. Thus, increasing the size of the pcb. In the end I think it turned out decent, though I would have liked it to be a little smaller!
The only step left is to get the pcbs fabricated. I bet you don't have proper machinery at home to create the boards yourself. That is where Seeed Studio comes in again. They also offer a pcb production service for a decent price! The final board looks great and I started populating it with the different electrical components!
3D Printing

I designed everything in Fusion360 and had to reprint a lot of parts as I improved the design! The cover for the pcb looks very chunky and not pretty in my opinion, but it get's the job done!
You can download the stl files from the github repository. Print the bottom and top cover once and the hall sensor and magnet cover five times. While your 3d printer is running, you can continue with the soldering (see next step). If you don't own a 3d printer, you might want to try out Seeed Studios 3d printing service!
Soldering the PCB





To build the main control unit, follow these steps:
- First step: start soldering the smd components. If you are a beginner, you might want to skip this step. However, without them you are not able to use the led, vibration motor, buttons and ldr. Just practice a litte and give it a try!
- Second step: solder the remaining components to the pcb (switch, buttons, led, connectors, ldr, ir receiver)
- Third step: solder the pins to your XIAO and two cables to the battery pads (pay attention to the cable connections: red: +; black: -)
- Fourth step: connect the battery cables to the pads on the pcb and solder the XIAO in place
- Fifth step: solder the cables for the vibration motor and glue it inside of the bottom cover
- Sixth step: connect your LiPo battery to the corresponding pads
- Seventh step: secure the pcb to the bottom with the screws and firmly place the cover on top
Awesome, now you are done with the control unit!
Preparing the Hall Sensors




As explained in the introduction, I have used analog hall sensors. The output voltage depends on the strength of the magnetic field. The voltage gets detected by the microcontroller and can be used to determine your finger position. To prepare the sensors, you will need some wire and glue. Determine the pinout of your sensor and connect the three different colored cables to its leads. Again, you should pay attention to consistently use the same colors for the same pins (e.g. red for VCC, black for GND and yellow or a color of your choice for analog out). I also used a shrink tube to protect the solder joints.
Once you have prepared the sensors, you can insert them into the case and bend them by 90 degrees. Pay attention to the orientation! Finally, glue on the cover and you are done!
Preparing the Magnets


Like the sensors, this step is straightforward: Place four magnets into the casing and glue on the cover. I recommed to switch the polatities around a bit so they don't stick together in the same orientation.
Putting Everything Together







Now, get your glove, the prepared parts and a pencil. I firstly tried out different positions and then marked the final destination. The magnets go on your fingers while the hall sensors and main board stay on the back of your hand. I made the mistake to put two attracting magnets close to each other, so pay attention! Eventhough I spend a lot of time on alignment, I still had some misplaced parts. They will stay there now as I can't get them off anymore!
Once everything was glued in place I trimmed the sensor cables and crimped the ph 2.0 connectors! Afterwards I wired it up to the main board and that is basically it! If you don't own a crimping ratchet, you can also solder the cables directly to the corresponding pads. I tried to fit the cables with a sleeve, but it didn't work as expected. Perhaps you are more experienced in doing this! I also had some issues with a loose connection (a hall sensor was not working), better use a bigger cable next time ;)
Programming and Testing the MCU

.gif)
The XIAO can be connected to your PC and with only little setup I was able to upload the first blinking sketch! I am not going to explain this process as it is very well documented here!
Since I am new to this particulary MCU, I only created a few examples at my repository. Once I get more comfortable and experienced with its features I will add and update code. It's save to say that the XIAO is an awesome MCU, it was such a pleasure to work with and programming was very easy! The bluetooth library in particular was a great time saver and worked without any problems! It's so simple to create your own keyboard and/or mouse!
For now, upload the 'DataGloveTest' sketch and open the serial plotter to see the different sensor values: open and close your hand, press the buttons, etc.
Examples and How to Change Them




First, upload the 'DataGloveSetup' sketch and follow the instructions in the serial monitor! Copy the new values and place them in the preferences.h file. These values are specific to your glove, every example should use your values! Press any of the buttons on the glove to test the detection of your fingers. In the serial monitor you should see a value for every finger (0 = contracted, 1 = extended). Open and close your hand to verify and restart the process if necessary!
I have created a few examples for you to play around with! They are pretty fun and should give a brief overview of what is possible and how my code is structured:
- Flashlight (LED illuminates when forming a fist)
- Camerashutter (take a photo by contracting and expanding your fingers twice - double press)
- Presentation (change pages of a presentation with the buttons or by double pressing)
- MediaControl (control music playback; double press to play/pause, long press to skip, buttons for volume)
Inside of the preferences.h file you will find a few methods that help you gather the sensor information. But first, you have to initialize the whole system. Define the input and output pins you would like to use:
You probably only need the following functions for your application. I encourage you to use the 'readHallSensors()' function. It reads all sensors with minimal delay and also features a deadzone! This makes readings more stable as fluctuations in the signal are mostly ignored!
Now you are ready to experiment with the Data Glove yourself! Have fun and be sure to share your applications!
Final Words


Overall, this project turned out great! I haven't even come close to trying out all the functions of the glove and the microcontroller. There is so much you can do and I had a lot of fun controlling music and presentations with gestures!
However, I made a few mistakes during the build process which still really botheres me! Pay attention to a decent wire size (reduces loose connections), alignment of the magnets and proper cable sleeves! Who knows, maybe I will come back to this project and expand upon its features... until then, have a great day and stay creative!
Finally, special thanks to Seeed Studio for sponsoring this project with the awesome pcbs and microcontroller!