FSR Sensor - Measuring 20-500 g for Swelling in a Knee Brace

Hi Everyone,

I am using an FSR to measure pressure (swelling) in a knee brace. I have set up the FSR like this below.

and here is my code:

const int flexiForcePin = A0; 
int flexiForceValue = 0; 
float weightLbs = 0.0; 
float weightKg = 0.0;
float forceNewtons = 0.0; 
float pressurePsi = 0.0; 

int filteredValue = 0; 
float alpha = 0.5; 

const float diameterMm = 9.00; 
const float diameterInches = diameterMm/25.4; 
const float radiusInches = diameterInches/2;
const float areaInSquareInches = 3.14159 * radiusInches * radiusInches; 

const float calibrationSlope = 0.13; 
const float calibrationIntercept = 0.0; 

int PreviousValue; 
unsigned long valueChangeTime; 


void setup() {
  // put your setup code here, to run once:
Serial.begin(9600); 
pinMode(flexiForcePin, INPUT); 
}

void loop() {
  // put your main code here, to run repeatedly:
flexiForceValue = analogRead(flexiForcePin); 
filteredValue = alpha * flexiForceValue + (1 - alpha) *filteredValue; 

if (filteredValue != PreviousValue){
  if (millis() - valueChangeTime >= 1000) {
    PreviousValue = filteredValue; 
    valueChangeTime = millis(); 
  }
}

if (filteredValue == PreviousValue){
  valueChangeTime = millis();
}

weightLbs = calibrationSlope * PreviousValue + calibrationIntercept; 
forceNewtons = weightLbs * 4.44822; 
weightKg = forceNewtons / 9.80665; 
pressurePsi = weightLbs / areaInSquareInches; 

Serial.print("Pressure Sensor 1:"); 
Serial.print(flexiForceValue); 
Serial.print("-> Force N: "); 
Serial.print(forceNewtons); 
Serial.print(" Weight: "); 
Serial.print(weightKg); 
Serial.print("kg, Pressure: "); 
Serial.print(pressurePsi); 
Serial.println("psi"); 

}

Here is the link for my specific FSR sensor (it can be used in medical applications):

FSR Sensor 0-10 kg

The trouble that I am having, is that this sensor is unable to measure 20-500 g properly, it can sense touch, but it stays at 0 kg even when a known weight 20-500g is applied. I am applying 20-500g to calibrate the sensor.

When the touch the sensor, it saturates to 2300 (b/c its an ESP32 Nano), or light touch around 200-700 (and shows like 130 kg weight when I press the sensor really hard). Does anyone have any suggestions on how to make this sensor more accurate to measure swelling or any techniques/codes that work better than this?

This is when 20-500g of weight is applied:

This is when the sensor is pressed down really hard:

Thank you so much,

Hamna

Did you read the discription of how that sensor works?
Resistance type thin film pressure sensor triggers when the default resistance is less than 200kΩ

You can't measure force with that sensor.
FYI: You can't measure force with any significant accuracy with any FSR. You can do is something like, light, medium heavy force.

As mentioned, Force Sensitive Resistors are not useful for measuring force.

I notice that even though the title of the ad is for a force sensor, all the description is about pressure. In order to convert pressure to force, you MUST KNOW the area with the pressure so you can divide and get the force. No where do they give the area of the sensor, so you cannot do the conversion of pressure to force.

Hmm, okay, I calculated the area as others have done in youtube videos. If this sensor isn’t ideal, do you have any suggestions on what would measure pressure (swelling in a brace) best?

Ohh, okay. I did see that the FSR example code only came with light, medium, and heavy force. Do you have any suggestions on how to use this qualitative (light, medium, heavy), to show swelling in a knee brace?

How much area are you wanting to measure?

If you could have an air volume that compressed as the swelling occurred you could use a pressure transducer to sense that.

0.006 m^2.

Oh okay. Do you think swelling in a knee in enough pressure for a pressure transducer to detect? Do you have any suggestions for specific models

That would depend on how much the knee "grew" when swelling but pressure transducers are available with very low ranges so maybe.

I'm not sure how you would differentiate between swelling and just flexing of the knee but it seems like that would be a problem regardless.

Do you know of any specific models that might work in this case?

No.
I don't see that it would be useful in your application

There seems to be a fundamental disconnect here. All your pressure sensors are recording at a single point, but you are wanting volume changes to be measured.

Sorry, I don’t understand. Do you mind explaining? The number I provided was for area of the surface of the sensor. That is where I want to measure swelling.

First you need to determine what volume change a swollen knee has and then you can approximate what the pressure change might be. Once you've done that, a sensor full scale can be selected and helpers will know what to suggest.

Online people have seemed to use an FSR to measure 2 kg weights accurately. Is there a way to fix my code or circuit such that I can do the same? With my code/circuit I am unable to accurately measure even 2 kg/3kg.

Is there a way I can do something with the FSR to get it to read an accurate reading? Right now, even if I use a 2kg weight, the sensor isn’t accurate. I would like to fix that first if possible.

Not that I can think of.

Is that point also the point on the brace that cannot move? If so, then you should be able to measure the pressure at that point, but that is for that point only, not for the knee swelling, which is all over the knee and cannot be uniform.