Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsgpiozero has a ready-made TrafficLights class, which makes a nice first sequence program. Press the button and the lights change in the proper order with the right delays, then return to green. Great for a school model of a road.
Tick anything you already have and the total updates.
Red indicator LED for the alert state.; Yellow indicator LED.; Green indicator LED for the normal state.
Follow the colours: red is power, dark grey is ground, blue is a signal.
crossing.py# Pi traffic light with a pedestrian button
from gpiozero import TrafficLights, Button
from time import sleep
lights = TrafficLights(red=25, amber=8, green=7)
button = Button(2, pull_up=True)
lights.green.on()
while True:
button.wait_for_press()
sleep(2) # cars get a moment to notice
lights.green.off(); lights.amber.on(); sleep(2)
lights.amber.off(); lights.red.on()
sleep(8) # pedestrians cross
lights.red.blink(on_time=0.4, off_time=0.4, n=4, background=False)
lights.red.off(); lights.amber.on(); sleep(1.5)
lights.amber.off(); lights.green.on()
LED is reversed; flip it. Check the 220 Ω resistor is in series.
The button is rotated 90°; legs on the same side are already connected. Turn it.
7 parts: 3 × Through-Hole LED Pack (Pack of 10), Tactile Push Button Switch, Resistor Assortment Kit (30 Values), 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 3 steps.
No. This page has the complete, tested code (crossing.py). Install this library first: gpiozero (pre-installed).
About ₹3,921 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.
Current-limiting resistors for LEDs; Pull-ups and debouncing.
Ideas that reuse this build: Pico traffic light crossing and Pi Zero motion logger. 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.