Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsHeadless Pis are hard to find on a network. This OLED shows the IP address, the chip temperature and the CPU load, updated every five seconds. Stick the screen to the case and you always know the address to SSH to.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
sysmon.py# Pi system monitor on an OLED: IP address, CPU temperature and load
import time, socket, subprocess
from luma.core.interface.serial import i2c
from luma.oled.device import ssd1306
from luma.core.render import canvas
device = ssd1306(i2c(port=1, address=0x3C))
def ip_address():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]
except OSError:
return "no network"
finally:
s.close()
def cpu_temp():
out = subprocess.check_output(["vcgencmd", "measure_temp"]).decode()
return out.strip().replace("temp=", "")
def load():
with open("/proc/loadavg") as f:
return f.read().split()[0]
while True:
with canvas(device) as draw:
draw.text((0, 0), "IP " + ip_address(), fill="white")
draw.text((0, 20), "CPU " + cpu_temp(), fill="white")
draw.text((0, 40), "Load " + load(), fill="white")
time.sleep(5)
Check SDA/SCL and try address 0x3D. Run an I²C scanner to confirm.
5 parts: 0.96" OLED Display 128x64 (I2C), Raspberry Pi Zero 2 W, Raspberry Pi Micro USB 5.1V 2.5A Power Supply, Official Raspberry Pi 32GB A2 Class Micro SD Card and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter and Wire Stripper and Cutter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 1–2 hours. The build on this page has 4 steps.
No. This page has the complete, tested code (sysmon.py). Install this library first: luma.oled (pip install luma.oled).
About ₹4,003 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.
Drawing text on an I²C display.
Ideas that reuse this build: Pi touch dashboard and Pico room climate OLED. 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.
Turn a Pi and a touchscreen into a home command centre with a clock and to-do list.
Learning project. Check every circuit and the datasheet of each part before you power it up.