6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Raspberry PiのCPU温度をvcgencmdで簡単に取ってみる

Posted at

Raspberry Pi 1 Model Bをradikoの録音に使用していますが、
頻繁に固まるためCPU温度と電圧を取ってみました。
(ポリスイッチ絡みだと予想はしているものの、他の要素を排除したかったのもあり)

下記で計測できます。

$ cat /sys/class/thermal/thermal_zone0/temp
40084

しかし1/1000する必要があるようです。

でもこちらでもCPU温度を取れます。

$ vcgencmd measure_temp
temp=39.0'C

ちなみに、電圧とかもとれます。

$ vcgencmd measure_volts
volt=1.20V

こんな感じで、ためしにログを取ってみましょう

# !/bin/bash

file=cpu_volts_log.csv
temp=`vcgencmd measure_temp 2>&1`
volts=`vcgencmd measure_volts 2>&1`

if [ -e ${file} ]; then
  echo ${temp}","${volts} >> ${file}
else
  echo ${temp}","${volts} > ${file}
fi

今回はcsvにしましたが、出力されたファイルを加工するなりするとよろしいかと。

cronでこのログを取るファイルを実行し、出力されたファイルをdropboxにアップロードするスクリプトを書いて運用してみようと思います。

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?