CPU Temperature Monitor with OLED Display & Raspberry Pi Pico W
Display the real-time internal temperature of the Raspberry Pi Pico W on an SH1106 OLED using Arduino IDE.
Components and supplies
4
Jumper Wires
1
1,3" OLED Display SH1106 128x64 I2C
1
Medium breadboard
1
Raspberry Pi Pico W
Apps and platforms
1
Arduino IDE 2.0 (beta)
Project description
Code
CPU Temperature Monitor
cpp
Upload this code
1/* 2 * Project Name: CPU Temperature Monitor 3 * Designed For: Raspberry Pi Pico / Pico W 4 * 5 * 6 * License: GPL3+ 7 * This project is licensed under the GNU General Public License v3.0 or later. 8 * You are free to use, modify, and distribute this software under the terms 9 * of the GPL, as long as you preserve the original license and credit the original 10 * author. For more details, see <https://www.gnu.org/licenses/gpl-3.0.en.html>. 11 * 12 * Copyright (C) 2025 Ameya Angadi 13 * 14 * Code Created And Maintained By: Ameya Angadi 15 * Last Modified On: April 06, 2025 16 * Version: 1.0.0 17 * 18 */ 19 20 21#include <Wire.h> 22#include <Adafruit_GFX.h> 23#include <Adafruit_SH110X.h> 24 25/* 26 Configure the I2C address for the OLED screen. Uncomment only one option below. 27 If the screen does not display correctly, switch to the other address. 28 SH110X-based OLED displays commonly use I2C addresses 0x3C or 0x3D. 29*/ 30 31#define OLED_I2C_ADDRESS 0x3C // Set the I2C address to 0x3C for the OLED screen 32//#define OLED_I2C_ADDRESS 0x3D // Set the I2C address to 0x3D if 0x3C doesn't work 33 34#define DISPLAY_WIDTH 128 // Width of the OLED screen in pixels 35#define DISPLAY_HEIGHT 64 // Height of the OLED screen in pixels 36#define OLED_RESET -1 // Reset pin is not used (-1 indicates no reset pin) 37 38Adafruit_SH1106G display = Adafruit_SH1106G(DISPLAY_WIDTH, DISPLAY_HEIGHT, &Wire, OLED_RESET); 39float temp = 0; 40 41#define SPLASH_SCREEN_HEIGHT 64 42#define SPLASH_SCREEN_WIDTH 128 43static const unsigned char PROGMEM splash_screen_bmp[] = 44{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 45 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 46 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 47 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 48 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 49 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 50 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 51 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 52 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 53 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 54 0x80, 0x3f, 0xdf, 0xef, 0x1e, 0xfe, 0x7f, 0xbf, 0x81, 0xe1, 0xfe, 0xf7, 0xbf, 0x87, 0xf8, 0x01, 55 0x80, 0x26, 0x4c, 0x27, 0xbc, 0x63, 0x30, 0x98, 0xc1, 0xe1, 0x32, 0x63, 0x18, 0xc3, 0x08, 0x01, 56 0x80, 0x26, 0x4c, 0x26, 0xec, 0x63, 0x30, 0x98, 0xc1, 0x21, 0x32, 0x63, 0x18, 0xc3, 0x08, 0x01, 57 0x80, 0x26, 0x4c, 0x86, 0x4c, 0x63, 0x32, 0x18, 0xc3, 0x31, 0x32, 0x63, 0x18, 0xc3, 0x20, 0x01, 58 0x80, 0x06, 0x0f, 0x86, 0x0c, 0x63, 0x3e, 0x1f, 0x03, 0x30, 0x30, 0x63, 0x1f, 0x03, 0xe0, 0x01, 59 0x80, 0x06, 0x0c, 0x86, 0x0c, 0x7e, 0x32, 0x19, 0x83, 0xf0, 0x30, 0x63, 0x19, 0x83, 0x20, 0x01, 60 0x80, 0x06, 0x0c, 0x26, 0x0c, 0x60, 0x30, 0x98, 0xc6, 0x18, 0x30, 0x63, 0x18, 0xc3, 0x08, 0x01, 61 0x80, 0x06, 0x0c, 0x26, 0x0c, 0x60, 0x30, 0x98, 0xc6, 0x18, 0x30, 0x63, 0x18, 0xc3, 0x08, 0x01, 62 0x80, 0x1f, 0x9f, 0xef, 0xbe, 0xfc, 0x7f, 0xbe, 0x6f, 0x3c, 0xfc, 0x3e, 0x3e, 0x77, 0xf8, 0x01, 63 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 64 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 65 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 66 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 67 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 68 0x80, 0x00, 0x00, 0x78, 0xf1, 0xf0, 0xe7, 0x8f, 0xf3, 0xfc, 0x1f, 0x0f, 0xe0, 0x00, 0x00, 0x01, 69 0x80, 0x00, 0x00, 0x3d, 0xe3, 0x18, 0x63, 0x01, 0x82, 0x64, 0x31, 0x86, 0x30, 0x00, 0x00, 0x01, 70 0x80, 0x00, 0x00, 0x37, 0x66, 0x0c, 0x73, 0x01, 0x82, 0x64, 0x60, 0xc6, 0x30, 0x00, 0x00, 0x01, 71 0x80, 0x00, 0x00, 0x32, 0x66, 0x0c, 0x7b, 0x01, 0x82, 0x64, 0x60, 0xc6, 0x30, 0x00, 0x00, 0x01, 72 0x80, 0x00, 0x00, 0x30, 0x66, 0x0c, 0x6b, 0x01, 0x80, 0x60, 0x60, 0xc7, 0xc0, 0x00, 0x00, 0x01, 73 0x80, 0x00, 0x00, 0x30, 0x66, 0x0c, 0x6f, 0x01, 0x80, 0x60, 0x60, 0xc6, 0x60, 0x00, 0x00, 0x01, 74 0x80, 0x00, 0x00, 0x30, 0x66, 0x0c, 0x67, 0x01, 0x80, 0x60, 0x60, 0xc6, 0x30, 0x00, 0x00, 0x01, 75 0x80, 0x00, 0x00, 0x30, 0x63, 0x18, 0x63, 0x01, 0x80, 0x60, 0x31, 0x86, 0x30, 0x00, 0x00, 0x01, 76 0x80, 0x00, 0x00, 0x7d, 0xf1, 0xf0, 0xf3, 0x0f, 0xf1, 0xf8, 0x1f, 0x0f, 0x9c, 0x00, 0x00, 0x01, 77 0x80, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 78 0x80, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 79 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 80 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 81 0x80, 0x21, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 82 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 83 0x80, 0x21, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 84 0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 85 0x80, 0x2d, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 86 0x80, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 87 0x80, 0x2d, 0x7c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 88 0x80, 0x2d, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 89 0x80, 0x2d, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 90 0x80, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 91 0x80, 0x2d, 0x70, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 92 0x80, 0x2d, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 93 0x80, 0x2d, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 94 0x80, 0x4c, 0x80, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 95 0x80, 0x9e, 0x40, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 96 0x81, 0x3f, 0x20, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 97 0x81, 0x7f, 0xa0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 98 0x81, 0x7f, 0xa0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 99 0x81, 0x7f, 0xa0, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 100 0x81, 0x3f, 0x20, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 101 0x80, 0x9e, 0x40, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xed, 0x49, 102 0x80, 0x40, 0x80, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xa9, 0x55, 103 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xad, 0xdd, 104 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xa8, 0x55, 105 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xad, 0xd5, 106 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 107 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff 108}; 109 110void setup() { 111 delay(250); // wait for the OLED to power up 112 display.begin(OLED_I2C_ADDRESS, true); 113 display.clearDisplay(); 114 display.setTextColor(SH110X_WHITE); 115 display.drawBitmap(0, 0, splash_screen_bmp, 128, 64, 1); //Displays the Splash Screen 116 display.display(); 117 delay(3000); 118} 119 120void loop() { 121 temp = analogReadTemp(); 122 display.clearDisplay(); 123 display.drawRect(2, 2, 126, 62, SH110X_WHITE); 124 display.setTextSize(2); 125 display.setCursor(15, 15); 126 display.println("CPU Temp:"); 127 display.setTextSize(2); 128 display.setCursor(25, 35); 129 display.println(String(temp, 2)); 130 display.setCursor(90, 35); 131 display.print("C"); 132 display.display(); 133 delay(750); //Small delay between the readings 134}
Downloadable files
Connections
Follow these connections for connecting the OLED
OLED CPU Temperature Monitor.png

Comments
Only logged in users can leave comments