-1

I have written code on the Arduino to record the pressure applied to a FSR sensor connected to pin A0. Here is my code

int pressureAnalogPin = 0; //pin where our pressure pad is located.
int pressureReading; //variable for storing our reading
bool active = false; //boolean to check whether arduino should be sending pressure values 

void setup() 
{ 
    Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() 
{
    if (Serial.available()) //checks if data is coming in
        { 
        char read = Serial.read(); //Set varaiable read to data read from mobile
        if (read == 'g') //if read is equal to character 'g' set boolean active to true 
        { 
            active = true;
        }
        if (read == 'x') //if read is equal to character 'x' set boolean active to false 
        { 
            active = false;
        }
    }
    if (active == true) //Only send data to phone when boolean active is set to true
    {   
        pressureReading = analogRead(pressureAnalogPin); // Set varaible pressureReading to the pressure value recorded by FSR 
        Serial.print(pressureReading); //Send pressure value to mobile phone
    }
    delay(100);// a delay of 100ms in loop
}

I receive results from 0 to 1023. I have conducted an experiment, by incrementing weights on top of the pressure sensor.

Excel Experiment Results

Above is an excel chart showing the increase in weight and the pressure recorded.

Can someone let me know what is the unit is for these pressure readings?

  • Right now you don't have pressure units. You just have a unitless quantity between 0 and 1023 that represents a voltage between 0 and 5V. You'll have to look at the datasheet for the sensor and find out how to convert from voltage to some more usable unit. Or do some sort of calibration by measuring some known force values and calculating the calibration curve yourself. – Delta_G Apr 29 '20 at 22:08
  • To convert analog readings to a voltage use (analogReading * 5.0 / 1024.0) Assuming you have a 5V reference. If you're using some other reference voltage substitute it for the 5.0 – Delta_G Apr 29 '20 at 22:11
  • No one knows because only you have the manufacturer's datasheet on this sensor. You DO have it, right? – TomServo Apr 29 '20 at 22:22
  • I’m voting to close this question because it isn't about programming it's about the performance characteristics of the electronic sensor the OP is using. – TomServo Apr 29 '20 at 22:24
  • Thank you @Delta_G - That makes a lot of sense! I don't have the manufacturer data sheet of the sensor, this is the sensor i purchased https://coolcomponents.co.uk/products/force-sensitive-resistor-0-5-inch? – George Quine Apr 29 '20 at 22:27
  • Is it possible to work out the pressure without? – George Quine Apr 29 '20 at 22:28
  • You can take some readings at known values and build a calibration curve. The response is linear I think. You could get the manufacturer's part number and search google for the datasheet. Personally, I would never ever buy any product unless I can see the datasheet first. How do you know it will even work for what you want or how to use it? That's a total shot in the dark gamble. – Delta_G Apr 29 '20 at 23:08
  • "To convert analog readings to a voltage use (analogReading * 5.0 / 1024.0)" Should this be 1023 or 1024? – George Quine May 02 '20 at 18:49

1 Answers1

0

As you gave already measured and calibrated the sensor with weights 50 - 800 gram according to your Excel, you have the option to use two methods (provided you use the same setup as in your calibration.

Oprion one programatically with map

map(value, fromLow, fromHigh, toLow, toHigh)

for each interval

map(measuredValue, 974, 978, 351, 400)

which in your case will produce very imprecise measurements as you have to have if and than map.

Or you calculate the whole range with EXCEL interpolate function than you get for every of the 1024 data points a gram value which you store in an array and retrieve with:

gramValue = interpolatedArray[measuredValue];

BUT for real use you will probably need an additional circuit, the manufacturers calibration data and a stable power supply. For playing around and learning this shoot and hope its a hit method is ok.

AND this is the sellers recommendation:

These sensors are simple to set up and great for sensing pressure, but they aren't incredibly accurate. Use them to sense if it's being squeezed, but you may not want to use it as a scale

Datasheet for the sensor including all the calibration circuits

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Codebreaker007
  • 2,911
  • 1
  • 10
  • 22