Introduction: Educational Flex Sensor for Arduino or Raspberry Pi
A flex sensor changes its electrical resistance as it is bent. It can detect how far an object is bent or moved. For example, look for projects that use flex sensors to control a robotic hand.
The sensor is made from a five-layered “sandwich” of thin materials. This Instructable is for students and science teachers who need simple and inexpensive flex sensors for experiments. It is easy to connect to an Arduino or Raspberry Pi.
When student projects require a sensor for each student or group, we can forego some measure of accuracy and use inexpensive DIY sensors, as long as they are reasonably consistent. The design is based on ideas from several online solutions (thanks!). It is a first prototype, and it has not yet been tested in a real project. We welcome your comments and suggestions.
Step 1: Materials
A flex sensor can be made from a five-layered “sandwich” of thin materials:
- 2 outer layers of thin clear plastic to give the sensor stiffness. I cut strips of laser printer transparency film. My example is a little under 5/32 by 4.5 inches.
- An inner layer of a conductive film cut the same size as the plastic strips. Many experimenters suggest the black conductive bags used to protect circuit boards from damage by static electricity. Unless you buy circuit boards, the stuff is hard to find but can be purchased online as empty bags. The metal-coated plastic bags that smaller parts and boards come in do not work. You’ll know if the material works if you can measure resistance with an ohmmeter.
- Two strips of metal foil tape used by HVAC technicians to wrap air conditioning ducts. The layers of foil must lie against both sides of the conductive film and make electrical contact. Cut a tad wider than the plastic (it wraps around a bit) but about half-inch shorter.
We offer a small kit of materials for those needing to make only a few sensors.
Step 2: Make Metalized Plastic Strips
1. Cut two strips of clear plastic sheet, the length of your desired sensor. My example will be housed in 5/16 diameter flat shrink wrap tube, so my plastic is narrow enough to easily slip into the tube. Sensors can be made much smaller if needed.
2. Also cut two strips of metal tape, about ½ inch shorter than the plastic, and wide enough to wrap around only one side of the plastic as shown. Wrapping around gives you a conductive edge for your electrical connections.
3. Affix the tape to the plastic as shown. Make sure there is at least ¼ inch clear plastic showing at each end. Use a smooth object to burnish the tape well so it is smooth and wrinkle-free.
You will have two such strips.
Step 3: Cut the Conductive Layer and Optional Shrink-wrap Tube
4. Now cut a piece of conductive black bag the same size as the plastic strips.
5. Optional: Also cut a piece of flat shrink-wrap tube, about an inch longer than the plastic strips. Many applications will not require that the sensor be covered.
Step 4: Assemble the “Sandwich”
6. Now place the black conductive layer inside the “sandwich” as shown. Use just a dab of hot glue, between the layers at the ends only, to keep the layers of the sensor from shifting as it is flexed. Keep the sensor as flat and smooth as possible while gluing.
7. Strip about ½ inch of the ends of your wires. Place the bare end of the wire onto the exposed metal tape that wraps around the edge of the plastic, and tape it down with a small piece of foil tape. Be sure to install a wire at each end of the sandwich.
8. Put a dab of hot glue at each wire connection to keep it in place, as shown.
Step 5: Test the Sensor
9. Test the strip by connecting an ohmmeter to the two connecting wires. My strip measures around 2K ohms when straight, and goes well under 500 ohms when bent. I took the photo before I attached wires.
Step 6: Final Assembly
10. Finally, if needed, slip the sensor into the shrink wrap. Shrink the ends well, and then flex the tube into a “u” shape (to keep it rigid) and only shrink the tube until it is just a little snug. If you over-shrink it, it will crush and collapse the sandwich.
That’s it. You’re ready to test it in an application. Your goal is to get a reasonably consistent range of resistance as the sensor flexes from straight to bent.
The apparatus shown in the first photo was used to test consistency. If you flex the sensor with your fingers, you can’t guarantee that you are returning to the same position each time. The apparatus has fixed start and stop point.
A serendipitous discovery was that the metal mounting bracket that holds the sensor in place also decreases the overall resistance and therefore the “sensitivity” of the device, by smashing the layers together. But it also seems to improve consistency. You can adjust the starting (straight) resistance by adjusting the tightness of the clamp. Unclamped, the resistance started at over 2K ohms. Clamped, I got a consistent 245 to 255 ohm resistance straight and a 145 to 155 reading flexed.
Step 7: Coming Soon: Applications
Applications are for an upcoming Instructable. For now, this is how you can interface the sensor to an Arduino or Raspberry Pi through an analog input port. Experiment with resistor values to give a good voltage swing. It depends on the resistance range of your own sensor. For example, a sensor range of ~2K to ~250 ohms with a 470 ohm resistor will produce a voltage swing of approximately 2.5 volts to approximately 4.8 volts.