CPU Temperature Monitor With OLED Display & Raspberry Pi Pico W

by Ameya Angadi in Circuits > Raspberry Pi

138 Views, 1 Favorites, 0 Comments

CPU Temperature Monitor With OLED Display & Raspberry Pi Pico W

CPU Temperature Pi Pico W Thumbnail (Instructables).png

In this project, we’ll use the onboard temperature sensor of the Raspberry Pi Pico W and display the live CPU temperature on a 1.3” SH1106 OLED screen via I2C. This is a simple yet practical introduction to sensor readings, I2C display interfacing, and Arduino programming on the Pi Pico W.

Supplies

  1. Raspberry Pi Pico / Pico W x 1
  2. Medium breadboard x 1
  3. 1.3" OLED Display (SH1106 128x64 I2C) x 1
  4. Jumper Wires x 4

Make All the Connections

daba5b2d-712c-4600-b38f-45af80a698fe.png

Follow this circuit diagram to make all the connections.


Raspberry Pi Pico W To OLED:

Pin 38 - GND

Pin 36 - VCC

Pin 6 - SDA

Pin 7 - SCL


The internal temperature sensor is used in this project, so need to make any connections for that.

Install Required Libraries in Arduino IDE

In Arduino IDE, go to Sketch > Include Library > Manage Libraries, and install:

  1. Adafruit_GFX
  2. Adafruit_SH110X


New to uploading code to the Pico W?

Check out my previous beginner-friendly guide to know more about programming Pi Pico with Arduino IDE: Link

Select Board & Port

Go to Tools > Board > Raspberry Pi RP2040 Boards > Raspberry Pi Pico W

Select the correct COM port.

Upload the Code

Upload the code attached below to read the internal temperature and display it on the OLED.


Code -

/*
* Project Name: CPU Temperature Monitor
* Designed For: Raspberry Pi Pico / Pico W
*
*
* License: GPL3+
* This project is licensed under the GNU General Public License v3.0 or later.
* You are free to use, modify, and distribute this software under the terms
* of the GPL, as long as you preserve the original license and credit the original
* author. For more details, see <https://www.gnu.org/licenses/gpl-3.0.en.html>.
*
* Copyright (C) 2025 Ameya Angadi
*
* Code Created And Maintained By: Ameya Angadi
* Last Modified On: April 06, 2025
* Version: 1.0.0
*
*/


#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>

/*
Configure the I2C address for the OLED screen. Uncomment only one option below.
If the screen does not display correctly, switch to the other address.
SH110X-based OLED displays commonly use I2C addresses 0x3C or 0x3D.
*/

#define OLED_I2C_ADDRESS 0x3C // Set the I2C address to 0x3C for the OLED screen
//#define OLED_I2C_ADDRESS 0x3D // Set the I2C address to 0x3D if 0x3C doesn't work

#define DISPLAY_WIDTH 128 // Width of the OLED screen in pixels
#define DISPLAY_HEIGHT 64 // Height of the OLED screen in pixels
#define OLED_RESET -1 // Reset pin is not used (-1 indicates no reset pin)

Adafruit_SH1106G display = Adafruit_SH1106G(DISPLAY_WIDTH, DISPLAY_HEIGHT, &Wire, OLED_RESET);
float temp = 0;

#define SPLASH_SCREEN_HEIGHT 64
#define SPLASH_SCREEN_WIDTH 128
static const unsigned char PROGMEM splash_screen_bmp[] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x3f, 0xdf, 0xef, 0x1e, 0xfe, 0x7f, 0xbf, 0x81, 0xe1, 0xfe, 0xf7, 0xbf, 0x87, 0xf8, 0x01,
0x80, 0x26, 0x4c, 0x27, 0xbc, 0x63, 0x30, 0x98, 0xc1, 0xe1, 0x32, 0x63, 0x18, 0xc3, 0x08, 0x01,
0x80, 0x26, 0x4c, 0x26, 0xec, 0x63, 0x30, 0x98, 0xc1, 0x21, 0x32, 0x63, 0x18, 0xc3, 0x08, 0x01,
0x80, 0x26, 0x4c, 0x86, 0x4c, 0x63, 0x32, 0x18, 0xc3, 0x31, 0x32, 0x63, 0x18, 0xc3, 0x20, 0x01,
0x80, 0x06, 0x0f, 0x86, 0x0c, 0x63, 0x3e, 0x1f, 0x03, 0x30, 0x30, 0x63, 0x1f, 0x03, 0xe0, 0x01,
0x80, 0x06, 0x0c, 0x86, 0x0c, 0x7e, 0x32, 0x19, 0x83, 0xf0, 0x30, 0x63, 0x19, 0x83, 0x20, 0x01,
0x80, 0x06, 0x0c, 0x26, 0x0c, 0x60, 0x30, 0x98, 0xc6, 0x18, 0x30, 0x63, 0x18, 0xc3, 0x08, 0x01,
0x80, 0x06, 0x0c, 0x26, 0x0c, 0x60, 0x30, 0x98, 0xc6, 0x18, 0x30, 0x63, 0x18, 0xc3, 0x08, 0x01,
0x80, 0x1f, 0x9f, 0xef, 0xbe, 0xfc, 0x7f, 0xbe, 0x6f, 0x3c, 0xfc, 0x3e, 0x3e, 0x77, 0xf8, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x78, 0xf1, 0xf0, 0xe7, 0x8f, 0xf3, 0xfc, 0x1f, 0x0f, 0xe0, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x3d, 0xe3, 0x18, 0x63, 0x01, 0x82, 0x64, 0x31, 0x86, 0x30, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x37, 0x66, 0x0c, 0x73, 0x01, 0x82, 0x64, 0x60, 0xc6, 0x30, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x32, 0x66, 0x0c, 0x7b, 0x01, 0x82, 0x64, 0x60, 0xc6, 0x30, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x30, 0x66, 0x0c, 0x6b, 0x01, 0x80, 0x60, 0x60, 0xc7, 0xc0, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x30, 0x66, 0x0c, 0x6f, 0x01, 0x80, 0x60, 0x60, 0xc6, 0x60, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x30, 0x66, 0x0c, 0x67, 0x01, 0x80, 0x60, 0x60, 0xc6, 0x30, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x30, 0x63, 0x18, 0x63, 0x01, 0x80, 0x60, 0x31, 0x86, 0x30, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x7d, 0xf1, 0xf0, 0xf3, 0x0f, 0xf1, 0xf8, 0x1f, 0x0f, 0x9c, 0x00, 0x00, 0x01,
0x80, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x21, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x21, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x7c, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x70, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x2d, 0x00, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x4c, 0x80, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x9e, 0x40, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x81, 0x3f, 0x20, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x81, 0x7f, 0xa0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x81, 0x7f, 0xa0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x81, 0x7f, 0xa0, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x81, 0x3f, 0x20, 0x0c, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x80, 0x9e, 0x40, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xed, 0x49,
0x80, 0x40, 0x80, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xa9, 0x55,
0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0xad, 0xdd,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xa8, 0x55,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0xad, 0xd5,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};

void setup() {
delay(250); // wait for the OLED to power up
display.begin(OLED_I2C_ADDRESS, true);
display.clearDisplay();
display.setTextColor(SH110X_WHITE);
display.drawBitmap(0, 0, splash_screen_bmp, 128, 64, 1); //Displays the Splash Screen
display.display();
delay(3000);
}

void loop() {
temp = analogReadTemp();
display.clearDisplay();
display.drawRect(2, 2, 126, 62, SH110X_WHITE);
display.setTextSize(2);
display.setCursor(15, 15);
display.println("CPU Temp:");
display.setTextSize(2);
display.setCursor(25, 35);
display.println(String(temp, 2));
display.setCursor(90, 35);
display.print("C");
display.display();
delay(750); //Small delay between the readings
}

Final Output Images

CPU Temperature Pi Pico W (1).jpg
CPU Temperature Pi Pico W (2).jpg
CPU Temperature Pi Pico W (3).jpg

You now have a real-time CPU temperature monitor displayed on a slick OLED screen, powered by the Raspberry Pi Pico W and programmed entirely in C++ using the Arduino IDE.

Watch the Video

Build a CPU Temperature Monitor with Raspberry Pi Pico/Pico W &amp; SH1106 OLED

Watch the final output of the CPU Temperature Monitor in the above short demo video.


If you want to explore more, check out my profile for related projects, and don’t forget to follow me for updates on new tutorials and advanced projects!