I'm working on a project that's using a 2.2 inch spectra symbol flex sensor (Flex Sensor 2.2" - SEN-10264 - SparkFun Electronics) mounted on a glove to control a servo. Testing with a multimeter revealed a resistance rage of about 20k to 80k, so I constructed a voltage divider (5v connected to the flex sensor, and a 47k resistor going to ground), connecting the output to the A0 pin, as with any other resistive sensor.
Something isn't working properly, though, because when I look at the values from the analogRead function, they only range from about 1 to 6. I checked to see that the voltage divider was working with a multimeter and got values ranging from .5 to 2v, but for some reason the arduino isn't properly detecting the change. Replacing the flex sensor with a variable resistor produced normal analogRead values from ~22 to 1024, and a few other sensors also seemed to work normally.
I tried changing the value of the resistor in the voltage divider, and found that even when it was removed completely, the value continued to stay between 1 and 6. The datasheet for the flex sensor recommended the use of an impedance buffer, which I tried, but that failed to produce any significant change. Of course, I had never used an op-amp before, so I might have been constructed incorrectly.
Any ideas as to what might be going wrong, and how to fix it?
It's just the stock example code included with the arduino IDE:
/*
AnalogReadSerial
Reads an analog input on pin 0, prints the result to the serial monitor.
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}
Yes, I'm quite certain that I'm bending it the right way. The problem seems to be with the way the sensor and the arduino are interacting, since everything works fine when I look at voltage changes with a multimeter, and when I use a different type of sensor.
Edit: I found a different op-amp chip and used that for an impedance amplifier, and everything is working just fine now.