In this article we look at an FSR from Open Smart – here is the information I have found on this module
FSRs are basically a resistor that changes its resistive value (in ohms Ω) depending on how much it is pressed.
The FSR is made of 2 layers separated by a spacer. The more one presses, the more of those Active Element dots touch the semiconductor and that makes the resistance go down.
Suggest you to connect it series with a 1k ohm resistor, so that you can detect the voltage so that you can calculate its resistance.
Features:
– No load resistance: >1000kOhm
– Load resistance: <1kOhm @50N
– Working Voltage VCC: 5.5 VDC(MAX)
– Working Current: 5 mA(MAX)
– Pressure Scale: 0-50N
– Response time: < 10ms
– Recovery Time: < 40ms
– Sensing area diameter: 9mm
– Total length: 40mm
Connection
Arduino Uno | Open Smart FSR |
5v | Vcc |
Gnd | Gnd |
A0 | SIG |
Parts List
Here are the parts I used
Code
There are 2 code examples – I have republished them here
Example 1
[codesyntax lang=”cpp”]
#define FSR_PIN A0//SIG of FSR sensor module connect to A0 of Arduino #define DIVIDER_RES 10 //the resistance of the resistor connect with the FSR resistor in series. // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() { int sensorValue = analogRead(FSR_PIN); float val = sensorValue; float res = DIVIDER_RES*1023.00/val-DIVIDER_RES; //print out the value you read: Serial.println(sensorValue); Serial.print(res); Serial.println("KOhm"); judgeForce(res); delay(600); // delay in between reads for stability } void judgeForce(float res) { if(res > 1200) Serial.println("Nothing on the FSR"); else if(res > 300) Serial.println("Did you have breakfast? Your strength is too small."); else if(res > 50) Serial.println("Your strength can be bigger..."); else if(res > 15) Serial.println("Man, your strength is big!"); else Serial.println("You are most strong in the world!"); }
[/codesyntax]
Example 2
[codesyntax lang=”cpp”]
#define S0 3 //S0 of the LED Bar module connect to D3 of Arduino #define S1 4 #define S2 5 #define S3 6 #define S4 7 #define S5 8 #define S6 9 #define S7 10 const int leds[] = {S0, S1, S2, S3, S4, S5, S6, S7}; #define FSR_PIN A0 //SIG of FSR sensor module connect to A0 of Arduino #define MAX_SENSORVALUE 150 #define MAX_LIGHT_LEVEL 8 // the setup routine runs once when you press reset: void setup() { for(uint8_t i=0;i < 8; i++){ pinMode(leds[i], OUTPUT); } for(uint8_t i=0;i < 8; i++) { ledOff(i); } } // the loop routine runs over and over again forever: void loop() { int sensorValue = analogRead(FSR_PIN); //the greater the pressure in the sensing area, the higher the output voltage, //and larger the sensorValue. int level = map(sensorValue, 0, MAX_SENSORVALUE, 0, MAX_LIGHT_LEVEL); //convert the sensor value to the light level levelOn(level); } //------------------------------------ void ledOn(uint8_t Sx) { digitalWrite(leds[Sx], LOW); } void ledOff(uint8_t Sx) { digitalWrite(leds[Sx], HIGH); } void levelOn(uint8_t level) { if(level > 8) level = 8; for(uint8_t i = 0; i < level;i ++) { ledOn(i); } for(uint8_t i = level; i < 8;i ++) { ledOff(i); } } //-------------------------------------------
[/codesyntax]
Links