Flex Sensor 2.2" - Small Retail

Thank you for purchasing a SparkFun Flex Sensor! This unique component can sense how much it is being bent. It opens up a wide range of projects, including:

...and other uses limited only by your imagination.

How it works

One side of the sensor is printed with a polymer ink that has conductive particles embedded in it. When the sensor is straight, the particles give the ink a resistance of about 30k Ohms. When the sensor is bent away from the ink, the conductive particles move further apart, increasing this resistance (to about 50k Ohms when the sensor is bent to 90º, as in the diagram below). When the sensor straightens out again, the resistance returns to the original value. By measuring the resistance, you can determine how much the sensor is being bent.

How to use it

NOTE: Although the active portion of the sensor (the area between the black squares) is quite sturdy, the pin-end of the sensor is susceptible to kinking and eventual failure. We recommend reinforcing or securing this area (for example, clamping or gluing down the sensor at the black square nearest the pins) to ensure that this area doesn't flex along with the rest of the sensor.

The simplest way to incorporate this sensor into your project is by using it in a voltage divider. This circuit requires one resistor. Many values from 10K to 100K will work, but we'll use a 10K resistor here (SparkFun part number COM-08374, also supplied in our Inventor's Kits and locally at Radio Shack, etc.). Connect the flex sensor to your microcontroller using the following circuit:

(Connect one side of the flex sensor to ground.  Connect the other side to your analog input, and use a 10K pullup resistor to VCC)

The resistor and the flex sensor form a voltage divider, which divides VCC by a ratio determined by the two resistances. When the sensor is straight, the 10K resistor and the 30K flex sensor will cause the output voltage to be about 75 percent of VCC. When the sensor is bent, the voltage will increase to about 83 percent of VCC (see our voltage divider tutorial for the math). If you're using 5V for VCC, you should see about 3.75V when the sensor is straight, and about 4.17V when the sensor is bent by 90º. These numbers will vary for individual sensors; for the most accurate results, test your specific sensor and use those numbers in your code.

Here's a basic Arduino sketch to show the output from your sensor:

    // Flex sensor test program
// Mike Grusin, SFE, 2011
// This program is free, use it however you wish!

// Make the following connections between the Arduino and the flex sensor
// Note that the flex sensor pins are interchangeable

// Sensor pin - GND
// Sensor pin - Analog In 0, with 10K resistor to +5V

// Upload this sketch to your Arduino, then activate the Serial Monitor
// (set the Serial Monitor to 9600 baud)

void setup()
  // initialize serial communications

void loop()
  int sensor, degrees;
  // read the voltage from the voltage divider (sensor plus resistor)
  sensor = analogRead(0);
  // convert the voltage reading to inches
  // the first two numbers are the sensor values for straight (768) and bent (853)
  // the second two numbers are the degree readings we'll map that to (0 to 90 degrees)
  degrees = map(sensor, 768, 853, 0, 90);
  // note that the above numbers are ideal, your sensor's values will vary
  // to improve the accuracy, run the program, note your sensor's analog values
  // when it's straight and bent, and insert those values into the above function.
  // print out the result
  Serial.print("analog input: ");
  Serial.print("   degrees: ");
  // pause before taking the next reading


  • The sensor works only in one direction: when it is bent away from the side with the conductive ink (towards the side with the text). You may see a small response when bending in the other direction, but not nearly as much as in the "correct" direction. (If you need to measure bending in both directions, consider using two sensors back-to-back).
  • Manufacturing tolerances will result in some variability between individual sensors. For the most accurate results, you may want to calibrate the sensor you're using by measuring its values at various positions, and using those numbers in your code.
  • These sensors work best (and last the longest) if they are bent across a large radius, not kinked. Remember that the active area is between the black squares.
  • As noted above, the pin-end of the sensor is susceptible to kinking and eventual failure. We recommend reinforcing or securing this area so that it doesn't flex along with the rest of the sensor.

Have fun!

Enjoy your new sensor! If you have any questions (or want to show off your project), please don't hesitate to contact us at techsupport@sparkfun.com.

Comments 15 comments