Let it Glow: Learning the Raspberry Pi Pico One Advent Box at a Time
Most advent calendars have chocolate behind door number one. Mine has a microcontroller. I’m choosing to see this as personal growth rather than a cry for help.
The Pi Hut’s Let it Glow Maker Advent Calendar is twelve little boxes of LEDs, buttons, sensors and a display, built around a Raspberry Pi Pico H and MicroPython. It came out in 2023. I bought it, put it on a shelf, and it has sat there ever since, looking at me, the way unread books and gym memberships do. This year I need something to take my mind off the state of the world for an hour a day, and blinking lights seemed cheaper than therapy and more festive than doom-scrolling. So here we are.
I’m doing it with Claude Code beside me, and the code lives in abuxton/pihut-advent. Day 1 turned out to be less about the Pico and more about me learning how I actually want to learn, which is a lot of self-discovery to get out of a cardboard box.
What’s in the calendar
For anyone thinking of playing along at home, here’s the haul:
| Day | Topic | New parts |
|---|---|---|
| 1 | Let’s Get Started | Pico H, 2× half-size breadboard, micro-USB cable |
| 2 | Lighting LEDs | 15 mm red LED, 100 Ω resistor |
| 3 | Incredible Inputs | 2× tactile buttons |
| 4 | Brilliant Bar Graphs | 5-segment bar graph display |
| 5 | Switch the DIP | 5-way DIP switch |
| 6 | See the RGB | 2× addressable RGB LEDs |
| 7 | Time to Slide | Slide potentiometer |
| 8 | Rainbow Ring | 12-LED addressable RGB ring |
| 9 | Ice Cold Coding | DHT20 temperature and humidity sensor |
| 10 | ULTRA Blinky | Addressable LED string lights |
| 11 | Merry Membrane | 1×4 membrane keypad |
| 12 | Dazzling Displays | 16×2 I2C LCD |
Day 10 is called “ULTRA Blinky”, in capitals, and I’ve not been this excited about anything since they brought back proper Wotsits.
The Pi Hut’s daily guides are genuinely lovely: friendly, well illustrated and pitched at beginners, which is exactly my level. They use the Thonny editor. I’m following them from the terminal instead, partly out of habit and partly because I can’t leave well alone.
Box one: meet the Pico
First things first: the Pico isn’t a tiny Raspberry Pi in the “plug in a keyboard and browse the web” sense. It’s a microcontroller. There’s no operating system and no desktop, and it runs exactly one program at a time, which makes it more focused than I’ve ever been. Inside is an RP2040 chip with two cores, 264 KB of RAM, 2 MB of flash and 26 GPIO pins to wire things to. The “H” means the headers come pre-soldered, which is a mercy, because my soldering looks like a pigeon’s been at it.
Out of the box it doesn’t speak Python. Getting it there is lesson one:
- Hold the BOOTSEL button while you plug it in. The Pico turns up as a USB drive called
RPI-RP2. - Copy the MicroPython
.uf2firmware from micropython.org onto it. - The Pico reboots into MicroPython and comes back as a serial device instead.
That drive isn’t real storage. The chip’s bootloader invents it, and it only exists in BOOTSEL mode. The bootloader lives in ROM, so you can’t brick the board doing this, which is just as well given who’s holding it. I did spend a good minute afterwards hunting for /Volumes/RPI-RP2 and wondering where it had gone. It had gone because I’d flashed it. Well done, me.
To talk to the board from the terminal there’s mpremote, MicroPython’s own command-line tool, tucked away in a project virtualenv:
python3 -m venv .venv .venv/bin/pip install mpremote .venv/bin/mpremote run day01/01_hello.py # run a file from your machine on the Pico .venv/bin/mpremote # a live Python prompt on the board (Ctrl+X to leave) The Day 1 guide does Hello World, a bit of maths in the shell, and turning on the onboard LED on GPIO 25. We added a few extras to play with using nothing but the bare board:
- Board info: an RP2040 at 125 MHz, about 229 KB of free RAM and 1.4 MB of flash filesystem
- The chip’s own thermometer: ADC channel 4 and a formula from the datasheet. It said 21 °C, which is warmer than my office.
- PWM: making the LED “breathe” instead of blink, like a very small, very calm Christmas tree
- BOOTSEL as a button:
rp2.bootsel_button()gives you a free input once MicroPython is running
Here’s the breathing one:
from machine import Pin, PWM import time led = PWM(Pin(25)) led.freq(1000) while True: for duty in range(0, 65536, 512): led.duty_u16(duty) time.sleep_ms(5) for duty in range(65535, -1, -512): led.duty_u16(duty) time.sleep_ms(5) I’ve been writing code for a living for longer than I’ll admit in public, and a small green LED fading in and out because I told it to still made me grin like a kid on Christmas morning. Which, to be fair, is roughly the brief.
“Don’t do it for me”
Here’s the bit I didn’t expect to write about.
When I started, the Pico happened to be plugged in and sitting in BOOTSEL mode. Claude spotted the drive and, with the enthusiasm of a Labrador that’s found a tennis ball, downloaded the firmware, flashed the board, set up mpremote and ran the first few scripts. It all worked. It took about two minutes. And I’d learned precisely nowt.
That’s grand when you just want something done. It’s useless when the whole point is to learn. It’s like asking someone to teach you to cook and they bring you a takeaway. Lovely, but I still can’t make a curry.
So I asked for something different: don’t touch the board, give me a script I run myself, show me each command and the order things happen in, and let me either read the whole lot through or go one step at a time.
That’s a do-nothing script. I’ve banged on about them before as a tool for operators, and it turns out they’re just as good for teaching me about LEDs. Each day of the calendar now gets a dayNN/teach.sh, built on a small shared library, lib/do-nothing.sh. Every step is one of three kinds:
- explain: something to read
- manual: something you do with your actual hands, like “hold BOOTSEL and plug it in”
- command: a shell command, explained and shown before anything happens
$ ./day01/teach.sh --list Day 1 – Let's Get Started – execution order 1. [explain] What's in box #1 2. [manual] Seat the Pico in the breadboard 3. [command] Check you have Python 3 ... 7. [manual] Enter BOOTSEL mode 8. [command] See the Pico appear as a drive 9. [command] Download the MicroPython firmware 10. [command] Check the file really is a UF2 11. [command] Flash it! ... 22. [explain] Day 1 recap --dry-run prints the whole lesson, explanations and commands, and runs nothing at all, which is perfect for reading with a brew before going anywhere near the hardware. With no flags it walks you through one step at a time. At each command you press r to run it, m to type it yourself in another terminal (the grown-up option, if you want any of it to stick), s to skip, or q to quit. When you quit, it tells you the --from N to pick up where you left off, because I will absolutely get distracted by a mince pie halfway through. There’s a proper --help too, and it runs on the elderly bash 3.2 that macOS ships with, so there’s nothing extra to install.
The useful bit isn’t really the script, though. It’s that “help me learn this” and “just do it for me” are different requests, and it’s worth saying out loud which one you mean. Claude took it on the chin and changed tack straight away. From tomorrow, every day comes as code plus a lesson I drive myself, and the robot keeps its hands in its pockets.
Things that tripped me up
Some of these were the Pico. Most of them were me.
My own shell. mpremote fs ls fell over with fs: error: unrecognized arguments: --sd. I hadn’t typed --sd. I’d never typed --sd in my life. It turns out past me, in a fit of eye candy, made ls a global alias in zsh (alias -g ls='colorls -h --sd -1'). Global aliases expand anywhere on the line, not just at the start, so zsh helpfully turned my command into mpremote fs colorls -h --sd -1. Typing mpremote fs \ls gets round it. The proper fix is to make it a normal alias, which I suspect will also explain why docker image ls has been acting up. Past me has a lot to answer for. Happily, the lesson scripts run in bash, so they never noticed.
There’s no ps on a microcontroller. The Pico is either running your program or sitting at the >>> prompt waiting for you. That’s the lot. Plain mpremote connects without interrupting it, Ctrl+C stops it, Ctrl+D soft-resets it, and a main.py on the board runs at every boot until you mpremote fs rm :main.py it. Two catches: most other mpremote commands quietly send a Ctrl+C first, so running one stops your program, and machine.Timer callbacks keep going after Ctrl+C until you reset. A bit like me after a Christmas do.
Ejecting. diskutil eject /Volumes/RPI-RP2 works, but you rarely need it. Copy a .uf2 onto the drive and the Pico reboots itself, and macOS tuts that the disk wasn’t ejected properly. Ignore it. It’s fine. It’s always fine.
.gitignore templates. GitHub’s Python template ignores anything called lib/, which would have quietly left the whole lesson framework out of the repo. Nothing says “Merry Christmas” like a !lib/ line.
What’s next
Tomorrow’s box has a red LED and a resistor, so it’s real wiring on a breadboard, with the GP numbers on the pinout finally meaning something. I’ll add each day to pihut-advent as I go, and write up the days where something interesting happens, or where I set something on fire. Metaphorically. Hopefully.
If you’ve got a Pico in a drawer somewhere, and let’s be honest, a lot of us do, December’s a grand month to dig it out. Put the kettle on, plug it in, and make something glow.
References
- The Pi Hut: Let it Glow daily guides
- Day 1: Let’s Get Started
- abuxton/pihut-advent
- MicroPython for the Raspberry Pi Pico
- mpremote documentation
- Pico pinout
- Dan Slimmon: Do-nothing scripting, the key to gradual automation
- Building a DevOps / SRE Operator Toolkit with Do-Nothing Scripting
🤖 AI co-author: Claude Code