Module introduction
FSR 402 force sensitive resistor, it can easily detect external pressure. It is essentially a variable resistor, similar to the principle of a photoelectric sensor or a bending sensor, and changes the resistance value by applying a pressure change on it.
How to Use a Force Sensitive Resistor
Step 1: What You Will Need
You will need:
- Arduino uno
- Breadboard
- Force sensitive resistor
- LED
- 10KOhm & 220 Ohm resistors
Step 2: The Circuit
- FSR402
+ ---->5v
- ---->10kOhm ----->GND
- ---->A0 - LED
+ ------->220Ohm ----->D3(PWM)
- ------->GND
The connections are pretty easy, see the image above with the breadboard circuit schematic.
Step 3: The Code
Sample code:
//Constants:
const int ledPin = 3; //pin 3 has PWM funtion
const int sensorPin = A0; //pin A0 to read analog input
//Variables:
int value; //save analog value
void setup(){
pinMode(ledPin, OUTPUT); //Set pin 3 as 'output'
Serial.begin(9600); //Begin serial communication
}
void loop(){
value = analogRead(sensorPin); //Read and save analog value from potentiometer
Serial.println(value); //Print value
value = map(value, 0, 1023, 0, 255); //Map value 0-1023 to 0-255 (PWM)
analogWrite(ledPin, value); //Send PWM value to led
delay(100); //Small delay
}
If you need FSR402, have a look at this product:
👉 FSR402
More Electronic Component,welcome to HALJIA!