Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsMicroPython on the Pico has a built-in NeoPixel driver, so lighting addressable LEDs takes just a few lines. The colour-wheel function walks round red, green and blue, and each LED is offset a little from its neighbour, so the rainbow appears to rotate. The button steps through three speeds.
Tick anything you already have and the total updates.
Sixteen individually addressable RGB LEDs on one data wire.
Follow the colours: red is power, dark grey is ground, blue is a signal.
main.py# Pico rainbow LED ring with a speed button (MicroPython)
from machine import Pin
import neopixel, time
N = 16
ring = neopixel.NeoPixel(Pin(0), N)
button = Pin(16, Pin.IN, Pin.PULL_UP)
speeds = [40, 15, 5]
mode = 0
BRIGHT = 0.15 # keep it low: full white draws a lot of current
def wheel(pos):
# 0-255 around the colour wheel: red -> green -> blue -> red
if pos < 85:
return (255 - pos * 3, pos * 3, 0)
if pos < 170:
pos -= 85
return (0, 255 - pos * 3, pos * 3)
pos -= 170
return (pos * 3, 0, 255 - pos * 3)
offset = 0
while True:
if button.value() == 0:
mode = (mode + 1) % len(speeds)
while button.value() == 0:
time.sleep_ms(10)
for i in range(N):
r, g, b = wheel((i * 256 // N + offset) % 256)
ring[i] = (int(r * BRIGHT), int(g * BRIGHT), int(b * BRIGHT))
ring.write()
offset = (offset + 2) % 256
time.sleep_ms(speeds[mode])
Add the 330 Ω resistor in series with DIN and share GND with the board.
The button is rotated 90°; legs on the same side are already connected. Turn it.
6 parts: WS2812 RGB LED Ring (16 LEDs), Tactile Push Button Switch, 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 ₹555 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.
Addressable LEDs and colour mixing; Pull-ups and debouncing.
Ideas that reuse this build: Arduino festival lights and Colour-wheel lamp. 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.