A flex sensor is a variable resistor, which measures the amount of deflection or bending it undergoes. The bending or molding of the sensor is what affects its resistance and this is what differentiates it from a standard, variable resistor.
A flex sensor’s resistance is directly proportional to the amount of bend that occurs. Its resistance can be determined by connecting an ohm meter across its two terminals, which is similar to a resistor-resistance measurement.
The flex sensor is composed of two materials:
1. A conductive material – it’s etched on the more flexible part
2. A flexible pad – it’s similar to hardened rubber
When the sensor is in “normal mode” and is stationary, its resistance remains undisturbed. When the sensor is bent, the conductive material particles move apart from one another, increasing the distance between them. This distance also results in an increase of resistance.
When the sensor is released, it will return to its original shape. This results in a decrease in resistance. Flex sensors are used in several industries, including robots, mining, security, health care, and others.
In this tutorial, we’ll learn how to interface a flex sensor using Arduino, which is similar to a potentiometer or variable resistor with Arduino.
Here’s how it works:
- The flex sensor’s output is connected with Arduino’s analog pin input.
- An LED is connected to Arduino Uno’s pulse-width modulation (PWM) pin # 3.
- The sensor is powered with Arduino’s 5V regulator output.
- The sensor’s “bend” or flex is monitored by Arduino and the brightness.
- The LED is controlled by the sensor’s input.
In the code, two variables are declared for the LED and analog pin assignment. In the setup function, the LED pin is declared as output and the serial port of Arduino is activated.
In the loop function, the sensor’s output is read by Arduino’s analog pin. This output is converted to a digital number and displayed on the serial monitor.
Arduino ADC (analog to digital) converter is 10-bit wide. The maximum value it can read is 1023. However, Arduino’s digital and PMW pins are 8-bit wide (255 max range). So, to output the ADC data for the PWM pin, it’s necessary to trim it and bring it into the 0-255 range. This is where the statement map () comes in. At the end, the signal is written on the PWM pin.
Flex sensor drawbacks
Flex sensors are not easy to design or manufacture. Over time, they lack the ability to sustain their original shape and parameters. Once stretched, for example, they return to their previous state but lose the constants including the resistance and angle that corresponds to the voltage.
Despite their drawbacks, flex sensors are used in several sectors. One example is in fitness devices that aim to correct one’s body posture. They’re also commonly used in electric chairs for better seating posture.
Flex sensors are also often used in applications that monitor activity. Combined with other technologies, such as an oximeter, these sensors can be used in medical devices. For instance, flex sensors can monitor and person’s movement (say, of the movement of their knee or foot), tracking orthopedic recovery.
Where to purchase the parts?
You may also like:
Filed Under: Microcontroller Projects