click here to enter

Force Sensitive Resistor - Kingston hackSpace

Kingston hackSpace

Force Sensitive Resistor

Force-Sensitive-Resistors (FSR) are specialised sensors that allow you to detect physical pressure, squeezing and weight. They are simple to use and they change the resistive value (in ohms Ω) depending on how much it’s pressed. In hackSpace we have two types: a square 1.75x1.5 inches and a round one 0.5 inches both sensitive in range of 100g-10kg.

However, the sensor is rarely accurate as the tolerance is in-between 10%. So basically when you use FSR’s you should only expect to get ranges of response, which are close to the value you are looking for. While FSRs can detect weight, they’re a bad choice for detecting exactly how many pounds of weight are on them.

Force Resistor & LED Arduino Pins
One of FSR leads PIN A0
The longer lead of an LED PIN D11
The other FSR lead 5V
Both FSR and LED GND

FSR has two connections positive and negative and it doesn’t really matter which way around the sensor is to your microcontroller. However the best way to connect to these is to simply plug them into a breadboard or use a clamp-style connector like alligator clips, female header, or a terminal block.

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 Force resistor. Don’t attempt to solder directly to your FSR unless you are absolutely sure you have the skills to do so.

 


/*

 http://www.arduino.cc/en/Tutorial/AnalogInput

 */

int sensorPin = A0;    // select the input pin for the potentiometer
    // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  // declare the ledPin as an OUTPUT:
  Serial.begin(9600);
}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  Serial.println(sensorValue);
}

Processing sketch...


import processing.video.*;
import processing.serial.*; 
 
Serial myPort;    // The serial port
PFont myFont;     // The display font
String inString;  // Input string from serial port
int lf = 10;      // ASCII linefeed 
int val;
 
Movie myMovie1;

boolean isplaying1 = false;

 
void setup() { 
  size(1000,800); 
  // You'll need to make this font with the Create Font Tool 
 
  // List all the available serial ports: 
  printArray(Serial.list()); 
  // I know that the first port in the serial list on my mac 
  // is always my  Keyspan adaptor, so I open Serial.list()[0]. 
  // Open whatever port is the one you're using. 
  myPort = new Serial(this, Serial.list()[1], 9600); 
  myPort.bufferUntil(lf); 
  
  myMovie1 = new Movie(this, "name_of_file.mp4");

  
} 
 
void draw() { 
 background(125); 
  
 println(val);
 //MOV 1=====================================
  if(val>200&&isplaying1==false){
       myMovie1.play();myMovie1.jump(0);
       isplaying1 = true;
      }
     
  if(isplaying1){
   play_movie_once(myMovie1,1,0,0);
   }
   
  
   
} //
 
void movieEvent(Movie m) {
  m.read();
}
 
void serialEvent(Serial p) { 
  inString = p.readString(); 
  val = int(trim((inString)));
} 

void play_movie_once(Movie this_movie, int which_button, int xx, int yy){
  float md = this_movie.duration();
  float mt = this_movie.time();
    if(int(mt)>=int(md)){print("vid off");
        if(which_button==1){isplaying1 = false;}
     }
    
    else if (mt<md){
    print("duration"+mt+"time"+md);
    //rect(random(100),random(100),random(width),random(height));
    image(this_movie, xx, yy);}
    }

To borrow the FSR square pads,here

To borrow the FSR round pads,here