Introduction: Sphero Glove Controller

Senior Project 2017

Step 1: Parts and Tools Required

For the parts and pieces in this project, there are many alternatives that can be used. Most of the reasoning behind the different pieces is availability and financial constraints. Below the parts and tools there is a little explanation for what each piece is used for so that if necessary you may find alternatives that best fit your implementation. All links are to the item on Amazon and Sparkfun, but I recommend checking your local electronics stores for discounted parts.

Parts

Arduino Uno (x)

HC-05 Bluetooth Module (x)

Gyroscope (x)

Wires(x)

Solder(x)

Golf Glove(x)

Android Device (x)

Sphero (x)

Tools

Soldering Iron (x)

Wire Clamps

For the glove portion, the Uno is what I had available. There are many smaller ones that can be used, just know that in this striped down version it will need at least 2 analogue pins, a tx and rx, and a 3.3 and 5v pin. For the Bluetooth module, I recommend getting the HC-05. It is not only inexpensive, but very easy to work with. The gyroscope I have listed above is one specifically for wearable as conductive threads can be used to sew it directly into the glove. I was also successful using the MPU 6500, its just a little extra code (and has many examples online). The actual glove is a golf glove because we need to use something that is tight fitting to allow accurate sensor readings. By using the golf glove, I was also able to attach flex sensors to the fingers to allow different hand signals along with tilt. The code for this is not included, but if you are looking for a more versitile glove, definitely check out the instructable here to create the sensors for cheap then wire them up to your glove.

Step 2: Brush Up on Programming Concepts

For this project, all code is available on my github so technically you can simply use that without having to understand what is going on in the code. But if you are interested in working through this, there are a few important concepts that are used in this project. Online there are many resources to help with this, so next to each concept there are a few links to help you out.

  • Object Oriented Programming (x)
  • Bluetooth (x) (x) (x)
  • Android Programming (x)
  • Analog inputs (x)

Step 3: Programming the Arduino

For the first portion of this glove, we need to set up the micro controller to talk with the HC-05 and the gyroscope. To do this, it will be helpful to keep the hookup guide in mind. For bluetooth, we will be using the Serial Library which is already included in the version of ardunio I am using. The first thing we need to do is fill out our setup function, and set up all our pins, as shown below.

This step lets the ardunio know what pins we will be using and an idea of what it will be used for. The next potion to code is the actual loop function. In this function we will be checking if there is a change in the position of the glove and then sending that change through the Bluetooth module. To determine which position we are currently in, we will be using a deterministic finite automata (DFA). Using this concept, there are 5 possible positions that the glove can be in, as shown above.

In order to transition from one state to another, the gryo must pass a threshold value. For this, I worked with it for a little while until I found a decent one for my needs so I recommend messing around a bit with the glove to find what threshold values work for you.

Once you find what state you are currently in, we will simply send that data out using the Serial library (which is included in this version of Arduino). Then, upload to the board. Note: Because we are using the tx and rx pins on the Uno, these will need to be unplugged when you are uploading to the board. Once it is successfully uploaded, place the wires back in and all will be good.

Step 4: Creating the Android App

To allow the glove to communicate with other devices, we will need a device to relay the message. This is what the android app does. This allows the app to interpret what the glove is sending and then transmit the message to the chosen device. In this case, we will be talking to a Sphero 2.0. To do this, we will need to use the Sphero library found here. Using android studio, import the library into the android project. We will be using this library to talk to the Sphero.

If you want a skeleton structure to start, you can use the Bluetooth chat example to quickly check if the glove is connecting correctly, and then slowly edit to fit your needs (as I have done). The main portion of the code that is important is how to deal with a changed state in the glove. This is done by simulated a button click whenever the phone receives a new state from the glove. All of the code for this can be found on the github link at the end of this section.

Step 5: Hardware Hookup

To start off, we need to connect everything together. As shown above, we will be using the wires to connect the modules together. Overall, we will be hooking it up as follows:

Uno

A0 -> Gryo X

A1 -> Gryo Y

TX -> Bluetooth RX

RX-> Bluetooth TX

3.3V -> Gryo +

5V -> Bluetooth VCC

GND -> Both Bluetooth GND and Gryo -

This is then powered by the 9v, though there are many other options out there depending on what hookup you have. Once plugged in, the sketch will begin and the glove will be active. You should see the HC-05 blinking rapidly red to show it is functioning.

Step 6: Putting It All Together

Once all the code has been uploaded to the arduino and phone, you can now test it all out! Do the following steps to allow this to work:

1. Wake up the Sphero by double tapping it

2. Begin the app. The Sphero thread will running and will try to connect to the sphero

3. Wait until the sphero holds a green light to ensure connection, then connect to the glove using the app menu. Upon connection, the Sphero will wiggle a little to show all is connected.

4. Now enjoy! The chat will display the current direction of the glove to ensure it is following your movement.

Step 7: Links

Comments

author
Lord Nikolai (author)2017-09-18

How could I connect this control to a drone also using Ardino Uno?

author
tomatoskins (author)2017-05-03

Very cool idea! How long did it take you to complete?