Posts | Comments

Planet Arduino

Archive for the ‘force’ Category

Nov
26

Sensing Weight With A Flexiforce + Arduino

arduino, flexiforce, force, tutorials, weight Comments Off on Sensing Weight With A Flexiforce + Arduino 

Felxiforce is a force sensor that is very similar to FSRs we just wrote about in principal. They change their resistance when you apply force to them. (The flexi part of the name is because they are flexible) Felxiforces are about twice as expensive as their FSR cousins, but these are much more stable, and are calibrated to a specific weight. You can buy them in 1, 25, or 100lb ratings. This article was written using the 100lb version.

Like the FSR I’m not sure if you can get a really precise weight reading from it, it seems a bit shaky, and the output seems to be logarithmic, not linear. But it does have a much larger range than the FSR, and in general will be better if you you need to sense a range of weights, or need to guess how much water is in a cup based on the weight.

When using the flexiforce, you need to make sure all the weight you want to sense is directed onto the small sensing area. So you may need to make a jig to direct the weight if you want to sense something you put on top of it.

Hooking it up, and why

The flexiforce sensor ranges its resistance between near infinite when not being touched, to under 25K ohms when you approach its weight limit. When barely touching it, it has a resistance of around 10M ohms.

We can measure that change using one of the Arduino’s analog inputs. But to do that, we need a fixed resistor (not changing) that we can use for that comparison (We are using a 10M (1,000,000 ohm) resistor). This is called a voltage divider and divides the 5v between the flexiforce and the resistor.

The analog read on your arduino is basically a voltage meter. At 5V (its max) it will read 1023, and at 0v it will read 0. So we can measure how much voltage is on the flexiforce using the analogRead and we will have our force reading.

The amount of that 5V that each part gets is proportional to its resistance. So if the the flexiforce and the resistor have the same resistance, the 5V is split evenly (2.5V) to each part. (analog reading of 512)

But if the flexiforce is pressed on pretty hard, reading only 25K of resistance, the 1M resistor is going to soak up 40 times as much of that 5V. So the FSR would only get .12V. (analog reading of 25)

And if something is barely pressing on it, the flexiforce may be 5M of resistance, so the flexiforce will soak up 5 times as much of that 5V as the 1M resistor. So the flexiforce would get 4.2V. (analog reading of 852)

Code

The arduino code for this just could not be easier. We are adding some serial prints and delays to it just so you can easily see the readings, but they dont need to be there if you dont need them.

//From the bildr article http://bildr.org/2012/11/flexiforce-arduino/

int flexiForcePin = A0; //analog pin 0

void setup(){
  Serial.begin(9600);
}

void loop(){
  int flexiForceReading = analogRead(flexiForcePin); 

  Serial.println(flexiForceReading);
  delay(250); //just here to slow down the output for easier reading
}
Unless otherwise stated, this code is released under the MIT License – Please use, change and share it.
Nov
26

Force Sensitive Resistor + Arduino

arduino, force, FSR, Sensor, tutorials Comments Off on Force Sensitive Resistor + Arduino 

The Force Sensitive Resistor, or FSR is one of those parts that fills bins in interaction design labs across the world. It’s a simple guy, a finicky guy, but it has its place in the maker toolbox.

A FSR is just what it sounds like – a resistor that changes its resistance with force. So if you press, sit, or punch it, its resistance changes. The finicky part tends to be when people want it to measure force with any sort of precision. It’s really not good for that, so if you need something sense even approximate weight or quantitative force, this is not your guy. But if you need something that will let you know if someone is sitting in a chair, or hugging a stuffed animal, this is it!

FSRs come in a wide variety of sizes, the larges ones can get a bit expensive, but you can probably find one to fit your project.

Hooking it up, and why

The FSR changes its resistance with force. It ranges from near infinite when not being touched, to under 300ohms when pressed really hard. So we can measure that change using one of the Arduino’s analog inputs. But to do that we need a fixed resistor (not changing) that we can use for that comparison (We are using a 10K resistor). This is called a voltage divider and divides the 5v between the FSR and the resistor.

The analog read on your arduino is basically a voltage meter. At 5V (its max) it will read 1023, and at 0v it will read 0. So we can measure how much voltage is on the FSR using the analogRead and we will have our force reading.

The amount of that 5V that each part gets is proportional to its resistance. So if the the FSR and the resistor have the same resistance, the 5V is split evenly (2.5V) to each part. (analog reading of 512)

But if the FSR is pressed on pretty hard, reading only 1K of resistance, the 10K resistor is going to soak up 10 times as much of that 5V. So the FSR would only get .45V. (analog reading of 92)

And if something is barely pressing on it, the FSR may be 40K of resistance, so the FSR will soak up 4 times as much of that 5V as the 10K resistor. So the FSR would get 4V. (analog reading of 819)

Code

The arduino code for this just could not be easier. We are adding some serial prints and delays to it just so you can easily see the readings, but they dont need to be there if you dont need them.

//From the article: http://bildr.org/2012/11/force-sensitive-resistor-arduino

int FSR_Pin = A0; //analog pin 0

void setup(){
  Serial.begin(9600);
}

void loop(){
  int FSRReading = analogRead(FSR_Pin); 

  Serial.println(FSRReading);
  delay(250); //just here to slow down the output for easier reading
}
Unless otherwise stated, this code is released under the MIT License – Please use, change and share it.


  • Newsletter

    Sign up for the PlanetArduino Newsletter, which delivers the most popular articles via e-mail to your inbox every week. Just fill in the information below and submit.

  • Like Us on Facebook