$USD
  • EUR€
  • £GBP
  • $USD
TUTORIALS Arduino

Arduino Flex Sensor Tutorial: How to Use a Flex Sensor

DFRobot Apr 03 2018 1091

A flex sensor is used to measure how much an object bends. Learn how to use it in this tutorial.

What is a Flex Sensor?

A flex sensor can be conductive ink-based, fibre-optic or capacitive. For hobby microcontroller systems, the conductive ink-based flex sensor is common.

As its name suggests, a conductive ink-based flex sensor uses a conductive ink whose resistance varies when bent. The ink may contain carbon or silver to make it conductive. The spacing between carbon particles are larger when bent and closer when straight which results in a change of resistance:

In the diagram, the resistance of the sensor is 30k when flat and 70k when bent at an angle of 90 degrees. Yours might not have the same resistances so I suggest you test it before using it with microcontrollers.

Conductive ink-based flex sensors are unipolar sensors, which means the change of resistance is true only if you bend it in one direction. Bending it to the other direction does not change its resistance.

 

Arduino Interface Circuit

Just like most resistive sensors (like a thermistor), the best way to connect this sensor is through a voltage divider as shown:

With the setup above, the A0 pin receives an increasing voltage as the bend on the sensor is increasing.

Here is an example Arduino sketch:

int flex_pin = A0; void setup(){ pinMode(flex_pin, OUTPUT); Serial.begin(9600); } void loop() {  // Read the ADC, and calculate voltage and resistance from it  int flex_value = analogRead(flex_pin);  float flex_res = (1023-flex_value) / (flex_value * series_R);  Serial.println("Resistance: " + String(flexR) + " ohms");  // Use the calculated resistance to estimate the sensor's  // bend angle:  float angle = map(flexR, straight_R, bent_R,                   0, 90.0);  Serial.println("Bend: " + String(angle) + " degrees");  Serial.println();  delay(500); }
 

Here, series_R is the resistance of the series resistor. It’s advisable to use a resistor that is the same as the resistance of the flex sensor when flat to increase sensitivity. You also need the resistance of the sensor when straight (straight_R) or when bent fully (bent_R).

What microcontroller project could you build using a flex sensor?

  • Make a Flex Sensor for Robotics Hand
  • Bend Sensor As Wearables
  • A glove based controller

Thanks for Teachmemicro.com. 

Shop Flex Sensor 2.2" and Flex Sensor 4.5" now to measure how much an object bends.


REVIEW