Difference between revisions of "Force Sensitive Resistor"
(→Simple Code for Analog FSR Measurements) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 55: | Line 55: | ||
[[File:Fsrpulldowndia.png | 400px]] | [[File:Fsrpulldowndia.png | 400px]] | ||
− | [[File:Fsrpulldownsch.gif | 400px]] | + | [[File:Fsrpulldownsch.gif | 200px]] |
+ | |||
+ | [[File:Simpletestout.gif | 400px]] | ||
+ | |||
+ | |||
+ | |||
+ | <syntaxhighlight lang="c"> | ||
+ | |||
+ | /* FSR simple testing sketch. | ||
+ | |||
+ | Connect one end of FSR to power, the other end to Analog 0. | ||
+ | Then connect one end of a 10K resistor from Analog 0 to ground | ||
+ | |||
+ | |||
+ | int fsrPin = 0; // the FSR and 10K pulldown are connected to a0 | ||
+ | int fsrReading; // the analog reading from the FSR resistor divider | ||
+ | |||
+ | void setup(void) { | ||
+ | // We'll send debugging information via the Serial monitor | ||
+ | Serial.begin(9600); | ||
+ | } | ||
+ | |||
+ | void loop(void) { | ||
+ | fsrReading = analogRead(fsrPin); | ||
+ | |||
+ | Serial.print("Analog reading = "); | ||
+ | Serial.print(fsrReading); // the raw analog reading | ||
+ | |||
+ | // We'll have a few threshholds, qualitatively determined | ||
+ | if (fsrReading < 10) { | ||
+ | Serial.println(" - No pressure"); | ||
+ | } else if (fsrReading < 200) { | ||
+ | Serial.println(" - Light touch"); | ||
+ | } else if (fsrReading < 500) { | ||
+ | Serial.println(" - Light squeeze"); | ||
+ | } else if (fsrReading < 800) { | ||
+ | Serial.println(" - Medium squeeze"); | ||
+ | } else { | ||
+ | Serial.println(" - Big squeeze"); | ||
+ | } | ||
+ | delay(1000); | ||
+ | } | ||
+ | |||
+ | </syntaxhighlight> |
Latest revision as of 14:08, 28 November 2012
Contents
Overview
FSRs are sensors that allow you to detect physical pressure, squeezing and weight. They are simple to use and low cost. This is a photo of an FSR, specifically the Interlink 402 model. The 1/2" diameter round part is the sensitive bit.
The FSR is made of 2 layers seperated by a spacer. The more one presses, the more of those Active Element dots touch the semiconductor and that makes the resistance go down.
FSR's are basically a resistor that changes its resistive value (in ohms Ω) depending on how much its pressed. These sensors are fairly low cost, and easy to use but they're rarely accurate. They also vary some from sensor to sensor perhaps 10%. So basically when you use FSR's you should only expect to get ranges of response. While FSRs can detect weight, they're a bad choice for detecting exactly how many pounds of weight are on them.
However, for most touch-sensitive applications like "has this been squeezed or pushed and about how much" they're a good deal for the money!
Specification
- Size: 1/2" (12.5mm) diameter active area by 0.02" thick
- Resistance range: Infinite/open circuit (no pressure), 100KΩ (light pressure) to 200Ω (max. pressure)
- Force range: 0 to 20 lb. (0 to 100 Newtons) applied evenly over the 0.125 sq in surface area
- Power supply: Any! Uses less than 1mA of current (depends on any pullup/down resistors used and supply voltage)
- Datasheet
How to measure force/pressure with an FSR
As we've said, the FSR's resistance changes as more pressure is applied. When there is no pressure, the sensor looks like an infinite resistor (open circuit), as the pressure increases, the resistance goes down. This graph indicates approximately the resistance of the sensor at different force measurements. (Note that force is not measured in grams and what they really mean is Newtons * 100!)
Its important to notice that the graph isn't really linear (its a log/log graph) and that at especially low force measurements it quickly goes from infinite to 100KΩ.
Testing an FSR
The easiest way to determine how your FSR works is to connect a multimeter in resistance-measurement mode to the two tabs on your sensor and see how the resistance changes. Because the resistance changes a lot, a auto-ranging meter works well here. Otherwise, just make sure you try different ranges, between 1 Mohm and 100 ohm before 'giving up'.
Connecting to an FSR
Because FSRs are basically resistors, they are non-polarized. That means you can connect them up 'either way'a and they'll work just fine!
We recommend to use a 2.54mm female header to connect to it.
FSR Sample Project
Simple Code for Analog FSR Measurements
<syntaxhighlight lang="c">
/* FSR simple testing sketch.
Connect one end of FSR to power, the other end to Analog 0. Then connect one end of a 10K resistor from Analog 0 to ground
int fsrPin = 0; // the FSR and 10K pulldown are connected to a0
int fsrReading; // the analog reading from the FSR resistor divider
void setup(void) {
// We'll send debugging information via the Serial monitor Serial.begin(9600);
}
void loop(void) {
fsrReading = analogRead(fsrPin); Serial.print("Analog reading = "); Serial.print(fsrReading); // the raw analog reading // We'll have a few threshholds, qualitatively determined if (fsrReading < 10) { Serial.println(" - No pressure"); } else if (fsrReading < 200) { Serial.println(" - Light touch"); } else if (fsrReading < 500) { Serial.println(" - Light squeeze"); } else if (fsrReading < 800) { Serial.println(" - Medium squeeze"); } else { Serial.println(" - Big squeeze"); } delay(1000);
}
</syntaxhighlight>