BakedPi - See how hot your Raspberry Pi is with LedBorg

This is an old driver based LedBorg script
The new driver free example which replaces this one can be found here.

We want to know how hot our Raspberry Pis are getting when they do their thing, and what better way then with LEDs?

We decided to use an LedBorg to show how hot the processor is by the following guide:
Colour displayed is the range from a minimum temperature (0%, Blue) to a maximum temperature (100%, Red).
0% is used when below range, 100% is used when above range

<=11% <=22% <=33% <=44% <56% <67% <78% <89% >=89%

The result was, a Python script which reads the current processor temperature and controls an LedBorg appropriately.

Our example uses values of tempLow (0%) and tempHigh (100%) which work well when watching the Raspberry Pi warm up from boot, you will probably want to change these to show a better temperature range!

Here's the code, you can download the BakedPi script file as text here
Save the text file on your pi as
Make the script executable using
chmod +x
and run using
sudo ./

#!/usr/bin/env python
# coding: latin-1

# Import libary functions we need
import time

# Make a function to set the LedBorg colour
def SetColour(colour):

# Set up our temperature chart, from cool to hot
colours = ['002', '012', '022', '021', '020', '120', '220', '210', '200']

# Setup for processor monitor
pathSensor = '/sys/class/thermal/thermal_zone0/temp'    # File path used to read the temperature
readingPrintMultiplier = 0.001                          # Value to multiply the reading by for user display
tempHigh = 40000                                        # Highest scale reading
tempLow = 30000                                         # Lowest scale reading
interval = 1                                            # Time between readings in seconds

    # Make sure we are using floats
    tempHigh = float(tempHigh)
    tempLow = float(tempLow)
    while True:
        # Read the temperature in from the file system
        fSensor = open(pathSensor, 'r')
        reading = float(
        # Pick the relevant colour
        position = (reading - tempLow) / (tempHigh - tempLow)
        position = int(position * len(colours))
        if position < 0:
            position = 0
        elif position >= len(colours):
            position = len(colours) - 1
        # Set the relevant colour
        # Print the latest reading
        print '%02.3f' % (reading * readingPrintMultiplier)
        # Wait a while
except KeyboardInterrupt:
    # CTRL+C exit, turn off the LedBorg
    print 'Terminated'
Subscribe to Comments for &quot;BakedPi - See how hot your Raspberry Pi is with LedBorg&quot;