Arduino:如何消除热电偶放大器噪声

时间:2014-12-27 07:01:40

标签: filter arduino noise

情景:
我正在用Arduino DUE试验热电偶放大器(SN-6675)。 在我包含MAX6675库之后,Arduino可以测量室温。 但是,从arduino测量的温度有2个问题,

1)与“Fluke温度计”相比的偏移量 2)产生大量噪音,并在取5个温度样本的平均值后保持波动。

例如,Fluke温度计在室温下温度为28.9C,arduino温度为19.75~45.75C

问题:任何减少测量噪音的方法/过滤器,并提供稳定的输出?

enter image description here

附上代码以供参考。

#include <MAX6675.h>

//TCamp Int
int CS = 7;              // CS pin on MAX6675
int SO = 8;              // SO pin of MAX6675
int SCKpin = 6;             // SCK pin of MAX6675
int units = 1;            // Units to readout temp (0 = ˚F, 1 = ˚C)
float error = 0.0;        // Temperature compensation error
float tmp = 0.0;  // Temperature output variable

//checking
int no = 0;

MAX6675 temp0(CS,SO,SCKpin,units,error); // Initialize the MAX6675 Library for our chip

void setup() {
  Serial.begin(9600); // initialize serial communications at 9600 bps:
}

void loop() {

  no= no + 1;
  tmp = temp0.read_temp(5); // Read the temp 5 times and return the average value to the var

  Serial.print(tmp);
  Serial.print("\t");
  Serial.println(no);

  delay(1000);

}

2 个答案:

答案 0 :(得分:1)

  

任何降低测量噪声的方法/滤波器,并提供稳定的输出?

Kalman filter几乎是 标准方法:

  

卡尔曼滤波,也称为线性二次估计(LQE),是一种算法,它使用随时间观察的一系列测量,包含噪声(随机变化)和其他不准确性,并产生往往更多的未知变量的估计比仅基于单一测量的那些精确。

如果您的背景不是数学,请不要被您遇到的公式拖延。在像你这样的单变量情况下,过滤器非常容易实现,我相信谷歌搜索会找到一些实现。

过滤器将为您提供温度估计值以及温度方差的估计值(后者可让您了解过滤器对其当前估算值的信心程度)。 / p>

答案 1 :(得分:1)

您可能想要更简单的平均算法。这不像低通算法那么优雅,但可能适合您的情况。 这些算法在网上很多

您可以使用所采用的样本数量来平衡延迟和稳定性之间的折衷。您可能需要从10个样本开始并从那里开始工作。