One Flex/Bend Sensor working.

The Sensor

A Flex/Bend Sensor is basically a resistor of variable Ohm “strength”. When it is flexed/bent, it would have larger amount of resistance, than it would have in its natural straight “posture”. The conductive particles inside the sensor are farer away, when it is flexed/bent – this makes the electricity come through with more of an effort than when the conductive particles are closer together.

The Circuit and the Code

I connected different Flex/Bend Sensors first to the Arduino Uno, later to a LilyPad to check out the output. It turns out, that not all sensors output the same range of numbers, even if they are meant to be the same. The reason for this seem to be hardware based differences in the sensors.

OneFlexSensorArduino

CloserOneFlexSensor

OneFlexSensorLilyPad

I used the following code to map the values the sensor was delivering.

int sensor = A0;
void setup() {
Serial.begin(9600);
pinMode(sensor, INPUT);
}
void loop() {
int flex = analogRead(sensor);
delay(500);
int mapped = map(flex, 150, 400, 0, 180);
Serial.println(mapped);
}

For a better understanding of the circuit, I made this picture in “Fritzing”:

FRIZZINGFlexSensorArduino

2 Replies to “One Flex/Bend Sensor working.”

Comments are closed.