Mission 00 · 30 minutes
Meet the robot brain
Install the tools, wake the board, blink the light that is already on it
Goal: Get MicroPython onto your Raspberry Pi Pico W, talk to it from Thonny, print a greeting, and blink the small LED that is built into the board.
Understand
A Raspberry Pi Pico W is a tiny computer called a microcontroller. It has no screen, no keyboard and no hard drive. It has a processor, a little memory, and 40 metal pins that let it push and sense electricity. That is all a robot brain really needs.
An empty Pico W does not understand Python yet. First you load firmware: a single file that teaches the board the MicroPython language. Firmware is loaded once and stays there, even when you unplug the board.
To put firmware on, you hold the small BOOTSEL button while you plug in the USB cable. The board then pretends to be a USB memory stick named RPI-RP2. You drag the matching .uf2 firmware file onto that drive, the board swallows it, reboots, and disappears from your file manager. That disappearing act is the success signal.
After that, Thonny can connect to the board over the same USB cable. When Thonny shows >>> in the Shell panel, you are typing directly to the board. Type 1 + 1 and the board answers 2. The answer is being calculated by the chip in your hand, not by your laptop.
The Pico W has one LED soldered onto the board itself. On a Pico W you reach it with Pin("LED"). This is important: on the older plain Pico that LED is GP25, but on the W the wireless chip controls the LED, so Pin(25) does nothing useful. If you follow an older tutorial and nothing lights up, this is almost always why.
Every script in this course ends with a finally block. Code inside finally runs even if you stop the program with the red stop button or an error happens. We use it to switch the light off, so the hardware never gets left powered in an unknown state. Good engineers always clean up after themselves.
Keep your project files named like mission-00.py. If you save a file on the board as main.py, the board runs it automatically every time it powers up, which is confusing while you are still learning. We will avoid that on purpose.
Safety
- Use a USB cable that carries data, not a charge-only cable. A charge-only cable will power the board but Thonny will never see it.
- Hold the board by its edges. Dry hands, no metal on the table under the board.
- Nothing is wired in this mission, so there is nothing that can be wired backwards. Enjoy it while it lasts.
Parts
- 1 × Raspberry Pi Pico W board — From the Freenove Ultimate Starter Kit, or your own Pico W.
- 1 × USB data cable — Must carry data. Charge-only cables are the single most common cause of 'my board is invisible'.
- 1 × Computer with Thonny — Windows, macOS or Linux all work the same way for this course.
Electrical diagram
Mission 00 schematic: no external wiring
The only connection is the USB cable. The onboard LED is already wired inside the board, which is why there is nothing for you to build yet.
- This is a schematic, not a breadboard placement. It shows what connects to what, not where things physically sit.
Every wire is labeled. A filled dot marks a genuinely shared node; wires that cross without a dot are not connected.
Connections
| From | GPIO | Physical pin | To | Note |
|---|---|---|---|---|
| Computer USB port | - | Micro-USB socket on the board | Pico W | Power and the serial link that Thonny uses. Data cable required. |
| Onboard LED | Pin("LED") on Pico W | Not on the 40-pin header | Built into the board | On a Pico W this is controlled through the wireless chip, not GP25. |
Wiring steps
- Leave the breadboard in the box. This mission has no external wiring at all.
- Check your USB cable is a data cable. If the board shows up as a drive in step 4 below, it is a data cable.
Build steps
- Install Thonny from thonny.org and open it.
- Download the current MicroPython firmware for the Raspberry Pi Pico W from the official Raspberry Pi documentation. Choose the file that says Pico W, not plain Pico.
- Unplug the board. Find the small BOOTSEL button on top.
- Hold BOOTSEL down, plug the USB cable into your computer while still holding, then let go. A drive named RPI-RP2 should appear.
- Drag the .uf2 firmware file onto the RPI-RP2 drive. The drive disappears by itself after a few seconds. That means it worked.
- In Thonny, open the interpreter selector at the bottom right (or Tools > Options > Interpreter) and choose MicroPython (Raspberry Pi Pico). Pick the serial port your board is on.
- Look at the Shell panel. You want to see >>> waiting for you. Type 1 + 1 and press Enter to prove the board is answering.
- Create a new file, paste the mission script, and save it to the Raspberry Pi Pico as mission-00.py.
Run steps
- With mission-00.py open and saved on the board, press the green Run button in Thonny.
- Read the Shell. Your greeting line appears first.
- Watch the small LED on the board. It should turn on for half a second, off for half a second, over and over, and print a blink count each time.
- Press the red stop button. Because of the finally block, the LED switches off instead of being frozen on.
mission-00.py
# mission-00.py - Meet the robot brain
# Junior Engineer Lab, Mission 00
# Raspberry Pi Pico W + MicroPython, run from Thonny.
from machine import Pin
import time
print("Hello! Junior Engineer Lab is online.")
print("This message was printed by the Pico W, not by your computer.")
# On a Pico W the onboard LED is reached by name.
# It is NOT GP25. On the older plain Pico it is GP25, which is why
# old tutorials fail here.
led = Pin("LED", Pin.OUT)
BLINKS = 20
try:
for count in range(BLINKS):
led.on()
time.sleep(0.5)
led.off()
time.sleep(0.5)
print("blink", count + 1, "of", BLINKS)
finally:
# finally runs even if you press stop or an error happens.
led.off()
print("Finished. The LED has been switched off.")
The important lines
- from machine import Pin
- machine is the MicroPython module that talks to real hardware. Pin is the tool for controlling one pin.
- led = Pin("LED", Pin.OUT)
- Pico W only: the onboard LED has the name "LED". Pin.OUT means we want to push electricity out, not sense it.
- time.sleep(0.5)
- Wait half a second. Without a wait the blink would be far too fast for your eyes to see.
- try: ... finally: led.off()
- The finally block always runs, even when you stop the program early. It guarantees we leave the LED off.
Prediction
Question: You change both time.sleep(0.5) lines to time.sleep(0.05). What will the LED look like, and what will the Shell look like?
Expanded answer: The LED blinks ten times faster: 20 blinks finish in about 2 seconds instead of 20. At 0.05 s on and off your eye can still just about see the flicker, but it starts to look more like a shimmer than a blink. The Shell fills with blink lines very quickly, because the print happens once per loop no matter how fast the loop runs.
Extension challenge
Make the board blink a pattern that means something: your initials in Morse code, using 0.2 s for a dot and 0.6 s for a dash, with 0.2 s gaps inside a letter and 0.6 s between letters. Write the pattern down on paper first, then turn your paper plan into loops.
Troubleshooting
- No RPI-RP2 drive appears when I hold BOOTSEL and plug in.
- Almost always a charge-only USB cable, or BOOTSEL released too early. Try a different cable, and keep holding the button until after the plug is fully seated.
- Thonny shows no serial port for the board.
- Close any other program using the port, unplug and replug, then reselect the interpreter. On Linux your user may need to be in the dialout group.
- The Shell prints my greeting but the LED stays dark.
- You probably used Pin(25). On a Pico W you must use Pin("LED"). If you typed Pin("led") in lowercase it will also fail: the name is case sensitive.
- I get OSError or the board hangs when I press Run.
- Press the red stop button, then the Shell's restart. If that fails, unplug and replug the board and press Run again.
Real-hardware acceptance checklist
- ☐ The firmware drag-and-drop worked: the RPI-RP2 drive appeared and then disappeared on its own.
- ☐ Thonny's Shell shows the >>> prompt and answers when I type 1 + 1.
- ☐ My greeting lines printed in the Shell when I pressed Run.
- ☐ The real onboard LED on my board blinked about once per second.
- ☐ The LED was OFF after I pressed stop, not stuck on.
- ☐ My file is saved on the board as mission-00.py, not as main.py.
Notebook prompts
- Which firmware file did you download, and where did you get it from?
- What did the Shell print, word for word?
- What surprised you about the BOOTSEL trick?