Arduino Flex Sensor or bend sensor circuit and programming


Arduino Flex Sensor-Learn how to use a Flex sensor or Bend Sensor with the Arduino in this tutorial. This is a venture at the beginner stage and I will try my best to illustrate the basic extremes. The electrical and electronics engineering students are becoming very famous with a flex sensor. The Flex Sensor or bend Sensor can be used in biomedical projects, it can be used with doors for the security purposes, it can be used for the angle finding, this sensor is also ideal for monitoring the Dents in sheet metals and so on.

In this post, I will cover,

  • What is a flex or bend  sensor
  • How a Flex or bend sensor works
  • How to use a Flex  or bend Sensor with the Arduino
  • A basic program to control an led
  • How to choose the right resistor to use with the flex or bend sensor.

The Amazon Purchase links:

flex or bend sensor: 
Arduino Uno:
Mega 2560:
lm7805 Voltage Regulator:
330-ohm resistors pack:
female DC power jack socket:
470uf capacitors:
5×7 cm Vero board: 
female headers:
connection wires:
Super Starter kit for Beginners:
Jumper Wires: 
Bread Board: 
12v Adaptor: 
PCB plate: 
Variable Supply:
Digital Multimeter:
Vero Board / stripboard: 
Soldering iron kit:
Solder wire: 
Wire Stripper: 
PCB drill machine: 


Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Flex Sensor or Bend Sensor:

A flex sensor known as the bend sensor is a device measuring the amount of bending or deflection. This is a type of resistor in the nonlinear resistor class. A Flex Sensor or Bend Sensor can be seen clearly in the image below. You may monitor how the resistance changes as the sensor is bent using a multimeter.

Arduino Flex Sensor

Through placing this sensor on any material’s surface, the bending can be tracked, as the quality of the resistance varies with the amount of bent added to the sensor. The Flex Sensor or Bend Sensor quality is commensurate with the amount of bent. So, that’s why this sensor is used to measure precisely the angle. Using Flex Sensor is like the standard resistor parameter.

Arduino Flex Sensor

As you can see in the image above, the Flex Sensor or Bend sensor has two contacts or legs that make it easy to use with the Breadboard, but personally suggest soldering jumper wires with these two contacts as it can easily be interfaced with the Arduino Uno or Mega.

It’s working theory, as said, is just like the usual variable resistor or potentiometer, with the only difference; that is, the resistance of the flex sensor varies with the twist, while the resistor of the variable or potentiometer adjusts the resistor when we turn the knob. There are also some other Flex sensor or Bend sensor types, but the Conductive Ink-based Flex Sensor is the one you can see on the screen.

Flex Sensor Interfacing with Arduino:

It is really easy to interface the Flex Sensor with Arduino. All you need is to attach the Flex sensor to a 10k resistor in sequence. Take a wire from the middle and connect it to the analog pin A0, attaching the other two ends to the 5v and floor of the Arduino. It’s just like a loop of the voltage divider. It is important to attach the flex sensor and the 10k resistor in series.


Program Explanation:

began by setting Flex sensor lock. The Flex Sensor or Bend Sensor is attached to the analog pin A0 of Arduino.

int flexs = A0;

Then set pin to store the Flex Sensor value. specified the form integer variable information.

int data = 0;

Then gave the led pin. I’m going to use the Arduino onboard led on pin number 13.

int led = 13;

You know that each Arduino Uno or Mega program has two atleast functions that are the functions of void setup and void loop. The feature of void setup is performed only once. I enabled the Serial communication within the void setup feature and selected 9600 as the baud rate. Set the input and led flex sensor as the output.

void setup()



pinMode(flexs, INPUT);

pinMode(led, OUTPUT);


The feature of the void loop is running infinite times. There is no return form for this function and it does not take any argument as the output.

void loop()


We read the Flex sensor first and store the value in the information of the factor. The value is then sent to the Serial monitor using Serial.println) (where we can analyze the sensor’s actions. Then use the LED switched ON or turned OFF if necessary.

data = analogRead(flexs);


if( data <= 200)


digitalWrite(led, HIGH);


if( data > 200)


digitalWrite(led, LOW);




hope this article will help you. Let me know in comment if you have any problems.

Watch Video Tutorial

Related Articles

Leave a Reply

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

Back to top button