Force Sensitive Resistor and Arduino help?

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jman
 
Posts: 3
Joined: Tue Jun 14, 2011 11:59 pm

Force Sensitive Resistor and Arduino help?

Post by jman »

Hi,
For my class project, my team and I are trying to incorporate a FSR with a motor and a potentiometer so that when there is pressure above a preset value, the motor runs, and when the pressure exceeds a value that is set by the potentiometer, the motor stops. I have the coding down and it runs nicely, but I have no way of knowing what the potentiometer/FSR values represent. I know that they range from 0-255 once the raw values are divided by four to change it from 10 bits to 8 bits, but what do the values represent in newtons/pounds? We are using an FSR 402 and are looking to at least semi-accurately measure pressure up to 7 lbs.
To try to answer our question we tried to calibrate the FSR using a weight set, but our numbers were very inconsistent and we were reaching 240 values with only 1 kg/2.2 lbs when, from what I've read, the FSR is supposed to measure up to 10 kg/22ish lbs.
Any help is appreciated.
Thanks, Jared
P.s. I attached the code I am using.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Force Sensitive Resistor and Arduino help?

Post by adafruit_support_mike »

The code you tried to attach didn't come through.

The output you get from an FSR depends on how you've built the mechanism that presses on it. The best way to reduce variations is to mount the FSR on a flat, smooth surface, then press down on it with a flat, smooth surface the same size as the FSR's contact area.

To make it even better, put about 1/32" of soft rubber or silicone between the FSR and the pad that presses down on it. That will equalize pressure across the surface, so you don't get higher than expected values because some high spot is pressing harder than any other.

User avatar
jman
 
Posts: 3
Joined: Tue Jun 14, 2011 11:59 pm

Re: Force Sensitive Resistor and Arduino help?

Post by jman »

Ok I'll try that. Do you know if the FSR output values are linear in conjunction with the weight applied? When we initially tried to calibrate the FSR, while the values where quite erratic, they did produce a logarithmic curve when plotted, which would only complicate things. Also here's the code (using the code button):

Code: Select all

int sensePin = 2;    // the pin the FSR 400 is attached to
int motorPin = 9;      // the pin the LED is attached to (use one capable of PWM)
int potPin = A0;  //select input pin for the potentiometer
int potValue = 0; //variable to store the value coming from the potentiometer

void setup() {
  Serial.begin(9600); // initializes serial connection at 9600 bits per second
  pinMode(motorPin, OUTPUT);  // declare the ledPin as an OUTPUT
}

void loop() {
  potValue = analogRead(potPin) / 4; //read the value from the potentiometer
  int x = potValue;
  Serial.println(potValue);
  int value = analogRead(sensePin) / 4; //the voltage on the pin divded by 4 (to scale from 10 bits (0-1024) to 8 (0-255)
  Serial.println(value);              //print the value to the debug window
  if (value>= x){
    analogWrite (motorPin, 0);
  }
  else if (value < 30){
    analogWrite (motorPin, 0);
  }
  else if (value < x && value > 30){
    analogWrite (motorPin, x);
  }
}

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Force Sensitive Resistor and Arduino help?

Post by zener »

In my experience they are not linear or repeatable with any accuracy. They do not lend themselves to absolute measurements. However you may be able to come up with some techniques to get repeatability within some range. If you want any kind of accuracy you need to use strain gauges.

User avatar
jman
 
Posts: 3
Joined: Tue Jun 14, 2011 11:59 pm

Re: Force Sensitive Resistor and Arduino help?

Post by jman »

That's a good idea. The only problem is that we are trying to measure the pressure within someone's shoe, not the strain necessarily. Really, the ultimate goal is to find the average pressure within someone's shoe when it is tied. I know the pressure will vary significantly so it may not even be worth calibrating, but it is something our instructor thought was necessary.

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Force Sensitive Resistor and Arduino help?

Post by adafruit_support_bill »

To average the force over a larger area, this might be a better material to use: https://www.adafruit.com/product/1917

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Force Sensitive Resistor and Arduino help?

Post by zener »

You are putting the cart before the horse to hook a computer onto the sensor at this point. First you need to find a sensor/design and just read the resistance of the sensor with a multimeter, or read the voltage if you are using some divider or signal conditioning. You need to figure out the response you get before you decide if a computer can even make sense of it. If it is not repeatable, or if it is confused by things like the person's weight for example than it won't work.

In my opinion this sounds like a very tough thing to figure out. You are trying to isolate a particular piece of a total pressure. very tricky.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”