树莓派温度测试
温度测试代码
vcgencmd measure_temp
格式改为.sh chmod+x 后便可以当作脚本运行查看实时温度
watch -n 0.5 ./xxx.sh
压力测试软件S-Tui + Stress
安装S-tui + Stress模块:
sudo pip install s-tui
sudo apt-get install stress
##打开s-tui模块
sudo s-tui
方向键或者鼠标操作
选定Stress开启压力测试模块
实验室环境压力测试4分钟温度由57°上升到84.2° 还没有开始降低频率
换上 [树莓派外壳](树莓派4代B外壳 4代B型Raspberry Pi 4B 铝合金外壳 带双风扇散热-淘宝网 (taobao.com)) 温度降低到39
开启压力测试8分钟温度稳定在59°左右
新增功能:每隔半个小时写入温度到txt文件中
#!/bin/bash
sum=0
temp_sum=0
while true
do
now_temp_s=$(vcgencmd measure_temp)
now_temp=${now_temp_s:5:-2}
temp_sum=$(echo $now_temp + $temp_sum | bc)
let "sum++"
if [ $sum == 100 ]
then
temp=$(echo $temp_sum / 100 | bc)
sum=0
temp_sum=0
time=$(date)
echo $time:temp=$temp
echo $time:temp=$temp >> /home/pi/Desktop/temp.txt
fi
sleep 18s
done