【问题标题】:Raspberry Pi MAX31856 Thermocouple Temperature Reading Error树莓派 MAX31856 热电偶温度读数错误
【发布时间】:2018-10-03 07:44:28
【问题描述】:

我正在使用 t 型热电偶,需要在 Raspberry Pi 3 上使用 python 读取温度数据。我使用 Adafruit MAX31856 将热电偶连接到 Pi,并尝试使用 this module 读取它。

我想长时间读取温度,所以我尝试在while loop 中打印出来但是,每当我运行我的代码时,我只会得到很少的“正确”读数,然后温度重置为 0,直到我再次重新运行代码 - 请参阅附图。

我不知道是什么原因造成的,我认为这不是连接问题,因为当我重新运行代码而不接触设置时,它会打印正确的温度。

有人知道为什么读数会重置为 0 吗?

这是我的代码:

from Adafruit_MAX31856 import MAX31856
import time

# Raspberry Pi software SPI configuration.
CLK = 4
CS  = 22
DO  = 17
DI  = 27
sensor = MAX31856(clk=CLK, cs=CS, do=DO, di=DI)

while True:
    temp = sensor.readTempC()
    print('Thermocouple Temperature: {0:0.3F}*C'.format(temp))
    time.sleep(1.0)

【问题讨论】:

  • 尝试通过将 sensor = MAX31856(clk=CLK, cs=CS, do=DO, di=DI) 放入 while 循环来重置传感器。
  • 成功了!虽然我不明白为什么。非常感谢。

标签: python raspberry-pi temperature


【解决方案1】:

尝试通过将 sensor = MAX31856(clk=CLK, cs=CS, do=DO, di=DI) 放入 while 循环来重置传感器。

【讨论】:

    猜你喜欢
    • 2017-09-23
    • 1970-01-01
    • 2022-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-16
    • 2021-01-27
    相关资源
    最近更新 更多