I am currently trying to use FSRs for a school project. I have been through a handful of tutorials and I have made a few different codes that work with a single FSR. I would like to connect multiple FSRs and use each one as an individual input for my code. I started very simple with just reading in each individual pin value and then printing that pin value. The circuit that is being used can be seen in the image below.
The problem I am having is that there is a low analog input reading on pin 2 when I press the FSR on pin 1. I still get a reading on pin 1 as expected. The pin input that is numbered after the one I'm interested in is always the one that gets feedback. As in, pressing FSRpin(n) gives input on FSRpin(n+1) and pressing the last pin gives feedback on pin 1. See sample outputs below. Does anyone have suggestions on how to eliminate these effect? Do I need to make a more complicated circuit to eliminate feedback or something?
Small analog reading 1 = 0
Small analog reading 2 = 0
Small analog reading 3 = 515
Small analog reading 4 = 96
Small analog reading 1 = 423
Small analog reading 2 = 71
Small analog reading 3 = 3
Small analog reading 4 = 0
// Define pins:
#define largeFSRPin1 A0
#define largeFSRPin2 A2
#define largeFSRPin3 A4
#define largeFSRPin4 A6
#define smallFSRPin1 A8
#define smallFSRPin2 A10
#define smallFSRPin3 A12
#define smallFSRPin4 A14
#define led1 2
#define led2 3
#define led3 4
// Define Variable:
int largeFSRRead1;
int largeFSRRead2;
int largeFSRRead3;
int largeFSRRead4;
int smallFSRRead1;
int smallFSRRead2;
int smallFSRRead3;
int smallFSRRead4;
void setup() {
// Begin serial communication at a baud rate of 9600:
Serial.begin(9600);
// Set LED pins as output:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}
void loop() {
// Read the FSR pin and store the output as fsrreading:
largeFSRRead1 = analogRead(largeFSRPin1);
largeFSRRead2 = analogRead(largeFSRPin2);
largeFSRRead3 = analogRead(largeFSRPin3);
largeFSRRead4 = analogRead(largeFSRPin4);
smallFSRRead1 = analogRead(smallFSRPin1);
smallFSRRead2 = analogRead(smallFSRPin2);
smallFSRRead3 = analogRead(smallFSRPin3);
smallFSRRead4 = analogRead(smallFSRPin4);
// Print the fsrreading in the serial monitor:
// Print the string "Analog reading = ".
Serial.print("Large analog reading 1 = ");
// Print the fsrreading:
Serial.println(largeFSRRead1);
Serial.print("Large analog reading 2 = ");
// Print the fsrreading:
Serial.println(largeFSRRead2);
Serial.print("Large analog reading 3 = ");
// Print the fsrreading:
Serial.println(largeFSRRead3);
Serial.print("Large analog reading 4 = ");
// Print the fsrreading:
Serial.println(largeFSRRead4);
Serial.print("Small analog reading 1 = ");
Serial.println(smallFSRRead1);
Serial.print("Small analog reading 2 = ");
Serial.println(smallFSRRead2);
Serial.print("Small analog reading 3 = ");
Serial.println(smallFSRRead3);
Serial.print("Small analog reading 4 = ");
Serial.println(smallFSRRead4);
delay(500); //Delay 500 ms.
}
