3D打印 / Armbian / Linux · 2022年5月17日

s905盒子linux/armbian系统klipper上位机获取cpu温度方法

机顶盒是外贸机顶盒,配置S905X 2+16G 安装了klipper 把盒子的CPU温度显示在网页上。

代码:

#####################################################################
#                             温度监控
#####################################################################

[temperature_sensor S905_host]                # 树莓派温度
sensor_type: temperature_host
sensor_path: /sys/class/hwmon/hwmon0/temp1_input #本机的CPU温度获取地址
min_temp: 10
max_temp: 100
#--------------------------------------------------------------------
[temperature_sensor mcu_temp]                    # 主板温度
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100

官网文档位置:https://www.klipper3d.org/Config_Reference.html?h=temper#temperature_sensor

参考来源:https://forum.armbian.com/topic/6688-temps/

其他机器或系统可能有用的获取CPU温度的方法:

“/sys/devices/virtual/thermal”或者“/sys/class/thermal”下,命名为“thermal_zoneX”

X表示cpu核温度检测节点,如果是多核cpu通常会有多个温度检测节点;使用其中一个即可

rk3399 ubuntu16 下cup核温度节点

# ls /sys/devices/virtual/thermal/
cooling_device0  cooling_device1  cooling_device2  thermal_zone0  thermal_zone1
# ls /sys/class/thermal/
cooling_device0  cooling_device1  cooling_device2  thermal_zone0  thermal_zone1

用cat命令查看一下

# cat /sys/class/thermal/thermal_zone0/temp
51200
# cat /sys/class/thermal/thermal_zone1/temp
51102

thermal_zone0”当前温度为51.200℃

使用sensors工具查看cpu温度

centos

yum install lm_sensors #安装软件命令

sensors-detect #执行命令进行配置 一路yes

sensors  #查看cpu的温度

debian

apt-get install lm-sensors

sensors-detect

service kmod start

sensors