Arduino Projects

Flex Sensor with Arduino, Interfacing and Programming

Flex Sensor or Bend Sensor:

Flex Sensor or Bend Sensor with Arduino, Interfacing and Programming- If you’ve ever been curious about how to work with a flex sensor and how to use it with Arduino, you’re in the right place. Because in this article, I will be explaining the most basic and advanced things with the help of three examples.

In the first example, I will guide you through the process of reading and displaying flex sensor data on the serial monitor. This serves as a crucial foundation for understanding how a flex sensor operates and the type of data it can provide.

In the second example, we will create a beginner’s level project where we will monitor a sheet, and when the sheet is bent to a certain level, a buzzer is turned on. While this is a beginner-level project, you can still apply this idea to more advanced and complex projects.

allpcb circuit

And in the third example, we will use the Flex sensor to control the angle of a servo motor. The angle of the servo will change according to how the Flex sensor is bent. This idea can also be applied to intermediate and advanced level projects. You can use multiple flex sensors on a glove to control a robot, a bionic hand, a prosthetic hand, and more.

I’ve also developed a human posture monitoring system using the Flex sensor, so you can check out that article for more advanced applications. And if you see fluctuating values due to the noise then you should read my article on the Arduino hardware and software filters.

Anyway, after reading this article, you will not only have a solid understanding of flex sensors but also the confidence to use them in your own Arduino projects. So, whether you’re a beginner or an experienced Arduino enthusiast, there’s something here for everyone.

So, without any further delay; let’s get started!




Amazon Links:

Arduino Nano USB-C Type (Recommended)

Flex Sensor

Flex Sensor from DFRobot

5V Buzzer

Micro Servo Motor

10Kg Torque Servo

*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases.



Flex Sensor or Bend Sensor:

Flex Sensor with Arduino

A flex sensor, also known as a bend sensor, is a type of a sensor designed to detect bending or flexing in a physical structure, such as a flexible material or object. These sensors are primarily used to measure the degree of bending or curvature in various applications.

Flex sensors typically consist of a flexible material with conductive material traces or elements running along their length. When the sensor is bent or flexed, the resistance of these conductive elements changes and this change in resistance is used to determine the degree of bending or flexing.

Flex Sensor with Arduino

The  Bend Sensor is usually stuck to the surface whose bend is to be monitored, as the surface is bent the resistance of the Bend sensor varies. So we can say that the resistance of the Bend Sensor is directly proportional to the amount of Bend.

Flex sensors are also used for precise angle measurements; a Flex sensor is just like an ordinary resistor, the only difference is in the construction, so we can call this Flex Sensor or Bend Sensor as the Flexible Potentiometer.

Flex sensors have a wide range of applications, including:

Robotics: They are used in robotic hands and fingers to mimic human hand movements and gestures.

Gaming: In gaming controllers and devices to detect user movements and gestures.

Medical Devices: Used in medical gloves or wearable devices to monitor hand movements or gestures for rehabilitation or diagnostics.

Virtual Reality (VR) and Augmented Reality (AR): In VR or AR gloves for tracking hand movements and gestures.

Musical Instruments: In musical instruments like electronic drums or MIDI controllers to detect the bending of drumsticks or other components.

Wearable Technology: In smart clothing or wearable devices to detect body movements or posture.

Prosthetics: In the development of advanced prosthetic limbs to allow more natural and intuitive control by the user.

In summary, flex sensors, often likened to flexible potentiometers, are versatile electronic devices that provide precise measurements of bending or flexing. Their unique construction and ability to detect changes in resistance make them indispensable components in various fields, from robotics and gaming to healthcare and prosthetics. These sensors bridge the gap between the physical world and the digital realm, allowing for intricate control and interaction in an ever-expanding range of applications.



Flex Sensor Specification

  • Resistance Value: 10KΩ~125KΩ
  • Life Cycle: >1 million
  • Dimension: 77mm * 6mm * 0.43mm (L*W*H)(3×0.2×0.02”)
  • Temperature Range: -35°C to +80°C

Flex Sensor Construction and Working:

A Flex sensor typically consist of a flexible substrate, often made of materials like polyester or similar polymers, with conductive elements or traces applied onto their surface. These conductive elements are typically composed of materials with specific electrical properties that exhibit predictable changes in resistance as the sensor is bent.

Flex Sensor with Arduino

A flex sensor mainly consists of 4 main parts the two contacts having no polarity, Segmented conductor, conductive ink, and Phenolic Resin Substrate.

When the flex sensor is subjected to mechanical stress, such as bending or curving, the arrangement of these conductive elements is altered. This, in turn, causes a change in the electrical resistance along the sensor’s length. The degree of bending or flexing directly correlates with the magnitude of the resistance change, and this change in resistance can be measured and interpreted electronically. And this is what I am going to practically explain. So, let’s go ahead and start with our first example. 



Flex Sensor value on the Serial Monitor:

Flex Sensor with Arduino

In order to use it with the Arduino, I have connected a 10kΩ resistor in series, as I explained earlier the two contacts have no polarity; so you can connect this 10k-ohm resistor on either side. I have connected the other contact of the Flex Sensor to the Arduino 5V and the other leg of the 10K Ω resistor to the Arduino ground. Now, this makes a voltage divider circuit. And as you know, in a voltage divider circuit the output voltage changes as we change the resistance of any of the components.

In this case the 10KΩ resistor is a fixed resistor and its resistance can’t be changed, but since a Flex sensor is a nonlinear flexible resistor which can be used as a flexible potentiometer, so, by bending this sensor we can change the resistance and this way we would be able to generate different voltages.

 Now, to read this change in voltage, we can connect a wire from the middle of this voltage divider circuit to the Arduino Analog pin A0.




Flex Sensor Arduino Programming:

I started off by defining the Arduino Analog pin A0.

Then in the void setup() function, I activated the serial communication. 9600 is the baud rate. Then using the pinMode() function, I set the flexsensor as the input.

In the void loop() function, that runs repeatedly, we simply read the flexsensor using the analogRead() function and store the value in variable Value, and then finally, we print the sensor value on the Serial Monitor. I have already uploaded this program and now let’s watch the Flex Sensor in action.

Flex Sensor with Arduino

In the image above, you can see the value of Flex Sensor before and after bending the Flex Sensor.

Avoid sharp bends as it will completely damage the Flex Sensor and then you won’t be able to get the correct values. So, as far as possible, smoothly bend the sensor.

Now, let’s move on to the next example.



Bending Monitoring with a Flex Sensor:

In this 2nd example, I am going to attach the Flex Sensor to a wooden sheet. If you prefer, you can also attach it to a metal sheet or on the surface of any flexible object. Anyway, first I am going to solder two wires to the contacts of Flex Sensor, so that I can easily use it. While soldering the wires make sure not to apply too much heat, because this might easily damage the Flex Sensor.

Flex Sensor with Arduino

The two wires are soldered and the flex sensor has been attached and you might be thinking what’s the advantage of this setup. Well, as you know, this wooden sheet can bend up to a certain limit. If we cross that limit, the sheet will break. So, I want that when the wooden sheet bends beyond a certain limit, the buzzer should turn ON to prevent us from bending it further.

Flex Sensor with Arduino

The voltage divider circuit remains exactly the same. This time round, I am also going to use a 5V buzzer and as you can see my Arduino Development board already has a buzzer which is connected to the Arduino digital pin D8. Now, let’s go ahead and take a look at the programming.



Sheet Bending Monitoring Programming:

I simply modified the previous code. I defined a pin for the Buzzer and in the void setup() function I set the Buzzer as OUTPUT.

In the loop() function I added an if condition that turns ON the buzzer when the sheet bending crosses a certain limit.

After uploading the above program, I was able to monitor sheet bending. If the sheet bend would cross a certain limit the Buzzer would turn ON.

You can also use this for dents monitoring in Cars, in security systems, and so on. Now, let’s move on to the next example.



Flex Sensor with Servo Motor:

In this third example, I am going to control a servo motor using a flex sensor. The voltage divider circuit remains exactly the same.

Flex Sensor with Arduino

The servo motor voltage and ground wires are connected to the 5V and 3A power supply and the signal wire is connected to the Arduino pin 11. You can follow this circuit diagram. The Vin and GND wires should be connected to an external 5V power supply if incase you are using a large servo motor. Now, let’s go ahead and take a look at the programming.




Flex Sensor with Servo, Arduino Programming:

Again I modified the previous code. This time you can see, I have also added a library for the Servo and its connected to the Arduino pin 11.

In the loop() function, I mapped the values to control the Servo motor angle between 0 and 180 degrees.

I have already uploaded this program and now let’s watch the Flex Sensor and Servo in action.

Flex Sensor with Arduino



Watch Video Tutorial:

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

Leave a Reply

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

Back to top button