Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Ingo Lohs
Published © LGPL

Force Sensing Resistor (FSR) - 10 cm long Tail and Ring

Interlink Electronics manufactures FSRs. Let's take a closer look at that.

IntermediateProtip30 minutes2,843

Things used in this project

Hardware components

Force Sensing Resistor - Ring - 40-24131
×1
Force Sensing Resistor - 10 cm Tail - 34-00034
×1
Force Sensing Resistor - Connector - 14-21542
×1
10 LEDs Bar Array, Green
10 LEDs Bar Array, Green
I my case I use Kingbright DC-10GWA (full green) and Kingbright DC-7G3HWA (3 colors) - as an alternative, you can also use individual LEDs.
×1
Jumper wires (generic)
Jumper wires (generic)
20 pcs for LED Bar Graph and 3 for Force Sensing Sensor
×1
Breadboard (generic)
Breadboard (generic)
×1
Arduino UNO
Arduino UNO
×1

Hand tools and fabrication machines

Soldering Station, 110 V
Soldering Station, 110 V
to solder the extended legs to the connector

Story

Read more

Schematics

Datasheet Force Sensing Resistor

Datasheet Force Sensing Resistor - Ring

Code

Analog Read Example code from Arduino IDE - LED Bar Graph triggered by FSR Ring

C/C++
const int analogPin = A0; // the pin that the potentiometer is attached to
const int ledCount = 10; // the number of LEDs in the bar graph
int ledPins[] = {2, 3, 4, 5, 6, 9, 10, 11, 12, 13}; // an array of pin numbers to which LEDs are attached


void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
     // loop over the pin array and set them all to output:
  for (int thisLed = 0; thisLed < ledCount; thisLed++) {
      pinMode(ledPins[thisLed], OUTPUT);
  }
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(analogPin);
  // print out the value you read:
  Serial.println(sensorValue);
   
  if (sensorValue <= 380) {
    digitalWrite(ledPins[0], HIGH);
    digitalWrite(ledPins[1], HIGH);
    digitalWrite(ledPins[2], HIGH);
    for (int thisLed = 3; thisLed < ledCount; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
    
  } else if (sensorValue > 380 && sensorValue <= 500) {
    digitalWrite(ledPins[3], HIGH);
    digitalWrite(ledPins[4], HIGH);
    digitalWrite(ledPins[5], HIGH);
    for (int thisLed = 6; thisLed < ledCount; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
    digitalWrite(ledPins[0], LOW);
    digitalWrite(ledPins[1], LOW);
    digitalWrite(ledPins[2], LOW);

  } else if (sensorValue > 500 && sensorValue <= 530 ) {
    digitalWrite(ledPins[9], HIGH);
    for (int thisLed = 0; thisLed < 9; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
      
  } else if (sensorValue > 530 && sensorValue <= 700) {
    digitalWrite(ledPins[6], HIGH);
    digitalWrite(ledPins[7], HIGH);
    digitalWrite(ledPins[8], HIGH);
    for (int thisLed = 0; thisLed < 6; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
    for (int thisLed = 9; thisLed < ledCount; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
  }
   
}

Analog Read Example code from Arduino IDE - LED Bar Graph triggered by FSR Tail 10cm

C/C++
const int analogPin = A0; // the pin that the potentiometer is attached to
const int ledCount = 10; // the number of LEDs in the bar graph
int ledPins[] = {2, 3, 4, 5, 6, 9, 10, 11, 12, 13}; // an array of pin numbers to which LEDs are attached

void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
     // loop over the pin array and set them all to output:
   for (int thisLed = 0; thisLed < ledCount; thisLed++) {
      pinMode(ledPins[thisLed], OUTPUT);
   }
}

void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(analogPin);
  // print out the value you read:
  Serial.println(sensorValue);
   
  if (sensorValue <= 75) {
    digitalWrite(ledPins[0], HIGH);
    digitalWrite(ledPins[1], HIGH);
    for (int thisLed = 2; thisLed < ledCount; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
    
  } else if (sensorValue > 75 && sensorValue <= 95) {
    digitalWrite(ledPins[2], HIGH);
    digitalWrite(ledPins[3], HIGH);
    for (int thisLed = 4; thisLed < ledCount; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
    digitalWrite(ledPins[0], LOW);
    digitalWrite(ledPins[1], LOW);
    
  } else if (sensorValue > 95 && sensorValue <= 135) {
    digitalWrite(ledPins[4], HIGH);
    digitalWrite(ledPins[5], HIGH);
    for (int thisLed = 0; thisLed < 4; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
    for (int thisLed = 6; thisLed < ledCount; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
    
  } else if (sensorValue > 135 && sensorValue <= 350) {
    digitalWrite(ledPins[6], HIGH);
    digitalWrite(ledPins[7], HIGH);
    for (int thisLed = 0; thisLed < 6; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
    
  } else if (sensorValue > 350 && sensorValue <= 500) {
    digitalWrite(ledPins[8], HIGH);
    digitalWrite(ledPins[9], HIGH);
    for (int thisLed = 0; thisLed < 8; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
  }
  
  } else if (sensorValue > 500 && sensorValue <= 1023) {
    for (int thisLed = 0; thisLed < ledCount; thisLed++) {
      digitalWrite(ledPins[thisLed], LOW);
    }
  }
  
}

Credits

Ingo Lohs
182 projects • 198 followers
I am well over 50 years and come from the middle of Germany.
Contact
Thanks to Jaynie Lajoy.

Comments

Please log in or sign up to comment.