Bending with flex sensors

ūüēí 2 min read

Flex sensors are relatively helpful in determining how much bent there is on a particular object. For example, you can use flex sensors on a glove to determine how much you bend your fingers. In this tutorial, we will be exploring how to interface a flex sensor with an Arduino.

What is a flex sensor?


Flex sensors are actually passive resistive devices. When the flex sensor is bent, the resistance of it increases depending on how much you bend it. This could be use to determine how much an object is bent by comparing the initial resistance of the unbent flex sensor to the current bent state. Applications of flex sensors may include determining joint movement in robotics, a virtual reality glove that is used to control certain interface, etc.

For this tutorial…

In this tutorial, we will use the flex sensor to measure the intensity of how much the sensor is bent, which will determine the brightness of the LED. When the sensor is bent, the flex sensor changes its resistance, which I will be measuring with Arduino’s analog pin. But to do that, we need a fixed resistor to be used as a comparison (I use a 22K-Ohm resistor as the unbent flex sensor measures around 22K-Ohm).

The values received by the analog input will then be mapped to 0 – 255, as to determine the brightness of the LED. (The maximum analogWrite() value for a LED is 255).

Here are some images of the setup:

Parts used

  • Flex Sensor x 1
  • 10k-Ohm Resistor x 1
  • 330-Ohm Resistor x 1
  • LED x 1
  • Jumper Wires



[Coming soon…]



int flexSensorPin = A0; //analog pin 0
int ledPin = 9;

void setup(){

void loop(){
  int flexSensorReading = analogRead(flexSensorPin); 


  //Using map(), I convert the readings to a larger range to determine brightness of LED
  int val = map(flexSensorReading, 460, 540, 0, 255);
  //delay(250); //delay
Share your love

Leave a Reply

Your email address will not be published. Required fields are marked *