Raspberry Pi Thermometer

A Raspberry Pi 3 with all cores running at 100% gets very hot, an example is when SETI is running. With a good heatsink such as a FLIRC case the core temperature is kept about 15-20 degrees Centigrade above ambient. This is fine until the ambient temperature starts rising beyond 30 Degrees Centigrade which happened during a recent heatwave.

I looked at using some PC heatsink style 5V fans powered by the raspberry Pi psu but they were noisy and on all the time - very distracting! It crossed my mind to use a Pi Zero and a temperature sensor to switch the fans on and off when my room temperature raised above 25 Degress C. A little research led me to the ModMyPi website which shows a simple example using a DS18B20 sensor. I used this as my starting point. I built a prototype on breadboard and started to write the code to do the switching. This quickly expanded to include a simple bargraph display for room temperature, a flashing LED for confidence that the Pi is running, logs on/off events and a shutdown button.


I bought a couple of cheap desktop USB fans which turned out to be considerably quieter and more efficient than the PC versions. My 13 SETI Pi's/Odroids are now kept nice and cool - and only when needed....

So the final build includes:

  • A Pi Zero W (but will run on any Pi)
  • 13 LED's to displays room temperature between 9 and 33 Degrees Centigrade in 2 Degree steps. Blue - Cold, Green - Comfortable, Yellow - switch the fans on!, Red - too hot!!
  • When the temperature goes out of range, below 8 and above 34 Degrees C, the 9 or 33 Degree LED will flash and log the event.
  • Switches via a relay, two 5V USB ports for fans - 500mA each.
  • Switch ON/OFF temperature - 25 Degrees
  • Logs ON/OFF events in a text file.
  • Logs if temperature falls below Zero Degrees.
  • Option with window displaying the current temperature - useful for a quick via VNC. See picture below.
  • All powered from the Raspberry Pi supply.
  • Uses the Waterproof DS18B20 Digital Temperature Sensor.
  • Shutdown button.
  • All the resistors are mounted on a Breakout Pi Zero from AB Electronics UK.

Script and hardware design:

RPi Thermometer Script (just copy & past into IDLE).

RPi Thermometer Script with temperature window(just copy & past into IDLE).

RPi Thermometer Schematic.

Pi Pi Pi Pi Pi Pi