Make a Flex Sensor for Robotic Hand


In this tutorial, we will learn how to make and use a flex sensor.
We will control servo motor with a flex sensor.

Flex sensors are passive resistive devices that can be used to detect bending or flexing. The flex sensor shown in this tutorial is a flex sensor that decreases its resistance in proportion to the amount it is bent in either direction.You can easily make a sensor wider and longer depending upon your project.

Required materials

- Paper
- Flexible Cardboard or Plastic
- Pencil
- Aluminum Foil or Aluminum Tape
- Wires
- Hot Silicone or Solder

Get the Code:
#include <Servo.h>

Servo servo1; 
const int flexpin = 0;

void setup()  

void loop()
  int flexposition;  
  int servoposition;  
  flexposition = analogRead(flexpin); 
  servoposition = map(flexposition, 1018, 1023, 0, 90); 
  servoposition = constrain(servoposition, 0, 90);  
  Serial.print("sensor: "); 
  Serial.print(" servo: ");