Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsClothes, grain and papers left outside are ruined by a sudden shower. The raindrop board is read by the Pico's analog input; the first wet reading gives a burst of beeps and a flashing LED, and the alert only re-arms after the board has dried.
Tick anything you already have and the total updates.
Comb-patterned plate whose resistance drops when water bridges the tracks.
Active buzzer with a built-in oscillator: apply power and it beeps at about 2.3 kHz.
Follow the colours: red is power, dark grey is ground, blue is a signal.
main.py# Pico rain alert: raindrop sensor and buzzer (MicroPython)
from machine import Pin, ADC
import time
rain = ADC(26)
buzzer = Pin(15, Pin.OUT)
led = Pin(14, Pin.OUT)
WET_BELOW = 30000 # the reading falls when the board gets wet (0 to 65535); adjust after testing
def beep(n):
for _ in range(n):
buzzer.value(1); led.value(1); time.sleep_ms(120)
buzzer.value(0); led.value(0); time.sleep_ms(120)
raining = False
while True:
value = rain.read_u16()
print(value)
if value < WET_BELOW and not raining:
raining = True
beep(5) # one burst when the rain starts
elif value > WET_BELOW + 4000:
raining = False
time.sleep_ms(500)
Dry the plate and clean off residue. Powering it only when reading slows corrosion.
Low-triggered module: invert the logic in setBuzzer().
LED is reversed; flip it. Check the 220 Ω resistor is in series.
7 parts: HS-S09-PB Rain Sensor Kit – Analog/Digital Output, Active Buzzer Module 3.3–5V, Through-Hole LED Pack (Pack of 10), Resistor Assortment Kit (30 Values), 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 4 steps.
No. This page has the complete, tested code (main.py).
About ₹760 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.
Active vs passive buzzers; Current-limiting resistors for LEDs; Resistive sensing and corrosion.
Ideas that reuse this build: Rain alert (Arduino) and Window rain reminder. 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.