Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsA potentiometer gives a voltage from 0 to 3.3 V. The Pico turns that into a number between 0 and 255 and uses it to pick a colour from the colour wheel, then lights all sixteen LEDs in that colour. Keep BRIGHT low when running from USB.
Tick anything you already have and the total updates.
A 10 kΩ knob that works as a voltage divider, giving an analog value you can map to anything.
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 mood lamp: a knob picks the colour on an LED ring (MicroPython)
from machine import Pin, ADC
import neopixel, time
N = 16
ring = neopixel.NeoPixel(Pin(0), N)
knob = ADC(26) # potentiometer wiper on GP26
BRIGHT = 0.2
def wheel(pos):
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)
last = -1
while True:
pos = knob.read_u16() >> 8 # 0..255
if abs(pos - last) > 1:
r, g, b = wheel(pos)
colour = (int(r * BRIGHT), int(g * BRIGHT), int(b * BRIGHT))
for i in range(N):
ring[i] = colour
ring.write()
last = pos
time.sleep_ms(30)
The wiper is on an outer pin. Move the signal wire to the middle leg.
Add the 330 Ω resistor in series with DIN and share GND with the board.
6 parts: 16mm Rotary Potentiometer 10kΩ (Linear), WS2812 RGB LED Ring (16 LEDs), 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 3 steps.
No. This page has the complete, tested code (main.py).
About ₹562 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; Voltage dividers and analogRead().
Ideas that reuse this build: Colour-wheel lamp and Pico rainbow ring. 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.