Getting the prototype to work required creating software to read sensor data, process it and sending it. This started with the simple Arduino button demo. We had no idea how to use the sensor, but luckily Canatu gave us links to useful libraries that do most of the work for us. All we needed to do to read the sensor data is to include the library and define the pins to use for the sensor. In addition, some code to decide when to turn on the LEDs was needed.
Smart Glove prototype
To move on quickly we decided to use Raspberry Pi, because it had built-in Bluetooth and WiFi. In the first glove prototype, both Arduino and Raspberry Pi were used. The previously used Arduino code was modified to send the sensor data through USB instead of controlling the LEDs. The Arduino was then connected to the Raspberry Pi. Communication over WiFi is easier, so we choose to implement that in the first prototype.
We also added the gyroscope sensor we ordered to the Raspberry Pi. And created a simple Python program that reads the data and sends it to the computer that is controlled over UDP. This also required another program for reading the sensor data from the Arduino through USB and similarly sending it over UDP.
Gyroscope and accelerometer testing
To test how the mouse movement would work using the gyroscope and accelerometer data we created an Android app which reads both gyroscope and accelerometer X, Y and Z values and sends them over WiFi. Once the data was sent to a computer, we analysed it with Matlab.
Server side program
On the server side, a program was needed for turning sensor data to mouse movement. For this we used Scala to make it cross-platform. What the program does is it receives the UDP packets, turns the raw gyroscope data to radians per second and then to mouse velocity. The app also frequently updates the mouse position based on the current mouse velocity.
Moving over to Bluetooth
Later on, we noticed that communication over WiFi didn’t work at the school, probably because there were too many overlapping networks, therefore we decided it was better to use Bluetooth. To move from WiFi communication to communication over Bluetooth, the program that runs on the computer and the sending code on Raspberry Pi needed to be rewritten.
Arduino only implementation
Raspberry Pi is quite large. To make our glove smaller we decided to use just an Arduino. This required us to rewrite some of the code, such as reading gyroscope data, but smaller size was worth it. As a temporary solution the data was transferred over USB to the computer as there’s no built-in Bluetooth or WiFi in our Arduino Nano.
We received our order of a new Arduino with detachable pins and the Bluetooth transceiver, finally! So, next we’ll make the Arduino implementation wireless.