How to calibrate resistance sensor/band

Hi,
I am working on a project that involves two small pumps turning on when a person breathes in. The person will be wearing a strap around their chest with a resistance cord in it. What I am trying to do is calibrate the resistance of the cord so that when an individual puts it on, the arduino will calibrate and therefore be able to tell which resistance to count as a breath in, which will then turn on my pumps. I am wondering if anyone has advice/experience coding such a thing? I have the code currently set so that I have to manually set the threshold to register as a breath in. I have attached part of my code if needed.

`````` RespSignal = getResp(respPin); // Get resistor value
RespSignalAvg = resp_smooth.smooth(RespSignal); // Low pass filter output
//Serial.println(RespSignalAvg);

// ### Use Sensor Data ###
if (RespSignalAvg >= RespThreshold) PressureSetpoint = 50;
else PressureSetpoint = 0;
pwmVal_255 = pid2.getCmd(PressureSetpoint, Pressure); // Update PID output

if (pwmVal_255 > 0) pwmWrite(AIN1, AIN2, PWMA, pwmVal_255, 1);           // Check direction, and write pwm
else if(pwmVal_255 <0 ) pwmWrite(AIN1, AIN2, PWMA, 0, -1);   // Check direction, adjust speed and write pwm
``````

Thank you!

I would have a separate section of code to measure the resistance when the subject is not breathing in. You could have a button for the subject to press, which would call that procedure.

If the sensor resistance increases when breathing in, another approach would be to calculate the minimum/maximum values for the first few breaths, and set the threshold to the minimum.

Using multimap library is so much efficent in this situation.
Watch to understand it - YouTube
If you don't get it look for map function firstly.