Raspberry Pi CPU Temperature Indicator
Introduction: Raspberry Pi CPU Temperature Indicator
Previously I had introduced simple raspberry pi (Hereinafter as RPI) operational status indicator circuit.
This time, I’ll explain some more useful indicator circuit for RPI running as headless (without monitor) manner.
The circuit above shows CPU temperature into 4 different levels such as:
- Green LED turned on when CPU temperature is within 30~39 degree
- Yellow LED indicates temperature is increased in range of 40 to 45 degree
- 3rd Red LED shows CPU become a little bit hot by reaching 46 ~ 49 degree
- Another Red LED will blink when temperature is exceeding more than 50 degree
The above CPU temperature ranges are my personal design concept (Other temperature ranges can be configured by changing test conditions of python program which control this circuit).
By using this circuit, you are not necessarily executing “vcgencmd measure_temp” command frequently on console terminal.
This circuit shall inform current CPU temperature continuously and conveniently.
Step 1: Preparing Schematics
Although you can control 4 LEDs directly by utilizing only python codes, control logics of the program will load RPI and as a result, CPU temperature will be increased more because you should running a little bit complex python code continuously.
Therefore, I’m minimizing python code complexity as simple as possible and off-loading LED control logic to external hardware circuit.
The CPU temperature indicator (Hereinafter INICATOR) circuit consists with the following major parts.
- Two opto-couplers are connected to RPI GPIO pins to get temperature level data such as 00->LOW, 01->Medium, 10->High, 11->Need cooling.
- 74LS139 (or 74HC139, 2-to-4 decoder and de-multiplexer) control outputs (Y0, Y1, Y2, Y3) according to the inputs (A, B)
- When temperature is within 30 ~ 39 degree, python code output 00 to GPIO pins. Therefore, 74LS139 get input data 00 (A->0, B->0)
- As 00 is entered, Y0 output becomes LOW. (Please refer truth table of 74LS139)
- When Y0 output become LOW, it activating 2N3906 PNP transistor and as a result, Green LED is turned on
- Likewise, Y1 (01 -> CPU temperature medium) shall turn on Yellow LED and so on
- When Y3 becomes LOW, DB140 activating NE555 LED blinking circuit (this is common 555 IC based LED blinker) which is load of BD140 PNP transistor
The most important component of this circuit is 74LS139 which decoding 2 digits input into 4 different single output as shown in the truth table below.
-----------------------------------------------------------------------
Input | Output
-----------------------------------------------------------------------
G (Enable) | B | A | Y0 | Y1 | Y2 | Y3 |
-----------------------------------------------------------------------
H | X | X | H | H | H | H |
L | L | L | L | H | H | H |
L | L | H | H | L | H | H |
L | H | L | H | H | L | H |
L | H | H | H | H | H | L |
As 74LS139 output becomes LOW, PNP type transistor can make overall circuit simple as PNP transistor is turned on when base terminal becomes LOW. (I’ll show NPN version at the end of this story)
As 100K potentiometer is included to the NE555 LED blinker circuit, Red LED ON/OFF time can be adjusted freely according to the needs.
Step 2: Making PCB Drawing
As operating scheme of the INDICATOR is explained, let’s start to make the circuit.
Before soldering something on universal board, preparing the PCB drawing shown above is helpful to minimize any mistakes.
The drawing is made by using power-point to locate each part on the universal board and making wiring patterns among parts with wires.
As IC and transistor pin-out images are co-located along with PCB wiring pattern, soldering can be performed using this drawing.
Step 3: Soldering
Although original PCB drawing is made not using single wires to connect components on PCB, I’m soldering somewhat differently.
By using single conductor of wires (not tin wire), I’m trying to reduce universal PCB size which containing INDICATOR circuit.
But as you can see on the soldering side of PCB, I’m using tin wire also according to the patterns depicted in the PCB drawing.
When each component is connected according to the original design of PCB drawing, soldering completed PCB board including INDICATOR circuit will operate correctly.
Step 4: Testing Preparation
Before to RPI connection, the finished circuit requires testing. 152