如何使用arduino修复NTC 100K上的不正确读数?

时间:2019-05-27 14:02:36

标签: arduino temperature adc

我正在尝试使用ntc 100k传感器制作一个arduino温度读取器,并且im读取的值是-273.10度和1023。我不明白为什么它会超出极限。我使用的是100k电阻。 Vcc热敏电阻。 接地电阻。 A0到热敏电阻和电阻。

我尝试更改电阻器的值,​​但效果不佳。

int ThermistorPin = 0;
int Vo;
float R1 = 10000;
float logR2, R2, T, Tc, Tf;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

void setup() {
Serial.begin(9600);
}

void loop() {

  Vo = analogRead(ThermistorPin);
  R2 = R1 * (1023.0 / (float)Vo - 1.0);
  logR2 = log(R2);
  T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
  Tc = T - 273.15;
  Tf = (Tc * 9.0)/ 5.0 + 32.0; 

  Serial.print("Temperature: "); 
  Serial.print(Tf);
  Serial.print(" F; ");
  Serial.print(Tc);
  Serial.println(" C");   

  delay(3000);
}

1 个答案:

答案 0 :(得分:0)

如果没有将任何东西连接到模拟0引脚,结果如何?

也请尝试遵循this