Interface flex sensor with Arduino

What is a flex sensor?

A flex sensor is a type of sensor that is used to measure the amount of deflection or bending. It is a two-terminal device and it does not have polarity. So, there is no positive and negative terminal. You can use anyone as positive and the other one as a negative terminal. Flex sensors are usually available in two sizes 2.2 inches and 4.5 inches. When you apply a force on the sensor; try to bend it, the resistance of the sensor changes. And we can convert the resistance to voltage and thus can easily measure the bending or deflection in terms of degrees. This type of sensor can be used in designing a hand gesture controlled robot. Here, we will discuss the 2.2-inch flex sensor.

Pin configuration of the flex sensor

flex sensor pin diagram

Features of the flex sensor

  • The operating voltage of the sensor is between 0-5V DC.
  • The operating current of the sensor is between 200-500mA.
  • The operating temperature of the sensor is between -45°C-80°C.
  • The flat resistance of the sensor is 25K ohms.
  • The bending resistance range of the sensor is between 45K-125k ohms.
  • The resistance tolerance of the sensor is ±30%.

Components needed 

  • Arduino UNO
  • One 2.2-inch flex sensor
  • One 10k ohms resistor
  • Breadboard
  • Jumper wires

Pin connections of the flex sensor with the Arduino UNO

  • Connect the P2 terminal of the sensor to the GND pin of the Arduino UNO.
  • Connect the P1 terminal to the A0 pin of the Arduino UNO.
  • Connect one terminal of the 10k ohms resistor to the P1 terminal of the sensor.
  • Connect another terminal of the 10K ohms resistor to the 5-volt pin of the Arduino UNO.

Circuit diagram of the Flex sensor with Arduino UNO

flex sensor circuit diagram

Arduino code for the Flex sensor

const int sensor=A0;
//Define pin for sensor
void setup() {
 
Serial.begin(9600);
//Set baud rate for serial communication
pinMode(sensor,INPUT);
//Set sensor pin as input
}
 
void loop() {
  int sensorD = analogRead(sensor);
//Read data from sensor using analogRead() function
  Serial.print("Data:");
  Serial.println(sensorD);
//Print the sensor data on the serial monitor
  delay(500);
}

Leave a Reply