Calibrate RP-S40-ST

Good day,

How to get the force output (N or kg) from the RP-S40-ST hooked up to Arduino?

Methods I have tried but didn’t get the correct force reading on Arduino console:

  1. Use the equation from the pressure sensor data sheet:

    fsrForce = 271*pow(fsrResistance,-0.69)

image
[Data Sheet of RP-S40-ST Rev A (eleparts.co.kr)]
Ref:
(http://m.eleparts.co.kr/data/_gextends/good-pdf/201904/good-pdf-7495470-1.pdf)

  1. How to get the data from the graph on RP-S40-ST product page shown below?

Any help to calibrate or get close to accurate force reading from the RP-S40-ST pressure sensor would be appreciated, attached the code of my Arduino below. Hope it helps explain better

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 make "long"
unsigned long fsrConductance; 
float 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)
  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);
    
      fsrForce = 271*pow(fsrResistance,-0.69);
      Serial.print("Force in KG: ");
      Serial.println(fsrForce);      
     
  }
  Serial.println("--------------------");
  delay(1000);
}
1 Like

Hi Kai,

If you’re having trouble getting accurate readings, you could possibly consider building your own calibration from scratch. I’d suggest assembling a test jig (pretty much just some flat surfaces where you can stack known weights) and taking readings of your analog pin on your microcontroller (you shouldn’t need to bother with resistance, it’s just a middle man in your calculation), and plot your data in excel.

You can then hit the plus icon, and add a trendline, you can then format the trendline as a polynomial, and pick the lowest order that gets you close to your curve. You can tick the box that shows the equation, and there’s your maths to put in your code!

Here’s a more in-depth guide on this if you get stuck:

Let us know how you go!

1 Like