Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 
OK, finally decided to have a play with a Raspberry Pi. Installed the full version of Raspbian as I wanted a desktop to work with.

One of the first things I noticed was a little thermometer sign came up in the right hand corner after a short while. A quick Google revealed this meant that the temperature had risen to a level where it may start to affect performance. Decided to buy a case with fan and some heatsinks (about £11 from Amazon). The question was how to monitor the temperature. Knowing nothing about Linux at all led to a lot of googling and I've managed to cobble together something that works.For anyone that knows how to code - be kind I don't, but this works and is literally just a few lines that are easy enough to follow. All info is pulled straight from other peoples work, please don't ask me to explain any of it!

Create a Python script to monitor the temperature of the Raspberry Pi

Open a terminal and type: sudo nano /home/pi/temp-mon.py

This will open an editor for you to paste the code below in.

import os
import time

def measure_temp():
               temp = os.popen("vcgencmd measure_temp").readline()
               return (temp.replace("temp=",""))

while True:
              print("\33[1m\33[31m") #Make text bold and red
              print("\33[1;1f") #Place cursor at row 1 column 1
              print"System Temperature"
              print(measure_temp())
              time.sleep(5)

Press CTRL O followed by ENTER to save your file. CTRL X will exit the editor and you're now ready to test. NOTE - the indents are necessary so if when you paste it's all in line a single tab at the start of each line will fix it.

In the terminal type python temp-mon.py and hit ENTER - you should now have a terminal that displays the temperature and refreshes every 5 seconds. You'll find that it overwrites anything already in row 1 column 1 of the terminal. Fear not, the next post is how to create a desktop shortcut to open it in it's own window.