SHRIRAM SPARK

THINK DIFFERENT

FLEXIFORCE PRESSURE SENSOR – 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.

50eb248dce395f941f000000

Requirements

Necessary hardware to follow this guide:

  • Arduino UNO or other Arduino compatible board
  • Flexiforce Pressure Sensor
  • Breadboard
  • M/M Jumper Wires
  • 1 MegaOhm Resistor 

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 aFritzing diagram of the setup:

50eb2efece395ffb21000001

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!

1 Comment

  1. Rajasekar Raman

    August 10, 2016 at 2:40 pm

    your explanation is excellent. Thank you 🙂

Leave a Reply

Your email address will not be published.

*

© 2017 SHRIRAM SPARK

Theme by Anders NorenUp ↑