【问题标题】:What is the unit of measure for the pressure data I collect using an FSR sesnor with an Arduino我使用带有 Arduino 的 FSR 传感器收集的压力数据的测量单位是什么
【发布时间】:2020-08-14 03:51:37
【问题描述】:

我在 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 图表,显示了重量的增加和记录的压力。

谁能告诉我这些压力读数的单位是什么?

【问题讨论】:

  • 现在你没有压力单位。你只有一个 0 到 1023 之间的无单位量,它代表 0 到 5V 之间的电压。您必须查看传感器的数据表,并了解如何将电压转换为更可用的单位。或者通过测量一些已知的力值并自己计算校准曲线来进行某种校准。
  • 将模拟读数转换为电压使用 (analogReading * 5.0 / 1024.0) 假设您有一个 5V 参考。如果您使用的是其他参考电压,请将其替换为 5.0
  • 没有人知道,因为只有您拥有该传感器的制造商数据表。你有,对吧?
  • 我投票结束这个问题,因为它不是关于编程,而是关于 OP 使用的电子传感器的性能特征。
  • 谢谢@Delta_G - 这很有意义!我没有传感器的制造商数据表,这是我购买的传感器coolcomponents.co.uk/products/force-sensitive-resistor-0-5-inch

标签: arduino sensors units-of-measurement pressure


【解决方案1】:

由于您已经根据 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

【讨论】:

    猜你喜欢
    • 2021-10-29
    • 2016-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多