Introduction: Arduino Flex Sensor Glove
Created by: Jonathan Cates, Nobufumi Takahashi, and Ryan Barton for Mount Royal University's COMP 3012 Robotics course
This tutorial will teach how to make a glove with 5 flex sensors, so that when you bend your fingers a RGB light will light up, according to which finger you bent. This glove can be used to control various other things as well with some slight modifications!
- Textile Duct tape
- Conductive Thread*
- Fabric Snaps**
- Arduino Nano
- 5 10k Ohm Resistors
- 3 560 Ohm Resistors
- RGB LED
*We used medium conductive thread. We had a choice of tiny and medium at our disposal and we found that the medium gave a wider range of values. Thicker thread could likely be used as well if you wanted even more values to work with.
**We made the thread out each sensor short as we weren't sure the length of thread needed to get back to the controller when on the glove. We used fabric snaps to connect the thread to longer strands so that they could be connected to the Nano.
Step 1: Flex Sensor
We followed this video:
As our main template for the flex sensor. Step by step instructions are as followed:
- Measure the length from the tip of your finger, to about halfway down the back of your hand. Each sensor will be a bit different in length as a result.
- Cut a length of tape as you measured and rip in half, length wise, so you have two pieces of equal length.
- We cut the thread to be about 5 cm over one of the edges, and about 3 cm short of the other end. As we were attaching the sensor to a glove we found that having a longer thread to attach to was easier than having a different piece of conductive materials at the ends like the videos shows. Cut 2 lengths and place in the center of each piece of tape.
- Cut 3 pieces of velostat about a centimetre shorter than the tape. Place two so that they cover up the thread entirely.
- Stick the two halves together, with the longer ends of the thread out each side and the 3rd velostat in between the halves.
Trim up the sides to the size that you want, and you have just made your first flex sensor. As we are making a glove, you will need to make 5 of these of slightly different lengths as per each finger.
Now is also a good time to test the sensor you made. Following the circuit diagram, you can easily hook up the sensor using the Arduino Uno as the controller. Using the code found in the following repository, comment out the extra sensor readings so that only the attached analog sensor is being read and shown on screen. This code will also be used for the final product so be sure to keep it for later!
Step 2: Making the Glove
With the way we designed the glove, it has two major components to it: the glove itself and a strap that serves as a power rail.
- The sensors that you made will now have to be attached to the glove itself, we found that the best method of doing this and keeping them secure was to sew them straight on to the back of the fingers by the outer edges of the sensor. Use caution here and try not to sew through both sides of the glove, using something to hold down the inside of the glove will help
- The ends of the sensors on the back of your hand can be connected together as these are simply the ground wires, we used fasteners to connect them together and lead them out to a single ground wire
- The ends of the sensors (conductive thread) at the finger tips will need to be sewed through the underside of the glove in order to keep them from touching and causing a short circuit.
- Because each sensor needs to be connected to power we had to create some sort of a power distribution system as the nano itself only has one power pin that can be connected to.
- We did this by sewing conductive thread through a velcro band and connecting resistors in between the strips of velcro to hold them in place. Make sure to leave some thread that will allow you to connect to the 5V pin on the arduino nano (or whatever board you decide to use)
- The resistors serve as connection points for the wires to supply extra needed power to the sensors
Step 3: Wiring the Glove
In this step we will be wiring the glove to the Arduino Nano using the attached diagram. This proved tricky as we need to prevent a short from happening anywhere along the way of the glove. To prevent this we used various wires all around the glove, and used solder and hot glue to secure them to the controller. As we use many permanent ways to fasten the wires to the controller, it is important to note to test the wires before you attach. When we had finished we had a wire which wasn't connected to the end very well and thus we weren't able to use it to manipulate the light. Once you have tested all your wires, get to soldering!
The used the ends on the back of the glove are used as our ground, connecting them all using knots with fasteners used to secure the knot. This enables us to narrow down the grounds to have only one thread leaving to the ground and tidied up our wiring.
We soldered a pin to the 5V so that we can attach the power rail to a power source by tying a knot around the pin, and hot gluing it secure. The power for the RGB will sit on top of this pin and secured with either solder or hot glue depending on the type of wire used.
The threads leaving from the front of your hand need to wrap around to the back of your hand where the controller will sit. First, we tied a knot from the thread to a wire, and used shrink wrap and hot glue to secure it and prevent shorts from this side of the glove. Then we soldered pins onto pins a0-a4 for each of the sensors we made and we connected 3 of the sensors on the left side, and 2 on the right to avoid having too many wires coming up one side of the glove. Make sure to attach these wires to the top of the controller, as the wires leaving the power rail should be soldered on the underside of the controller.
We soldered wires to the analog pins and then hot glued to ensure the wires didn't come loose. We also soldered 560 ohm resistors for the RBG light to connect to. Remember that using an Arduino Nano, the PWM pins are 3, 5, 6, 9, 10, and 11 so be sure to choose any 3 of these pins (we choose 3, 6, and 9 to keep it simple).
Step 4: Final Product
Using the code linked earlier (here again) we now have a fully operational glove that takes in readings from all 5 fingers. Just to note for our code, we had accidentally swapped some some of our pins around while fastening, feel free to change the pins as to how you wired your glove. Additionally we will need to calibrate the glove!
To calibrate we took a handful of readings while the glove was on, both at holding our fingers outstretched and bending out fingers completely. We took what seemed to be the median of the values we received and used those values as our top and bottom variables for the map reading function. The code is documented throughout so it should be fairly self explanatory. Calibrating took a bit of time, but is needed to get meaningful values as the sensors themselves are fairly sensitive to use.
In this project we only connected the glove to a RGB light for the showcase that we did, however the sensors could easily be used in conjunction with many other sensors to control more impressive things (such as connected via bluetooth to a RC car perhaps). We hope this instruction list is clear to use and we look forward to seeing what you can control following this tutorial!