The Flex Sensor [Product Link] is useful in applications where the bent of a joint (a finger, a knee etc) is to be detected.


Flex Sensor
Flex Sensor
  • Operating Voltage: 5V
  • Length: 8cm
  • Changes resistance when flexed


The flex sensor is a variable resistor that reacts to bends, such that, as the sensor is flexed the resistance increases. It measures about 22KΩ when unbent, and about 60KΩ when bent 180°. The bend resistance also depends on the bend radius. The bend is only detected in one direction and the metal pads should be on the outside of the bend. To avoid detecting fluctuating readings, bends should be of at least 10°.

The 2 pin connector of this sensor is bread board friendly. The usable range of the sensor can be flexed without any problem, but care must be taken to not flex or strain the base of the sensor as it could break the leads.

To incorporate this sensor into your project use it in a voltage divider with a resistor of value between 10K and 100K. The analogRead function will read a value of 1023 at 5V and 0 at 0V. So we can measure how much voltage is on the flex sensor using the analogRead and we have our reading.

The amount of that 5V that each part gets is proportional to its resistance. So if the the flex sensor and the resistor have the same resistance, the 5V is split evenly (2.5V) to each part (analog reading of 512).

Voltage Divider Wikipedia page [Link] shows what a resistive voltage divider looks like. For the purpose of our experiment, we are going to connect the Flex Sensor where R1 is, and use a 100K ohm fixed resistor as R2, as shown below.

Flex as R1, 100k as R2
// Code by Jasmeet Singh for http://Wiki.JMoon.co
int flexPin = A1; //analog pin 1

void setup()

void loop(){
int flexVal = analogRead(flexPin);

Using the flexVal reading returned by the code above, we can figure out the approximate value of the flex sensor resistance.

Analog reading for a maximum 5V = 1023
Let the flexVal analog reading’s corresponding voltage = Vout.
So, Vout= (5 * flexVal)/1023  {formula 1}

By putting this value of Vout in the formula given on the Voltage Divider Wikipedia page [Link] {formula 2} and substituting following values:
R2 = 100K ohm
Vin = 5V
we can find out the value of R1 which is the resistance of the flex sensor.

From the experimental results, using a 100K ohm resistor as R2, we obtained the following flexVal readings, starting from when the sensor was unflexed, to when it was slowly bent to almost 180°.
flexVals: 810, 799, 744, 715, 701, 690, 663, 635, 632, 625.

By substituting the value 810 in formula 1, we get Vout = 3.96. Substituting this in formula 2, we get R1 = 26.2K ohm. Similarly by substituting the value of 625 in formula 1, we get Vout = 3.05 and then from formula 2 R1=63.93K ohm

In the above experiment, on bending, the analog readings for flexVal decreased; if however, we connect the Flex Sensor as R2, and use the 100K ohm fixed resistor as R1, the readings observed would increase on bending the Flex Sensor and will become approximately equal to 1023 minus the flexVals recorded above (213 [=1023-810], 224 [=1023-799], 279 [=1023-744], …, 398 [=1023-625]). So the choice depends on the application, and if you would like the value to increase or decrease on bending the sensor, though it is mostly preferred when the value increases, in which case connect the circuit as shown below and add the following lines just above the delay statement in the code to allow the flexVal readings to tell the degree of bent.

100k as R1, Flex as R2
100k as R1, Flex as R2
int flexDegree = map(flexVal, 213, 398, 0, 180); /* Change the range.
This you will let you know roughly how many degrees the sensor is bent.
Use the lower (213) and upper (398) bound values that you get in your experiment.*/


Sign Language Glove Project [Link]

Possible Application Areas

1. Glove Controlled Humanoid Hand

Did you create a project using this product? Leave details/links below!


So empty here ... leave a comment!

Leave a Reply

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