2016. 2. 21. 19:23

참고 사이트 : https://www.raspberrypi.org/learning/temperature-log/worksheet/


향후에 온도나 습도의 기록을 남겨서 활용하기 위한 기초 학습 자료로 활용하기 위해서 샘플을 찾던중 찾은 자료이다.

현재의 온도를 파일로 생성한다. 

여기서 활용할 만한 것은 날짜포맷, 반복구문 정도이다



향후 온도와 습도를 외부 센서를 이용해서 이용할 계획이다.


#!/bin/bash

echo "Starting to record the temperature" 
timestamp=`date +%F_%H-%M-%S`
echo "Writing into /home/pi/logs/temperature_log_$timestamp.txt" 
echo "Temperature Log - $(date)" >/home/pi/logs/temperature_log_$timestamp.txt
for i in {1..30}
do
    temp=`/opt/vc/bin/vcgencmd measure_temp`
    temp=${temp:5:16}
    echo $temp >>/home/pi/logs/temperature_log_$timestamp.txt
    echo "Recorded temperature #$i:"
    tail -1 /home/pi/logs/temperature_log_$timestamp.txt
    sleep 10
done
echo "Finished recording the temperature, shutting down"
sudo shutdown -h now


Posted by mayoha
2014. 2. 12. 16:51

#!/bin/bash

cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)
cpuTemp1=$(($cpuTemp0/1000))
cpuTemp2=$(($cpuTemp0/100))
cpuTempM=$(($cpuTemp2 % $cpuTemp1))

echo CPU temp"="$cpuTemp1"."$cpuTempM"'C"
echo GPU $(/opt/vc/bin/vcgencmd measure_temp)


오버 클럭킹후에 온도가 얼마나 되나 확인하기 위해^^



방열판도 없는데

온도 높네;;



CPU temp=65.9'C

GPU temp=67.0'C





## 아래는 다양한 정보를 한번에 보고 싶어서 여기저기 스크립트 모은 것;;

echo.

echo RPI Info .....

echo.

echo Ver, $(/opt/vc/bin/vcgencmd version)


echo.

echo Config.

echo $(/opt/vc/bin/vcgencmd get_config int) | tr " " "\n"


cpuTemp0=$(cat /sys/class/thermal/thermal_zone0/temp)

cpuTemp1=$(($cpuTemp0/1000))

cpuTemp2=$(($cpuTemp0/100))

cpuTempM=$(($cpuTemp2 % $cpuTemp1))


echo.

echo Temp.

echo CPU temp"="$cpuTemp1"."$cpuTempM"'C"

echo GPU $(/opt/vc/bin/vcgencmd measure_temp)


echo.

echo Mem.

echo CPU mem $(/opt/vc/bin/vcgencmd get_mem arm)

echo GPU mem $(/opt/vc/bin/vcgencmd get_mem gpu)


echo.

echo Frequency.

for src in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi ; do.

    echo -e "$src:\t$(/opt/vc/bin/vcgencmd measure_clock $src)" ;.

done


echo.

echo Codec.

echo H264 codec $(/opt/vc/bin/vcgencmd codec_enabled H264)

echo MPG2 codec $(/opt/vc/bin/vcgencmd codec_enabled MPG2)

echo WVC1 codec $(/opt/vc/bin/vcgencmd codec_enabled WVC1)

echo MPG4 codec $(/opt/vc/bin/vcgencmd codec_enabled MPG4)

echo MJPG codec $(/opt/vc/bin/vcgencmd codec_enabled MJPG)

echo WMV9 codec $(/opt/vc/bin/vcgencmd codec_enabled WMV9)







Posted by mayoha