Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsThe Pico reads the sound module hundreds of times in 30 milliseconds and measures the swing between the highest and lowest reading, which is how loud the sound is. More swing lights more LEDs, green first, then amber, then red. The level drops slowly so you can see each peak, like the meters on a music system.
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 sound level meter on an LED ring (MicroPython)
from machine import Pin, ADC
import neopixel, time
N = 16
ring = neopixel.NeoPixel(Pin(0), N)
mic = ADC(26) # sound module analog output on GP26
QUIET = 300 # raise this if a few LEDs stay lit in a quiet room
level = 0.0
while True:
lo, hi = 65535, 0
t0 = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), t0) < 30: # peak-to-peak over 30 ms
v = mic.read_u16()
lo, hi = min(lo, v), max(hi, v)
swing = max(0, hi - lo - QUIET)
target = min(N, swing * N // 12000)
level = max(target, level - 0.5) # rise fast, fall slowly
for i in range(N):
if i < int(level):
ring[i] = (0, 20, 0) if i < 8 else (20, 14, 0) if i < 12 else (25, 0, 0)
else:
ring[i] = (0, 0, 0)
ring.write()
Turn the module trimmer to increase gain, or move the mic closer to the sound.
Add the 330 Ω resistor in series with DIN and share GND with the board.
6 parts: Analog Sound Sensor Microphone Module, 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 4 steps.
No. This page has the complete, tested code (main.py).
About ₹652 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; Sampling a waveform and measuring amplitude.
Ideas that reuse this build: Classroom noise meter 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.