Introduction: How to Use a Force Sensitive Resistor - Arduino Tutorial

Picture of How to Use a Force Sensitive Resistor - Arduino Tutorial

In this tutorial you will learn how to use an FSR - Force Sensitive Resistor with Arduino to fade an LED. This sensor is a variable resistor just like a photocell or flex sensor. The resistance changes by applying pressure on it.

Let's get started!

Step 1: What You Will Need

Picture of What You Will Need

For this tutorial you will need:

  • Arduino uno
  • Breadboard
  • Force sensitive resistor
  • LED
  • 10KOhm & 220 Ohm resistors

Step 2: The Circuit

Picture of The Circuit

The connections are pretty easy, see the image above with the breadboard circuit schematic.

Step 3: The Code

Here's the code, embedded using Codebender!

Try downloading the Codebender plugin and clicking on the "Run on Arduino" button to program your Arduino board with this sketch. And that's it, you've programmed your Arduino with this sketch.

How it works:

  • Read analog value from flex sensor
    :: value=analogRead(sensorPin);
  • Map analog values 0-1023 to PWM values 0-255
    :: value = map(value, 0, 1023, 0, 255);
  • Send pwm value to led
    :: analogWrite(ledPin, value);

You can make your own modifications to the code by clicking the "Edit" button.

Step 4: Well Done!

Picture of Well Done!

You have successfully completed one more Arduino "How to" tutorial and you learned how to use a Force Sensitive Resistor with Arduino.

I hope you liked this, let me know in the comments.

There will be more of them, so make sure to click Follow button!


Mase Hajika (author)2017-07-11

what is the maximum force?

FAisalF17 (author)2016-10-19

i need a code to measure how much force is applied on the sensor.....

FAisalF17 (author)2016-10-19

i need a code to measure how much force is applied on the sensor.....

FAisalF17 (author)2016-10-19

i need a code to measure how much force is applied on the sensor.....

seanmcquaid1 (author)2016-08-22

I am really new to all of this but would there be a way to measure the time that a force is applied? the amount of force is irrelevant for what i want to do. I just need to know if the time that the force is applied is < or > a certain time. many thanks

else23 (author)2016-08-02

What I don't really understand, why do I need a resistor to connect to the ground of arduino? How can I decide about the value of the resistor?

sangit-niroula (author)else232016-08-03

when we use any analog type sensors, we need to connect a resistor having around equal value to the sensor in series to make VOLTAGE DIVIDER CIRCUIT. VOLTAGE DIVIDER CIRCUIT is necessary to observe and grab the change in sensor parameter according to its physical correspondences..

Pigjosh31 (author)2016-02-18

What if I was to want to take 4 FSR's and apply a direction to each one such as left, right, up, and down. To make a controller that responded to where you push on the screen. Would anyone have any ideas on how to do that.

You could definitely do that! You just have to wire four of these sensors up, and write some fairly simple code. What do you want to use the controller for? I'd be glad to help out if you have any trouble with the project.

AjayK95 (author)2016-03-23

how to masure the force or load(gor kg) using force sensitive resistor

mutualhelp (author)2015-12-03

can i use this with a raspberry pi?

JRV31 (author)mutualhelp2016-01-15

This instructable show how using a force sensitive resistor

but counting microseconds is really a better way to do it than counting times through a loop.

JRV31 (author)mutualhelp2016-01-15

This instructable

shows how to use a capacitor to measure resistance on a RaspberryPi. You will need to experiment with the capacitor and resistor values to get the effect you want.

BSWill (author)2015-09-28

I know there are a million uses for this resistor (sensor), but I would really appreciate a list of some applications that this would excels as a viable option to use. Is there a place where I could see some of its current applications?

codebender_cc (author)BSWill2015-10-10

Hi! You can use it as a touch button switch!! :D

kooth (author)2015-09-30

Thanks for posting this. I have a few of these in a kit I got a few years ago but I hadn't gotten around to trying them out. Your Instructable has piqued my interest!

RamasamyN (author)2015-09-22

do you need jumper wires with the broadboard?

beer-liner (author)RamasamyN2015-09-22

I hate to state the absolutely Obvious, But you can see in the circuit that there are jumpers, wouldn't you think there are necessary when using a breadboard?

david.eaton (author)beer-liner2015-09-24

Hey, be nice. This could be a 7 year old kid that invents an artificial epiglottis for you someday. Jumpers are not mentioned in the stuff you will need. It's easy for us who do this without thinking to forget what is obvious to a veteran is obscure to a noob.

Yes, there are jumpers. Keep looking at following pictures, it will begin to make sense.

NerillDPN (author)beer-liner2015-09-22

To be fair, if Ramasamy hasn't had a load of experience with Arduino, there 'could' be a little confusion and perhaps not necessarily obvious is obvious. The list of items didn't include cables and the completed assembled photo shown in step four appears to be a shield rather than a regular breadboard and the wiring is kinda hidden behind the Arduino/Shield/components. The Fritzing diagram showed the connections, but unless one is truly familiar there could be some doubt. Besides, isn't this a forum to ask questions without fear of ridicule? A little empathy or at least withholding the unnecessary snarky should be the rule.

codebender_cc (author)RamasamyN2015-09-22

Hi! If you mean breadboard cables, yes of course.

beer-liner (author)2015-09-22

what are the specs for resistance values for FSR e.g static value and sensitivity etc.


codebender_cc (author)beer-liner2015-09-22

Hello Steve, this pdf file from Adafruit will help you find more info about FSRs:

About This Instructable




Bio: Arduino Tutorials by Team
More by codebender_cc:How to use a magnetic door switch / sensor with ArduinoHow to Measure LUX With ArduinoHow to Control an RGB LED Strip - Arduino Tutorial
Add instructable to: