Flexiforce Pressure Sensor (25lbs) Quick Start Guide


Introduction

This is a quick how-to explaining everything you need to get started using your Flexiforce Pressure Sensor.  This example uses the 25lb version, but the concepts learned apply to all the Flex sensors.

Flexiforce

Requirements

Necessary hardware to follow this guide:

You'll also need the Arduino IDE for programming.

Hardware

The Flexiforce Pressure Sensor is essentially a variable resistor. When no pressure is applied, the resistance between the two outer leads is incredibly large, probably greater than 10 Mega Ohms (more than my meter can measure). When pressure is applied, the resistance measured between the outer leads lowers until you've reached the max pressure it's intended to measure. In this case that's about 25 lbs of pressure, and the current Flexiforce Pressure sensor I'm using measures about 50K Ohms when given that max amount of pressure.

You can test the range of your sensor using a multimeter. Just attach the two outer leads to the multimeter and set the meter to measure resistance. Then squeeze the sensor and watch the resistance value change.

Now, let's read values with an Arduino. To do this, we create a voltage divider circuit with the Flexiforce sensor and an extra resistor. I picked 1M Ohm in this example because it's about in the middle of the Flexiforce sensor's dynamic range. Many other similar values could work as well.

Connect 5V to one side of the voltage divider, and GND to the other. In the middle, where the Flexiforce sensor and the resistor connect, connect one of the analog-in pins of the Arduino with a jumper wire. In this case I used pin A0. Here is a Fritzing diagram of the setup:

alt text

Fritzing Wiring Diagram

*Note*: The sensor in the image doesn't look exactly the same as the Flexiforce sensor, but very close. The actual Flexiforce sensor has a larger surface area.

Software

Now that you have your circuit wired and ready, it's time to write some very basic Arduino code.  This code is almost exactly the same as Arduino's standard AnalogReadSerial example. Let's take a look to see what it's doing:

     
// Flexiforce quick start example
// Reads A0 every 100ms and sends voltage value over serial

void setup() 
{
  // Start serial at 9600 baud
  Serial.begin(9600); 
}

    void loop() 
{
  // Read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  
  // Print out the value you read:
  Serial.println(voltage);
  
  // Wait 100 milliseconds
  delay(100);
}

The code is simply running in a small infinite loop every 100ms, or 10 times a second. In each pass through the loop, it measures the voltage on pin A0 and returns a corresponding value between 0 and 1023. 0 represents ground in this case and 1023 indicates A0 is sitting at 5 Volts. For other numbers in between, we can figure out the voltage by multiplying the measured number by the fraction, 5.0 / 1023.0. We then spit this value back over the Serial port, we can watch the values change in real time.

Go ahead and try. Make sure you have the hardware connected correctly. Program the Arduino, open up the Arduino Serial Monitor (make sure it's using 9600 baud), and watch the voltage values change as you press and release the Flexiforce Pressure Sensor.

Conclusion

Now you know how to use the Flexiforce Pressure Sensor. Believe it or not, there are many different analog sensors where you can use what you learned here and collect data the exact same way. Now it's all up to you to use these types of products however you imagine. If you have any other questions or comments, please drop them in the box below. Enjoy!

Comments 10 comments

  • very good tutorial about how to interface a force sensor. Also, I add this tutorial in my article about force sensors http://www.intorobotics.com/force-sensors-reviewed-and-programming-tutorials/

  • Hi, I have some questions, would this be exactly the same for the 1lb version? Also in the code where did you get the 1023 value are those bits? ohms? or what?

    // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1023.0);

    Thanks !

    • Yep - hooking it up is exactly the same.

      The 1023 comes from the 10 bit ADC used on the Arduino, which converts an analog signal into a digital value. 10 bits is 210 or 1024 different values. 0 is one of them, so the maximum is 1023 :)

  • i need to shot water jet for 100 milisec and check the change of pressure over time i planned to connect this sensor directly to Oscilloscope. Q1: can i use this sensor to measure jet pressure over time? jet diameter 0.5mm Q2: is it water proof?

  • Not sure if that has anything to do with this but the sensor that I am using has 3 pins and I connected the sensor directly on to the breadboard.

  • I set up the circuit the exact same way as it is shown in the above diagram. And used the exact same code. But when I press on the pressure sensor, the numbers on the serial monitor change from 0.00 to 0.05 and back to 0.00 when I release the sensor.

  • I purchased a sensor that had 3 pins instead of 2. How do I connect this one to an Arduino UNO board ? The part # SEN-08685

    • Use aligator clips on the outside sensor leads to jumper wires (into the breadboard).

  • if you are trying to have multiple pressure sensor to a single board, what would you do in wiring?

    • You would duplicate the wiring, but run each sensor to its own analog pin on the Arduino. Each pin would then need to be defined and read in the code.