‘Flex Sensor’ or ‘Bend Sensor’ is a sensor that changes its resistance depending on the amount of bend on the sensor. They convert the change in bend into electrical resistance – the more the bend, the more the resistance value. Flex sensors are widely used in various applications such as – Automotive controls, Medical Devices, Fitness Products, Virtual Reality gaming consoles, Animatronics, Robotics, etc. This tutorial aims to provide a detailed guide to flex sensor and its interfacing with Arduino.
The Flex sensor patented technology is based on resistive Carbon elements. As a variable printed resistor, the flex sensor achieves great form-factor on a thin flexible substrate. When the substrate is bent, the sensor produces a resistance output correlated to the bend radius – the smaller the radius, the higher the resistance value.
They are usually in the form of a thin strip from 1”-5” long that vary in resistance range. It is obvious that longer strip would give more number of different resistances on bending. The change in resistance with increasing bend is depicted in the below snapshot:
Inside the flex sensor are carbon resistive elements within a thin flexible substrate. More carbon means less resistance.
Interfacing with Arduino
NOTE: Although the active portion of the sensor (the area between the black squares) is quite sturdy, the pin-end of the sensor is susceptible to kinking and eventual failure. I recommend reinforcing or securing this area (for example, clamping or gluing down the sensor at the black square nearest the pins) to ensure that this area doesn’t flex along with the rest of the sensor.
Make the connections of the flex sensor in voltage divider configuration as shown above. Take your Arduino and connect the divider point to Analog Input of the board.
The analogRead() function will provide the sensor values.
flex = analogRead(1);
This will print values on the serial monitor.
Now we’ll show the amount of bend through LEDs. Connect the Red, Green and Blue LEDs to the Arduino Digital pins 4, 3 and 2 respectively, as shown in the circuit.
With no bend in the flex sensor, only Blue LED will Glow. When a small bend is applied, Green LED will glow (which is to indicate bend level). On applying large amount of bend, Red LED will glow, remaining two LEDs are OFF, which indicates large bend.
#define blue 2
#define green 3
#define red 4
unsigned int f;
if(f>300) //No Bend; Blue LED Glows
else if((f<300)&&(f>260)) //Small Bend; Green LED Glows
else // Larger Bend; RED LED Glows