COMPONENTS -
Arduino UNO R3 X 1
FSR sensor X 1
LED X 1
What is FSR ?
The FSR is made of 2 layers separated by a spacer. The more one presses, the more of those Active Element dots touch the semiconductor and that makes the resistance go down. FSRs are basically a resistor that changes its resistive value (in ohms Ω) depending on how much it is pressed. These sensors are fairly low cost, and easy to use but they're rarely accurate. They also vary some from sensor to sensor perhaps 10%. So basically when you use FSRs you should only expect to get ranges of response. While FSRs can detect weight, they're a bad choice for detecting exactly how many pounds of weight are on them.
Connection-
Connect one end of FSR to 5V, the other end to Analog 0. Then connect one end of a 10K resistor from Analog 0 to ground Connect LED from pin 13 through a resistor to ground
CODE-
int fsrAnalogPin = 0; // FSR is connected to analog 0 int LEDpin = 11; // connect Red LED to pin 11 (PWM pin) int fsrReading; // the analog reading from the FSR resistor divider int LEDbrightness; void setup(void) { Serial.begin(9600); // We'll send debugging information via the Serial monitor pinMode(LEDpin, OUTPUT); } void loop(void) { fsrReading = analogRead(fsrAnalogPin); Serial.print("Analog reading = "); Serial.println(fsrReading); // we'll need to change the range from the analog reading (0-1023) down to the range // used by analogWrite (0-255) with map! LEDbrightness = map(fsrReading, 0, 1023, 0, 255); // LED gets brighter the harder you press analogWrite(LEDpin, LEDbrightness); delay(100); }
*if there is any problem while making this project do comment