我使用FSR sesnor和Arduino收集的压力数据的度量单位是什么

问题描述 投票:-1回答:1

我已经在Arduino上编写了代码来记录施加到连接到引脚A0的FSR传感器的压力。这是我的代码

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
}

我收到从0到1023的结果。我通过增加压力传感器顶部的权重进行了一个实验。

Excel Experiment Results

以上是一张excel图表,显示了重量增加和所记录的压力。

有人可以让我知道这些压力读数的单位是什么吗?

arduino sensor units-of-measurement pressure
1个回答
0
投票

如您所提供的,已经根据您的Excel对重量为50-800克的传感器进行了测量和校准,您可以选择使用两种方法(前提是您使用与校准相同的设置。

以编程方式与地图一起竞猜一号

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

每个间隔

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

在您的情况下,这将产生非常不精确的测量值,因为您必须具有if和than映射。

或者您使用EXCEL插值函数计算整个范围,而不是获得1024个数据点中每一个的克值,该克值存储在数组中并使用以下方法检索:

gramValue = interpolatedArray[measuredValue];

但要真正使用,您可能需要一个附加电路,制造商校准数据和一个稳定的电源。对于玩耍和学习此拍摄,希望它是一种成功的方法。

这是卖家的推荐:

这些传感器易于设置,非常适合感测压力,但是它们并不十分准确。用它们来感知是否正在受到挤压,但您可能不想将其用作秤

Datasheet for the sensor including all the calibration circuits

© www.soinside.com 2019 - 2024. All rights reserved.