【发布时间】:2015-02-24 05:44:33
【问题描述】:
场景:
我正在用 Arduino DUE 试验热电偶放大器 (SN-6675)。
在我包含 MAX6675 库后,Arduino 可以测量室温。
但是,从 arduino 测量的 Temp 有两个问题,
1) 偏移量与“Fluke 温度计”的比较
2)噪音大,每5个温度样本取平均值后一直波动。
例如,Fluke 温度计在室温下得到 28.9C,arduino 得到 19.75~45.75C
问题:有什么方法/过滤器可以降低测量噪声,并提供稳定的输出?
附上代码供参考。
#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);
}
【问题讨论】:
-
平均 5 次读数的变化幅度如此之大,您肯定遇到了电气问题。您可以解决的问题不多。检查热电偶是否连接不良或焊缝破损。更有可能是电源噪声。 5V 电源可能非常嘈杂。向 Vcc 添加一些过滤可能会有所改善。在 Arduino 堆栈交换上询问硬件相关问题。