Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsA full-screen Python dashboard that shows a big clock, the date, CPU temperature and the Pi's IP address, plus a to-do list you tick off by tapping. Everything is plain Python and Tkinter, so it is easy to add weather, calendar or sensor panels.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
dashboard.py#!/usr/bin/env python3
"""Raspberry Pi touch dashboard: clock, date, CPU temperature, IP address and a to-do list.
Runs full-screen on the official 5-inch Touch Display 2. Tap a to-do item to tick it off."""
import socket
import subprocess
import time
import tkinter as tk
from pathlib import Path
TODO_FILE = Path.home() / "todo.txt" # one task per line
BG, FG, ACCENT = "#0d093d", "#ffffff", "#a9c5ea"
def cpu_temp():
try:
return int(Path("/sys/class/thermal/thermal_zone0/temp").read_text()) / 1000
except OSError:
return float("nan")
def ip_address():
try:
return subprocess.check_output(["hostname", "-I"], text=True).split()[0]
except (subprocess.SubprocessError, IndexError):
return socket.gethostname()
def load_todos():
if not TODO_FILE.exists():
TODO_FILE.write_text("Order more jumper wires\nCharge the 18650 cells\nFinish the weather station\n")
return [line for line in TODO_FILE.read_text().splitlines() if line.strip()]
class Dashboard(tk.Tk):
def __init__(self):
super().__init__()
self.configure(bg=BG)
self.attributes("-fullscreen", True)
self.bind("<Escape>", lambda e: self.destroy())
self.clock = tk.Label(self, font=("DejaVu Sans", 72, "bold"), fg=FG, bg=BG)
self.clock.pack(pady=(30, 0))
self.date = tk.Label(self, font=("DejaVu Sans", 22), fg=ACCENT, bg=BG)
self.date.pack()
self.info = tk.Label(self, font=("DejaVu Sans", 16), fg=FG, bg=BG)
self.info.pack(pady=10)
self.todo = tk.Frame(self, bg=BG)
self.todo.pack(fill="both", expand=True, padx=40, pady=10)
self.draw_todos()
self.tick()
def draw_todos(self):
for w in self.todo.winfo_children():
w.destroy()
for task in load_todos():
b = tk.Button(self.todo, text="\u25a1 " + task, anchor="w", font=("DejaVu Sans", 18), fg=FG, bg="#1c1866",
activebackground=ACCENT, relief="flat", command=lambda t=task: self.done(t))
b.pack(fill="x", pady=4, ipady=8)
def done(self, task):
TODO_FILE.write_text("\n".join(t for t in load_todos() if t != task) + "\n")
self.draw_todos()
def tick(self):
now = time.localtime()
self.clock.config(text=time.strftime("%H:%M", now))
self.date.config(text=time.strftime("%A %d %B", now))
self.info.config(text=f"CPU {cpu_temp():.0f} \u00b0C \u00b7 {ip_address()}")
self.after(1000, self.tick)
if __name__ == "__main__":
Dashboard().mainloop()
4 parts: Raspberry Pi 5 · 4GB RAM, Raspberry Pi 5-inch Touch Display 2 Capacitive, Official Raspberry Pi 4 USB-C Power Supply – 15.3W and Official Raspberry Pi 32GB A2 Class Micro SD Card. Tools: Precision Screwdriver Set. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2–3 hours. The build on this page has 5 steps.
No. This page has the complete, tested code (dashboard.py). Install this library first: python3-tk (pre-installed on Raspberry Pi OS).
About ₹21,086 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Raspberry Pi setup; Kiosk-mode web dashboards.
Ideas that reuse this build: Show your ESP32 sensor readings on it. They are listed under Take it further on this page.
Your first MicroPython project: temperature and humidity on an OLED.
A web page with ON and OFF buttons that switches a relay over Wi-Fi.
A warm ring light that fades up at dusk and down at dawn.
Logs every movement in a room with a timestamp, ready for a spreadsheet.
Learning project. Check every circuit and the datasheet of each part before you power it up.