Force Sensitive Resistor (FSR) Created by Ladyada

Similar documents
Tilt Sensor. Created by lady ada. Last updated on :04:38 PM UTC

Temperature Sensor. Positive + (to 5 volts.) Ground. To A0 To GND Signal. To 5v

Bill of Materials: Car Battery/charging system diagnostics PART NO

All About Batteries. Created by lady ada. Last updated on :22:29 PM UTC

(for example A0) on the Arduino you can expect to read a value of 0 (0V) when in its upright position and 1023 (5V) when it is tilted.

Troubleshooting Guide for Limoss Systems

The Easy Driver gives you the capability to drive bipolar stepper motors between 150mA to 700mA per phase.

USB, DC & Solar Lipoly Charger

IV-3 VFD Shield for Arduino. Assembly Manual

Conversion of a Turnigy 9X to Hall effect sensors

Troubleshooting Guide for Okin Systems

EFIE Wideband O2 (Electronic Fuel Injector Enhancer) Installation & Operating Instructions.

Pressure and presence sensors in textile

Multi-Cell LiPo Charging

Simple Eurorack Row. Kit Builder's Guide. 4mspedals.com

Using the wrong voltage and/or low current can cause a variety of problems:

Roehrig Engineering, Inc.

Adafruit MicroLipo and MiniLipo Battery Chargers

The Volt Vette Project

SHOCK DYNAMOMETER: WHERE THE GRAPHS COME FROM

EMG SpikerShield v1.2 Instructions

SB-GVS Shield v1.0. ! Ideal for servo & sensor accessories (Phidgets, Seeed Bricks)! Full break-out for all 12 digital lines & 6 analog lines 2

CHAPTER 2. Current and Voltage

How to use the Multirotor Motor Performance Data Charts

Chapter 2. Battery Charger and Base Assembly

elabtronics Voltage Switch

ECT Display Driver Installation for AP2 Module

BASIC ELECTRICAL MEASUREMENTS By David Navone

Using your Digital Multimeter

Let's start our example problems with a D'Arsonval meter movement having a full-scale deflection rating of 1 ma and a coil resistance of 500 Ω:

Lab 4.4 Arduino Microcontroller, Resistors, and Simple Circuits

Fig 1 An illustration of a spring damper unit with a bell crank.

Connecting the rear fog light on the A4 Jetta, while keeping the 5 Light Mod

G203V / G213V MANUAL STEP MOTOR DRIVE

Happy Friday! Do this now:

Prototyping Walk through for PIC24HJ32GP202 Startup Schematic

Battery Power for LED Pixels and Strips

Installing Rear Brake Pads on a WK Jeep

U-Score U-Score AAC Rank AAC Rank Vocabulary Vocabulary

Application Notes. -DM01 Linear Shape Memory Alloy Actuator with Basic Stamp Microcontroller Kit

Linear Stepper Driver v0.9.2 Assembly Instructions

Adding an LED indicator to the X10-WS467 wall switch Credit: Bruce Stydnicki

Note: Do NOT mix LED and incandescent lamps in the same circuit!

What you need to know about Electric Locos

Change to BLUE High Density LED in Dashboard for Volvo V

BATTERY BOOSTER SHIELD

As stated, these are solely based off of how I like to do the Pre-Trip. I give my personal opinions as well as some helpful tips.

In this installment we will look at a number of things that you can do with LEDs on your layout. These will include:

Using 1.75mm Filament on Ultimaker 2

Load Cell Amplifier HX711 Breakout Hookup Guide

Here's the difference (externally) in the and 04+ bumper and headlights: (00-03 on top, 04 on bottom)

Mandatory Experiment: Electric conduction

Make Black Powder 7/2/2012

SMART LAB PUTTING TOGETHER THE

Shay Plumbing VIII - Steam Turret & Associated Plumbing

Circuit Basics and Components

2.007 Design and Manufacturing I, Spring 2013 EXAM #2

TECHNICAL NOTE #4 Revised May 24, BOGART ENGINEERING Two Bar Road, Boulder Creek, CA (831)

Wide Band EFIE Installation Instructions. Locate the wide band oxygen sensor current wire

Integration Guide TPE-500 SERIES. Force Sensing Resistor

Quick Guide. Unipro Laptimer Version Go faster faster. UNIPRO ApS

Megasquirt II with V3.0 PCB Stock Rotary CAS Setting up your 2 rotor engine to use a stock unmodified Mazda Crank Angle Sensor with Megasquirt

General Purpose Flasher Circuit

2010 Toyota Prius model II Head Unit Upgrade

TONY S TECH REPORT. Basic Training

Electronic Paint- Thickness Gauges What They Are, and Why You Need Them

11.1 CURRENT ELECTRICITY. Electrochemical Cells (the energy source) pg Wet Cell. Dry Cell. Positive. Terminal. Negative.

Basic Electronics Course Part 1

Implementation Notes. Solar Group

Build Manual. for Studying Electrical Conductivity using a 3D Printed 4-Point Probe Station

Lab 1: DC Motors Tuesday, Feb 8 / Wednesday, Feb 9

SM361 RIG SWITCH CONSTRUCTION MANUAL

Li-Ion & LiPoly Batteries

Manual Transmission Hard To Get Into Gear. When Cold >>>CLICK HERE<<<

Smiths Tachometer Calibration and Repair

Flexiforce Demo Kit (#28017) Single Element Pressure Sensor

Disconnect the negative battery cable!

An Actual Driving Lesson. Learning to drive a manual car

Converting an A to 12v and Adding Turn Signals Bill Lee

PARTS LIST. Beams: 72x. 16x. 64x. 16x. 12x. 2x Breadboards CYB x TotemDuino 1x LabBoard 1x 30cm 34way Flat Cable 1x Power Supply 12v 1,5A

SP4 DOCUMENTATION. 1. SP4 Reference manual SP4 console.

Unit 5. Guided Work Sheet Sci 701 NAME: 1) Define the following key terms. Acceleration. DC motor. Direct current (DC) Force.

Engineers in Training Day 2. Developed by Shodor and Michael Woody

*Some speedometers have these additional electronic connections. If yours does, then remove the smaller slotted screws shown.

GM A-Body Instructions 3 & 2½ Header Applications w/ Balance Tube Crossover

BMW 528i E39 Trunk Harness Repair

Experiment 3: Ohm s Law; Electric Power. Don t take circuits apart until the instructor says you don't need to double-check anything.

Corrado Club of Canada. VR6 Engine FAQ. By: Dennis

Only use if safe to do so and at your own risk.

Lab Electronics Reference: Tips, Techniques, and Generally Useful Information for the Labs

Advanced Troubleshooting Guide Snorkel V Battery Charger Rev 0 3JAN07

MONGOOSE. Introduction. < blueroomelectronics > Assembly Instructions. Mongoose was designed as an introduction to Mechatronics.

How to Build with the Mindstorm Kit

INSTRUCTIONS FOR TRI-METRIC BATTERY MONITOR May 8, 1996

ELECTRICITY: INDUCTORS QUESTIONS

Prove all things; hold fast that which is good.1 Thessalonians 5:21

Build Instructions and User Guide

Pre-lab Questions: Please review chapters 19 and 20 of your textbook

Module 11 Thermistor Inputs

DEFIE (Digital Electronic Fuel Injector Enhancer) Installation & Operating Instructions.

Transcription:

Force Sensitive Resistor (FSR) Created by Ladyada

Guide Contents Guide Contents Overview Some Basic Stats These stats are specifically for the Interlink 402, but nearly all FSRs will be similar. Checking the datasheet will always illuminate any differences How to measure force/pressure with an FSR Testing an FSR Connecting to an FSR Using an FSR Analog Voltage Reading Method Simple Demonstration of Use Simple Code for Analog FSR Measurements In-Depth Code for Analog FSR Measurements BONUS! Reading FSR Measurements Without Analog Pins. Example Projects Buy an FSR 2 3 4 4 4 6 7 9 9 10 12 14 17 22 23 Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 2 of 23

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. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 3 of 23

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! Some Basic Stats These stats are specifically for the Interlink 402, but nearly all FSRs will be similar. Checking the datasheet will always illuminate any differences Size: 1/2" (12.5mm) diameter active area by 0.02" thick (Interlink does have some that are as large as 1.5"x1.5") Price $7.00 from the Adafruit shop (http://adafru.it/166) 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 Po wer supply: Any! Uses less than 1mA of current (depends on any pullup/down resistors used and supply voltage) Datasheet (http://adafru.it/aky) (note there are some mathematical inconsistancies in here) 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 Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 4 of 23

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Ω. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 5 of 23

Testing an FSR The easiest way to determine how your FSR works is to connect a multimeter in resistancemeasurement mode (http://adafru.it/akt) 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'. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 6 of 23

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! FSRs are often a polymer with conductive material silk-screened on. That means they're plastic and the connection tab is crimped on somewhat delicate material. The best way to connect to these is to simply plug them into a breadboard. or use a clamp-style connector like alligator clips, or a female header. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 7 of 23

or a terminal block such as Phoenix #1881448 (http://adafru.it/akz) It is possible to solder onto the tabs but you must be very fast because if your iron is not good quality or you dally even a few seconds, you will melt the plastic and ruin the FSR! Do n't attempt to solder directly to your FSR unless you are absolutely sure you have the skills to do so. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 8 of 23

Using an FSR Analog Voltage Reading Method The easiest way to measure a resistive sensor is to connect one end to Power and the other to a pull-do wn resistor to ground. Then the point between the fixed pulldown resistor and the variable FSR resistor is connected to the analog input of a microcontroller such as an Arduino (shown). Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 9 of 23

For this example I'm showing it with a 5V supply but note that you can use this with a 3.3v supply just as easily. In this configuration the analog voltage reading ranges from 0V (ground) to about 5V (or about the same as the power supply voltage). The way this works is that as the resistance of the FSR decreases, the total resistance of the FSR and the pulldown resistor decreases from about 100Kohm to 10Kohm. That means that the current flowing through both resistors increases which in turn causes the voltage across the fixed 10K resistor to increase. Its quite a trick! Force (lb) Force (N) FSR (FSR + R) Current thru Resistance ohm FSR+R No ne No ne Infinite Infinite! 0 ma 0V 0.04 lb 0.2 N 30 Kohm 40 Kohm 0.13 ma 1.3 V 0.22 lb 1 N 6 Kohm 16 Kohm 0.31 ma 3.1 V 2.2 lb 10 N 1 Kohm 11 Kohm 0.45 ma 4.5 V 22 lb 100 N 250 ohm 10.25 Kohm 0.49 ma 4.9 V Vo ltage across R This table indicates the approximate analog voltage based on the sensor force/resistance w/a 5V supply and 10K pulldown resistor. Note that our method takes the somewhat linear resistivity but does not provide linear voltage! That's because the voltage equasion is: Vo = Vcc ( R / (R + FSR) ) That is, the voltage is proportional to the inverse of the FSR resistance. Simple Demonstration of Use Wire the FSR as same as the above example, but this time lets add an LED to pin 11. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 10 of 23

This sketch will take the analog voltage reading and use that to determine how bright the red LED is. The harder you press on the FSR, the brighter the LED will be! Remember that the LED has to be connected to a PWM pin for this to work, I use pin 11 in this example. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 11 of 23

These examples assume you know some basic Arduino programming. If you don't, maybe spend some time reviewing the basics at the Arduino tutorial? (http://adafru.it/aku) /* FSR testing sketch. Connect one end of FSR to 5V, the other end to Analog 0. Then connect one end of a 10K resistor from Analog 0 to ground Connect LED from pin 11 through a resistor to ground For more information see www.ladyada.net/learn/sensors/fsr.html */ int fsranalogpin = 0; // FSR is connected to analog 0 int LEDpin = 11; // connect Red LED to pin 11 (PWM pin) int fsrreading; // the analog reading from the FSR resistor divider int LEDbrightness; void setup(void) { Serial.begin(9600); // We'll send debugging information via the Serial monitor pinmode(ledpin, OUTPUT); void loop(void) { fsrreading = analogread(fsranalogpin); Serial.print("Analog reading = "); Serial.println(fsrReading); // we'll need to change the range from the analog reading (0-1023) down to the range // used by analogwrite (0-255) with map! LEDbrightness = map(fsrreading, 0, 1023, 0, 255); // LED gets brighter the harder you press analogwrite(ledpin, LEDbrightness); delay(100); Simple Code for Analog FSR Measurements Here is a code example for measuring the FSR on an analog pin. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 12 of 23

Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 13 of 23

This code doesn't do any calculations, it just prints out what it interprets as the amount of pressure in a qualitative manner. For most projects, this is pretty much all thats needed! /* 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 For more information see www.ladyada.net/learn/sensors/fsr.html */ int fsrpin = 0; int fsrreading; // the FSR and 10K pulldown are connected to a0 // 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); In-Depth Code for Analog FSR Measurements This Arduino sketch that assumes you have the FSR wired up as above, with a 10K? pull down resistor and the sensor is read on Analog 0 pin. It is pretty advanced and will measure the approximate Newton force measured by the FSR. This can be pretty useful for calibrating what forces you think the FSR will experience. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 14 of 23

Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 15 of 23

/* FSR 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 For more information see www.ladyada.net/learn/sensors/fsr.html */ int fsrpin = 0; // the FSR and 10K pulldown are connected to a0 int fsrreading; // the analog reading from the FSR resistor divider int fsrvoltage; // the analog reading converted to voltage unsigned long fsrresistance; // The voltage converted to resistance, can be very big so ma ke "long" unsigned long fsrconductance; long fsrforce; // Finally, the resistance converted to force void setup(void) { Serial.begin(9600); // We'll send debugging information via the Serial monitor void loop(void) { fsrreading = analogread(fsrpin); Serial.print("Analog reading = "); Serial.println(fsrReading); // analog voltage reading ranges from about 0 to 1023 which maps to 0V to 5V (= 5000mV ) Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 16 of 23

fsrvoltage = map(fsrreading, 0, 1023, 0, 5000); Serial.print("Voltage reading in mv = "); Serial.println(fsrVoltage); if (fsrvoltage == 0) { Serial.println("No pressure"); else { // The voltage = Vcc * R / (R + FSR) where R = 10K and Vcc = 5V // so FSR = ((Vcc - V) * R) / V yay math! fsrresistance = 5000 - fsrvoltage; // fsrvoltage is in millivolts so 5V = 5000mV fsrresistance *= 10000; // 10K resistor fsrresistance /= fsrvoltage; Serial.print("FSR resistance in ohms = "); Serial.println(fsrResistance); fsrconductance = 1000000; // we measure in micromhos so fsrconductance /= fsrresistance; Serial.print("Conductance in micromhos: "); Serial.println(fsrConductance); // Use the two FSR guide graphs to approximate the force if (fsrconductance <= 1000) { fsrforce = fsrconductance / 80; Serial.print("Force in Newtons: "); Serial.println(fsrForce); else { fsrforce = fsrconductance - 1000; fsrforce /= 30; Serial.print("Force in Newtons: "); Serial.println(fsrForce); Serial.println("--------------------"); delay(1000); BONUS! Reading FSR Measurements Without Analog Pins. Because FSR's are basically resistors, its possible to use them even if you don't have any analog pins on your microcontroller (or if say you want to connect more than you have analog input pins. The way we do this is by taking advantage of a basic electronic property of resistors and capacitors. It turns out that if you take a capacitor that is initially storing no voltage, and then connect it to power through a resistor, it will charge up to the power voltage slowly. The bigger the resistor, the slower it is. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 17 of 23

This capture from an oscilloscope shows whats happening on the digital pin (yellow). The blue line indicates when the sketch starts counting and when the couting is complete, about 1.2ms later. This is because the capacitor acts like a bucket and the resistor is like a thin pipe. To fill a bucket up with a very thin pipe takes enough time that you can figure out how wide the pipe is by timing how long it takes to fill the bucket up halfway. Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 18 of 23

In this case, our 'bucket' is a 0.1uF ceramic capacitor. You can change the capacitor nearly any way you want but the timing values will also change. 0.1uF seems to be an OK place to start for these FSRs. /* FSR simple testing sketch. Connect one end of FSR to power, the other end to pin 2. Then connect one end of a 0.1uF capacitor from pin 2 to ground For more information see www.ladyada.net/learn/sensors/fsr.html */ int fsrpin = 2; int fsrreading; int ledpin = 13; // the FSR and cap are connected to pin2 // the digital reading // you can just use the 'built in' LED void setup(void) { // We'll send debugging information via the Serial monitor Serial.begin(9600); pinmode(ledpin, OUTPUT); // have an LED for output void loop(void) { // read the resistor using the RCtime technique fsrreading = RCtime(fsrPin); if (fsrreading == 30000) { // if we got 30000 that means we 'timed out' Serial.println("Nothing connected!"); else { Serial.print("RCtime reading = "); Serial.println(fsrReading); // the raw analog reading Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 19 of 23

// Do a little processing to keep the LED blinking fsrreading /= 10; // The more you press, the faster it blinks! digitalwrite(ledpin, HIGH); delay(fsrreading); digitalwrite(ledpin, LOW); delay(fsrreading); delay(100); // Uses a digital pin to measure a resistor (like an FSR or photocell!) // We do this by having the resistor feed current into a capacitor and // counting how long it takes to get to Vcc/2 (for most arduinos, thats 2.5V) int RCtime(int RCpin) { int reading = 0; // start with 0 // set the pin to an output and pull to LOW (ground) pinmode(rcpin, OUTPUT); digitalwrite(rcpin, LOW); // Now set the pin to an input and... pinmode(rcpin, INPUT); while (digitalread(rcpin) == LOW) { // count how long it takes to rise up to HIGH reading++; // increment to keep track of time if (reading == 30000) { // if we got this far, the resistance is so high // its likely that nothing is connected! break; // leave the loop // OK either we maxed out at 30000 or hopefully got a reading, return the count return reading; It is possible to calculate the actual resistance from the reading but unfortunately, variations in the IDE and arduino board will make it inconsistant. Be aware of that if you change IDE versions of OS's, or use a 3.3V arduino instead of 5V, or change from a 16mhz Arduino to a 8Mhz one Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 20 of 23

(like a lilypad) there may be differences due to how long it takes to read the value of a pin. Usually that isn't a big deal but it can make your project hard to debug if you aren't expecting it! Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 21 of 23

Example Projects Here are just a few examples of projects that use FSRs! Control LEDs (its a little dark but he's pressing an FSR). FSR thumb-wrestling (example from Stanford U. class) (http://adafru.it/al0) Tapper, a musical interface that works by having you tap your fingers to the music (http://adafru.it/al1) Adafruit Industries http://learn.adafruit.com/force-sensitive-resistor-fsr Page 22 of 23

Buy an FSR Buy an FSR (http://adafru.it/166) Adafruit Industries Last Updated: 2012-08-13 11:45:25 PM EDT Page 23 of 23