Skip to Content

Force Sensing Resistor (FSR) with Arduino Tutorial

Force Sensing Resistor (FSR) with Arduino Tutorial

FSRs are super robust pressure sensors that are used in all kinds of industries. You will find them in electronic drums, mobile phones, handheld gaming devices and many more portable electronics. These sensors are easy to use and great for sensing pressure.

In this tutorial you will learn how an FSR works and how to use it with Arduino. I have included 3 examples with a wiring diagram and code so you can start experimenting with your sensor.

First I will show you the basic operation of the sensor. Next, we will look at using this sensor as a toggle switch. Lastly, I will show you how you can use LEDs to show the amount of pressure applied to the sensor.

If you would like to learn about other sensor, check out the articles below:

Supplies

Hardware components

fsr-402-roundFSR 402 sensor (round)× 1Amazon
fsr-406-squareFSR 406 sensor (square)× 1Amazon
Arduino Uno Rev 3Arduino Uno Rev3× 1Amazon
Breadboard× 1Amazon
Jumper wires~ 10Amazon
resistorResistor assortment box (see wiring for values)× 1Amazon
red-ledLEDs~ 10Amazon
USB cable type A/B× 1Amazon

Tools

multimeterMultimeterAmazon

Software

Arduino IDEArduino IDE

Makerguides.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on Amazon.com. As an Amazon Associate we earn from qualifying purchases.

How does an FSR work?

The resistance of an FSR depends on the pressure that is applied to the sensing area. The more pressure you apply, the lower the resistance. The resistance range is actually quite large: > 10 MΩ (no pressure) to ~ 200 Ω (max pressure). Most FSRs can sense force in the range of 100 g to 10 kg.

Basic construction

An FSR consists of two membranes and a spacer adhesive. The conducting membranes are separated by a thin air gap when no pressure is applied. One of the membranes contains two traces running from the tail to the sensing area (the round part). These traces are woven together, but not touching. The other membrane is coated with a conducting ink. When you push on the sensor, the ink shorts the two traces together with a resistance that depends on the pressure.

FSR Construction
FSR Construction

How to read an FSR?

The graph below displays the resistance vs force curve for the FSR 402 sensor. Note that the data is plotted on logarithmic scales. The response is not linear! As you can see there is a huge drop in resistance when a small amount of pressure is applied. After that, the resistance is inversely proportional to the applied force. At around 10 kg (not shown in the graph) the sensor is saturated and an increase in force yields little to no decrease in resistance.

FSR 402 Resistance vs Force curve
Resistance vs Force curve for FSR 402

Voltage divider circuit

In order to measure the applied force with an Arduino, you will need to build a voltage divider circuit with the FSR and a pull-down resistor. This circuit creates a variable voltage output that can be read by the ADC (analog to digital converter) input of the microcontroller.

Voltage divider circuit Interlink FSR 402
Voltage divider circuit and Vout vs Force curves for different R values. Data represents output for Interlink 402 FSR and V+ equal to 5 V. Reference: Interlink integration guide.

Selecting the right size resistor to match your sensor can be a bit tricky and depends on the force range you want to measure.

The graph above shows the Vout vs Force curves for different values of R (the pull-down resistor). A 10 kΩ resistor works well if you want to use the sensor over its entire force range (100 g to 10 kg). I like to buy these assortment boxes from Amazon so I always have a range of resistors on hand.

Calculation example

The output voltage (Vout) that we measure with the Arduino is described by the following equation:

Vout = Vcc x R / (R + Rfsr)

So the voltage is inversely proportional to the FSR resistance. Note that the output voltage you measure is the voltage drop across the pull-down resistor, not across the FSR.

When no force is applied, the FSR resistance will be really high, take 10 MΩ as an example. I used a 10 kΩ pull-down resistor and a Vcc of 5 V for this tutorial, which results in the following output when no force is applied:

Vout = 5 V x 10 kΩ/ (10 kΩ + 10 MΩ) = 0.005 V

So almost 0 V. If you press really hard on the FSR, the resistance will go down to roughly 200 Ω. This results in the following output voltage:

Vout = 5 V x 10 kΩ/ (10 kΩ + 200 Ω) = 4.9 V

As you can see, you should be able to measure an output voltage between 0 and 4.9V depending on the amount of force you apply to the sensor.

FSR Specifications

The technology used in FSRs is patented by Interlink Electronics which has been in operation since 1985. The most common types of FSR that you will find are the Interlink FSR 402 and 406.

This are the specifications of the round 402 sensor that I used in this tutorial.

FSR 402 Specifications

Actuation Force~0.1N minimum
Force Sensitivity Range~0.1N – 100N
Resistance Range>10 MΩ (open circuit) – ~200Ω
Force ResolutionContinuous (analog)
Force Repeatability± 6%
Active AreaØ 12.7 mm
Nominal Thickness0.55 mm
Switch Travel0.15 mm
Lifetime> 10 million actuations
Power SupplyAny! Uses less than 1mA of current, depending on the resistor used in the voltage divider.
CostCheck price

For more information, you can check out the datasheet here. It also includes data for the other sensors of the 400 Series.

Connecting to an FSR

You can easily connect to an FSR by using a breadboard.

The easiest way to connect to an FSR is to use a breadboard. This works great for prototyping and testing. If you need a more permanent solution, I highly recommend the Amphenol FCI Clincher Connector. You can just clamp these connectors around the silver traces of the connector and easily attach jumper or dupont cables.

Amphenol clincher connector
Amphenol FCI Clincher Connector

Warning

It is NOT recommended to solder directly to the exposed silver traces of the sensor. The substrate will melt during soldering and the solder joint won’t hold. Do not kink or crease the tail of the FSR if you are bending it; this can cause breaks in the printed silver traces. Interlink suggests a minimum bending radius of 2.5 mm.

Testing an FSR

The easiest way to see if your FSR is working correctly is to connect it to a multimeter. I used alligator test leads to connect the multimeter to the exposed leads of the sensor. Put your sensor in resistance (Ω) measuring mode and you should see the resistance value change when you press on the sensor.

Testing an FSR Force Sensitive Resistor
Measuring the resistance change when applying a load.

Because the resistance range is so big (200 kΩ to 200 Ω) it’s best to use a multimeter with autorange function. If you don’t have one of those, just play around with the range settings. 200 kΩ should enable you to see most of the range.

Wiring – Connecting a Force Sensing Resistor (FSR) to Arduino UNO

Now that you know the sensor is working correctly, it is time to connect it to the Arduino. We will be using a breadboard and jumper wires, as this is the easiest way to prototype a circuit.

As mentioned in the introduction, you need to create a circuit with a 10 kΩ pulldown resistor.

The wiring diagram below shows you how to connect the FSR sensor to the Arduino. Note that an FSR is non-polarized, just like normal resistors. There is no positive or negative side, just connect them in the orientation you want.

FSR with Arduino wiring diagram
FSR with Arduino UNO wiring diagram

Connect one of the leads of the FSR to power (5 V, but 3.3 V works just fine too) and the other lead to the analog in of the Arduino (A0). The 10 kΩ pulldown resistor gets connected between GND and A0.

Example 1 Connecting an FSR to Arduino UNO
Force sensor on Breadboard

1. FSR with Arduino example code – Analog voltage reading

Now that you have wired up the sensor, you can upload the following example code using the Arduino IDE.

This sketch will read out the sensor data from the analog input of the Arduino and display the output in the serial monitor.

As mentioned earlier, the output voltage of the sensor will be between 0 V (no pressure applied) and roughly 5 V (maximum pressure applied). The Arduino boards contain a multichannel, 10-bit analog to digital converter. This means that it will map the input voltage between 0 and 5 V into integer values between 0 and 1023. So you should see a value between 0 and 1023 in the serial monitor, depending on how hard you squeeze the sensor.

/* Simple example code for Force Sensitive Resistor (FSR) 
  with Arduino. More info: https://www.makerguides.com */

// Define FSR pin:
#define fsrpin A0

//Define variable to store sensor readings:
int fsrreading; //Variable to store FSR value

void setup() {
  // Begin serial communication at a baud rate of 9600:
  Serial.begin(9600);
}

void loop() {
  // Read the FSR pin and store the output as fsrreading:
  fsrreading = analogRead(fsrpin);

  // Print the fsrreading in the serial monitor:
  // Print the string "Analog reading = ".
  Serial.print("Analog reading = ");
  // Print the fsrreading:
  Serial.print(fsrreading);

  // We can set some threshholds to display how much pressure is roughly applied:
  if (fsrreading < 10) {
    Serial.println(" - No pressure");
  } else if (fsrreading < 200) {
    Serial.println(" - Light touch");
  } else if (fsrreading < 500) {
    Serial.println(" - Light squeeze");
  } else if (fsrreading < 800) {
    Serial.println(" - Medium squeeze");
  } else {
    Serial.println(" - Big squeeze");
  }

  delay(500); //Delay 500 ms.
}

You should see the following output in the serial monitor:

FSR serial monitor
Serial monitor output

Make sure the serial monitor is also set to a baud rate of 9600.

2. Using a Force Sensing Resistor (FSR) as a toggle switch

In this example you will be using the FSR sensor as a toggle switch. You can use this program to control all kinds of other functions, in this case to switch on and off an LED.

You will have to add a LED with a resistor to the circuit, which is shown in the diagram below.

Force sensitive resistor (FSR) with Arduino and LED wiring diagram
FSR with Arduino and LED wiring diagram

The negative lead of the LED (the short lead) gets connected to GND via a resistor and the positive lead to digital pin 2. The value of the resistor depends on the color LED you are using. You can use the following values as a guide:

  • Blue, Green, White or UV: 68 Ω
  • Red, Yellow or Yellow-Green: 150 Ω

If you don’t have any of these resistor values, try to find one that is close. You can also put multiple resistors in series, to get the correct value.

The sketch below will toggle the LED on and off when you press on the FSR. It looks at the value of the analog input pin and changes the state of the LED when the value exceeds 500. This means that a really light press won’t be detected.

This example also debounces the input and is based on the Arduino Switch tutorial.

/* Example code to use Force Sensitive Resistor (FSR) 
   as toggle switch to control LED. 
   More info: https://www.makerguides.com */

// Define pins:
#define fsrpin A0
#define ledpin 2

// Define variables:
int fsrreading; // The current reading from the FSR
int state = HIGH; // The current state of the output pin
int previous = 0; // The previous reading from the FSR
// The follow variables are long's because the time, 
// measured in miliseconds, will quickly become a 
// bigger number than can be stored in an int
long time = 0;  // The last time the output pin was toggled
long debounce = 40; // The debounce time, increase if the output flickers

void setup() {
  // Begin serial communication at a baud rate of 9600:
  Serial.begin(9600);
  // Set ledpin as output:
  pinMode(ledpin, OUTPUT);
}

void loop() {
  // Read the FSR pin and store the output as fsrreading:
  fsrreading = analogRead(fsrpin);

  // Print the fsrreading in the serial monitor:
  Serial.println(fsrreading);

  // If the input just went from below 500 to above 500 
  // and we've waited long enough to ignore any noise on the circuit, 
  // toggle the output pin and remember the time:
  if (fsrreading > 500 && previous < 500 && millis() - time > debounce) {
    if (state == HIGH)
      state = LOW;
    else
      state = HIGH;
    time = millis();
  }

  digitalWrite(ledpin, state);

  previous = fsrreading;
}

3. Control multiple LEDs with an FSR as pressure sensor

The example below makes it easy to see how much pressure you apply to the FSR. The more pressure you apply, the more LEDs will turn on.

You can wire up the LEDs in the same way as before, see the wiring diagram below. The LEDs are connected to digital pin 2 to 7. The FSR is also connected in the same way as before.

FSR-with-many-LEDS-and-Arduino-wiring-diagram-schematic-pinout
FSR with multiple LEDs and Arduino wiring diagram

Because the output voltage of the FSR is non-linear I set up a custom range for each LED to turn on. You might need to tweak this slightly for your own sensor.

/* Arduino example code to control multiple LEDs with a 
   Force Sensitive Resistor (FSR) as pressure sensor. 
   More info: https://www.makerguides.com */

// Define pins:
#define fsrpin A0
#define led1 2
#define led2 3
#define led3 4
#define led4 5
#define led5 6
#define led6 7

// Define variables:
int fsrreading;

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);
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
  pinMode(led6, OUTPUT);
}

void loop() {
  // Read the FSR pin and store the output as fsrreading:
  fsrreading = analogRead(fsrpin);

  // Print the fsrreading in the serial monitor:
  Serial.println(fsrreading);

  // Control the LEDs:
  if (fsrreading > 200) {
    digitalWrite(led1, HIGH);
  }
  else digitalWrite(led1, LOW);
  if (fsrreading > 450) {
    digitalWrite(led2, HIGH);
  }
  else digitalWrite(led2, LOW);
  if (fsrreading > 550) {
    digitalWrite(led3, HIGH);
  }
  else digitalWrite(led3, LOW);
  if (fsrreading > 650) {
    digitalWrite(led4, HIGH);
  }
  else digitalWrite(led4, LOW);
  if (fsrreading > 800) {
    digitalWrite(led5, HIGH);
  }
  else digitalWrite(led5, LOW);
  if (fsrreading > 900) {
    digitalWrite(led6, HIGH);
  }
  else digitalWrite(led6, LOW);
}

CAD files

Below you can find all the CAD files for sensors of the interlink 400 Series.

Conclusion

In this article, I have shown you how an FSR works and how you can use it with Arduino. I hope you found it useful and informative. If you did, please share it with a friend that also likes electronics!

I would love to know what projects you plan on building (or have already built) with an FSR. If you have any questions, suggestions, or if you think that things are missing in this tutorial, please leave a comment down below.

Note that comments are held for moderation to prevent spam.

Beth

Monday 20th of June 2022

Hey! Thank you for this tutorial. I am building a pressure sensor for a knee arthrometer that we designed in my lab. My goal is to be able to apply the right amount of pressure on the patella without the leg falling asleep while I measure the joint movement. I am VERY new to all of this. The sensor and script work well. However, I do not know what the numbers actually mean in the script. Can you help clarify this for me? I put 3.3 resistors on the breadboard (based on a separate tutorial). I am trying to figure out how much force is being applied to the patella. My goal is to be able to apply the same force/pressure to all of my subjects and keep the leg fixed in place while I translate their tibia and measure their cortical activation. I have to be specific about the calculations, but this is way out of my wheel house. I have looked into the Ohm and Joule equation but not sure what 1023 is measured in or how to incorporate the resistors. Now sure if you can help or direct me in some form or fashion. Thank you for everything!