Using Multiple FSR's with analogRead

Hi! I am very new to the Arduino scene and I am trying to read multiple force resistive sensors. When I used only one FSR sensor it works perfectly, however when I used more than one, the analog reading messes up. For example when I press one sensor (AnalogHeel), only the analogread connected to that sensor is supposed to read it, yet values appear for other sensors as well(AnalogPin1, Analog Pin2). Attached is a picture of what I mean. And below is the code. At first I thought it was a problem with the "int" and I turned it to "const int" for the analog pins. It worked right after I changed it but it still had the same problem the next day.

const int fsrAnalogPinHEEL = 5; //attach analog pins
const int fsrAnalogPin1 = 4;
const int fsrAnalogPin2 = 3;

int fsrReadingHEEL;
int fsrReadingPin1;
int fsrReadingPin2;// the analog reading from the FSR resistor divider

void setup(void) {
Serial.begin(9600); // We'll send debugging information via the Serial monitor

void loop(void) {
fsrReadingHEEL = analogRead(fsrAnalogPinHEEL);
fsrReadingPin1 = analogRead(fsrAnalogPin1);
fsrReadingPin2 = analogRead(fsrAnalogPin2);
Serial.print("Analog readingHEEL = ");
Serial.println(fsrReadingHEEL);

Serial.print("Analog readingPin1 = ");
Serial.println(fsrReadingPin1);

Serial.print("Analog readingPin2 = ");
Serial.println(fsrReadingPin2);

delay(1000);
}

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Maybe use a pulldown resistor to keep all inputs at ground potential until actively "pressed?" Search on analog pin pullup/pulldown. And your code; what @UKHeliBob said.

ANALOG INPUT	WIRED TO	CLOSED	OPEN
no pullup/down  GND         0       random
no pullup/down  Vcc         1       random
WITH pullup     either      0       1
with pullDOWN   either      1       0

That is because there is no code to determine that a particular sensor has been pressed and to print its value

What values are returned by the sensors when they are not touched ? If you knew that then you could detect that the reading for a sensor had increased (or decreased) and print just that value

Can you clarify this? Sorry I am new to using resistors.

When the sensor is not touched, the value is 0. When AnalogreadingHEEL is touched there should be a value greater than 0. And the rest (AnalogreadingPin1, AnalogreadingPin2) should be =0. Doesn't Analogread already detect that value?

Can you show a schematic of how you have the FSRs connected to the arduino?

Pins not tied low or high can float (be at random values).
pullup

The problem is that you are reading and printing all 3 values whatever they are

So you could do something like

if (fsrReadingHEEL > 0)
{
        Serial.print("Analog readingHEEL = ");
        Serial.println(fsrReadingHEEL);
}

Thanks for everyone's help. I finally figured how to make the fsrs work independently. However one problem came up. Some of the analogs began reading such large and small numbers. This is due to the different types of resistors. Can you explain how the difference in resistors can cause a change in the voltage read in analogs?

Which FSRs, how are they wired to the analog pins?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.