Hi there!
I'm using multiple flex sensors. Measured individually, each sensors shows a resistance around 25kohm when straight and around 60kohm when bend.
const int FLEX_PIN = A0; // Pin connected to voltage divider output
// Measure the voltage at 5V and the actual resistance of your
// 47k resistor, and enter them below:
const float VCC = 5; // Measured voltage of Ardunio 5V line
const float R_DIV = 10000.0; // Measured resistance of 3.3k resistor
// Upload the code, then try to adjust these values to more
// accurately calculate bend degree.
const float STRAIGHT_RESISTANCE = 24000.0; // resistance when straight
const float BEND_RESISTANCE = 60000.0; // resistance at 90 deg
void setup()
{
Serial.begin(9600);
pinMode(FLEX_PIN, INPUT);
pinMode(FLEX_PIN1, INPUT);
}
void loop()
{
// Read the ADC, and calculate voltage and resistance from it
int flexADC = analogRead(FLEX_PIN);
float flexV = flexADC * VCC / 1023.0;
float flexR = R_DIV * (VCC / flexV - 1.0);
Serial.println("Resistance: " + String(flexR) + " ohms");
// Use the calculated resistance to estimate the sensor's
// bend angle:
float angle = map(flexR, STRAIGHT_RESISTANCE, BEND_RESISTANCE,
0, 90.0);
Serial.println("Bend: " + String(angle) + " degrees");
Serial.println();
delay(500);
}
The code that I use to measure each flex sensor indvidually.
The problem is when I use it all together at once. The value changes drastically and even the bend angle becomes mess up. Is this due to the multiple amount of flex sensor or the introduction of other electrical component?