Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsThe RP2040 chip has a temperature sensor inside it. This program reads it every minute and appends a row to temps.csv in the Pico's flash memory, blinking the on-board LED each time. Leave it in a fridge door, a car or a classroom for a day, then copy the file off in Thonny and plot it. It measures the chip, so readings run a little above the air when the Pico is busy.
Tick anything you already have and the total updates.
main.py# Pico built-in temperature logger: saves a reading every minute to its own flash (MicroPython)
from machine import ADC, Pin
import time
sensor = ADC(4) # the RP2040's internal temperature sensor
led = Pin(25, Pin.OUT) # on-board LED (on the Pico W use Pin("LED"))
EVERY_S = 60
def read_c():
v = sum(sensor.read_u16() for _ in range(32)) / 32 * 3.3 / 65535
return 27 - (v - 0.706) / 0.001721 # formula from the RP2040 datasheet
with open("temps.csv", "a") as f:
f.write("minutes,temp_c\n")
start = time.time()
while True:
t = read_c()
with open("temps.csv", "a") as f:
f.write("{},{:.1f}\n".format((time.time() - start) // 60, t))
led.toggle()
print("{:.1f} C".format(t))
time.sleep(EVERY_S)
3 parts: Raspberry Pi Pico, Solderless Breadboard (830 points) 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 45 minutes. The build on this page has 5 steps.
No. This page has the complete, tested code (main.py).
About ₹466 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.
Ideas that reuse this build: Temperature data logger and Pico climate display. 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.