I'm using flex sensor for my project. Based on my reading, flex sensor working principle is that when bend, the resistance increases due to the conductive particles being further apart Flex Sensor Hookup Guide - SparkFun Learn
While that works fine and all, my problem comes during the reading from ADC. What I understand is that the value from ADC is actually the input voltage scaled to 1024 values. So I expect that when I bend the sensor, the resistance increase and hence the voltage will increase (V=IR). However, the reading shows a steady decline with bending.
const int flexPin0 = A0; //pin A0 to read analog input
int value0; //save analog value
void setup(){
Serial.begin(9600);
// while the serial stream is not open, do nothing:
}
void loop(){
value0 = analogRead(flexPin0); //Read and save analog value from potentiometer
Serial.println(value0); //Print value
delay (1000);
In case anyone needs to understand the problem, the Flex sensor needs to be the lower resistor in a voltage divider. In this case, it was incorrectly wired up as the upper one.
freaklabs:
In case anyone needs to understand the problem, the Flex sensor needs to be the lower resistor in a voltage divider. In this case, it was incorrectly wired up as the upper one.
I'm not sure it's a "problem", nor that the Flex-sensor / FSR "needs" to be on the bottom, nor that it's "incorrect" for it to be on top.
adafruit's tutorial shows it on top (as does sparkfun's which is where OP's pic came from), see adafruit's pic below. I'd say the point is, whichever way you wire it, you need to understand how a divider works so you know what to expect.