MicroPython turns a Raspberry Pi Pico into a board you program interactively: flash one firmware file, open Thonny, and type Python straight into the board. No compiler, no toolchain, and a change takes seconds to try.
The one thing to get right is the firmware. The four Pico boards use two different chips, and the wireless models need their own builds:
| Board | Chip | Wireless | Firmware to download | Bootloader drive name |
|---|---|---|---|---|
| Pico | RP2040 | No | RPI_PICO | RPI-RP2 |
| Pico W / WH | RP2040 | Wi-Fi 4 + Bluetooth (CYW43439) | RPI_PICO_W | RPI-RP2 |
| Pico 2 | RP2350 | No | RPI_PICO2 | RP2350 |
| Pico 2 W | RP2350 | Wi-Fi 4 + Bluetooth (CYW43439) | RPI_PICO2_W | RP2350 |
Flash a non-W build onto a W board and everything works except Wi-Fi and the onboard LED, which is the most common reason a Pico W tutorial "doesn't work". Flash an RP2040 build onto a Pico 2 (or the reverse) and the board won't boot it at all.
1. What You Need
- The board, identified by the text printed on it. A W board has a silver metal shield over the wireless chip at the end opposite the USB socket, next to its small antenna; a plain Pico doesn't.
- A micro-USB data cable. Charge-only cables are the number-one cause of "nothing happens". If the board doesn't appear in BOOTSEL mode, try another cable before anything else.
- Thonny, the free beginner IDE that knows how to talk to MicroPython boards. Any recent 4.x release works.
Disconnect anything wired to the board for the first install. If you already have scripts on the board, copy them to your computer first: reflashing normally keeps the filesystem, but a recovery wipe (section 8) erases it.
2. Download the Right Firmware
Go to micropython.org/download and open the page for your board from the table above, for example RPI_PICO_W for a Pico W. Under Releases, download the newest stable .uf2 file. Its name follows the pattern RPI_PICO_W-<date>-v1.xx.x.uf2, so you can always tell later which board and version it was for. Keep the file; it's your recovery image.
Avoid the preview builds unless a tutorial specifically needs a feature that isn't in a stable release yet. The Pico 2 page also lists a RISC-V build of the firmware; it runs the RP2350's RISC-V cores instead of its Arm cores, and the standard Arm build is the one to start with.
If you prefer, Thonny can download and flash the firmware for you (section 4), which skips this step.
3. Flash the Firmware with BOOTSEL
- Unplug the board.
- Hold down the white BOOTSEL button.
- Plug the USB cable in while still holding it, then release.
- A drive called
RPI-RP2(Pico, Pico W) orRP2350(Pico 2, Pico 2 W) appears on your computer. - Drag the
.uf2file onto that drive. - The drive disappears within a few seconds and the board reboots into MicroPython.
That disappearing drive is the sign it worked, not an error. The BOOTSEL drive is the chip's built-in bootloader, so it can't be damaged by a bad file: you can always get back to it by holding BOOTSEL while plugging in.
If the drive never appears, it's almost always the cable or the timing. Use a different data cable, plug straight into the computer rather than a hub, and make sure BOOTSEL is held before the cable goes in.
4. Connect with Thonny
- Open Thonny and go to Run → Configure interpreter….
- Choose MicroPython (Raspberry Pi Pico) as the interpreter. On Pico 2 boards, newer Thonny releases list it under the same entry.
- Set the port to < Try to detect port automatically >, or pick the board's port (
COMxon Windows,/dev/ttyACM0on Linux,/dev/cu.usbmodem…on macOS). - Click OK. The Shell at the bottom shows a banner and a
>>>prompt.
Let Thonny flash it instead: in the same dialog, the Install or update MicroPython link opens an installer. Put the board in BOOTSEL mode, pick the target volume, choose the variant (for example Raspberry Pi · Pico W / Pico WH), and click Install. It downloads the right stable firmware for you.
Confirm what's running by typing this in the Shell:
import os
os.uname()The machine field names the board and chip, for example Raspberry Pi Pico W with RP2040, and release shows the MicroPython version. If it says Pico rather than Pico W on a W board, you flashed the non-wireless build.
If Thonny reports the port is busy, another program is holding it: close other Thonny windows, the Arduino Serial Monitor or any terminal program, then click Stop/Restart backend (Ctrl+F2).
5. Run and Save Your First Program
Type this into the editor and press Run (F5):
from time import sleep
for number in range(5):
print("Pico test", number)
sleep(1)Thonny asks where to save: This computer or Raspberry Pi Pico. Saving to the Pico stores the file on the board's own flash filesystem, which you can browse with View → Files.
Two file names are special:
boot.pyruns first at every power-up, for setup such as Wi-Fi.main.pyruns right after it. Save your program under this name when the board should run it on its own, without a computer.
Use any other name, such as test.py, while you're experimenting, so a buggy script doesn't start on every boot. If main.py does lock up the board, click Stop (or press Ctrl+C in the Shell) to interrupt it, then rename or fix it. The boot.py and main.py guide covers the startup order in detail.
Prefer the command line? pip install mpremote gives you mpremote repl for a Shell, mpremote cp main.py : to copy a file to the board and mpremote run test.py to run one without saving it.
6. Blink the Onboard LED
On the Pico W and Pico 2 W, the green onboard LED isn't on a normal GPIO: it's wired to the wireless chip. That's why old Pico tutorials using Pin(25) do nothing on a W board. Use the name "LED" instead, which works on every Pico model with current firmware:
from machine import Pin
from time import sleep
led = Pin("LED", Pin.OUT)
while True:
led.toggle()
sleep(0.5)If you get ValueError: invalid pin on a W board, you're running the non-wireless firmware; reflash with the _W build.
An external LED: connect GP15 (physical pin 20) through a 330 Ω resistor to the LED's long leg, and the short leg to GND (pin 18), then use Pin(15, Pin.OUT). GPIO numbers in code are the GP numbers, not the physical pin numbers: GP15 is pin 20. Pico pins are 3.3 V only and can safely supply a few milliamps each, so drive relays, motors or buzzers through a transistor or driver module. The Pico W pinout guide and Pico 2 W pinout guide map every pin.
7. Connect the Pico W or Pico 2 W to Wi-Fi
The wireless chip supports 2.4 GHz Wi-Fi only, so a 5 GHz-only network won't be found. Set your country code first so the radio uses your region's channels, then connect with a timeout:
import network
import time
SSID = "YOUR_2_4_GHZ_WIFI"
PASSWORD = "YOUR_WIFI_PASSWORD"
network.country("IN") # your two-letter country code
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, PASSWORD)
for _ in range(30): # wait up to about 15 seconds
if wlan.isconnected():
break
time.sleep(0.5)
if wlan.isconnected():
print("Connected, IP:", wlan.ifconfig()[0])
else:
print("Failed, status:", wlan.status())If it fails, wlan.status() tells you why:
| Status | Meaning | What to check |
|---|---|---|
-3 | Wrong password | Retype it; it's case-sensitive |
-2 | Network not found | 2.4 GHz band, SSID spelling, distance to the router |
-1 | Connection failed | Router security mode; WPA3-only or enterprise networks may refuse it |
1 | Still connecting | Give it longer, or move closer |
3 | Connected with an IP | Working |
Keep real credentials in a separate file such as secrets.py that you don't share or upload, and import them from your main script. When the connection works, the Pico W web server tutorial is a good next step.
8. Common Problems and Fixes
| Problem | Most likely cause | Fix |
|---|---|---|
| No BOOTSEL drive appears | Charge-only cable, or BOOTSEL released too early | Another data cable; hold BOOTSEL before plugging in |
| Drive appears but copying fails or does nothing | Wrong file (ZIP, HTML page) or wrong chip's firmware | Re-download the .uf2 for your exact board |
| Thonny: "port busy" or "device not found" | Another program owns the port, or wrong interpreter | Close other serial tools; Run → Configure interpreter; Ctrl+F2 |
Shell shows no >>> | A script is running in a loop | Click Stop, or press Ctrl+C in the Shell |
ImportError: no module named 'network' | Non-wireless firmware on a W board | Flash the _W build |
Pin("LED") raises an error | Same: non-wireless firmware | Flash the _W build |
ImportError for a desktop Python package | Desktop packages don't run on MicroPython | Look for a MicroPython version, or install one with mip |
Board resets in a loop after saving main.py | main.py crashes or hogs the CPU at startup | Stop it in Thonny and rename the file; or wipe the flash (section 9) |
For error messages beyond installation, the MicroPython troubleshooting guide goes through them one by one.
9. Updating and Recovering
To update MicroPython, copy your files off the board first (in Thonny's View → Files, right-click → Download to …), then flash the newer .uf2 exactly as in section 3. A normal update keeps the filesystem, but having copies means a problem never costs you work. Read the release notes when jumping several versions, since APIs occasionally change.
To recover a board that won't respond, hold BOOTSEL while plugging in and reflash. If a broken main.py still takes over every time, wipe the flash completely with Raspberry Pi's flash_nuke.uf2 (download it from the Raspberry Pi Pico documentation, choosing the version for your chip), then flash MicroPython again. This erases every file on the board, so it's the last resort.
If neither the BOOTSEL drive nor a serial port ever appears, the problem is physical: cable, USB socket or computer port. No amount of reflashing fixes those. In a classroom, label each board with its model and keep the four firmware files in clearly named folders; mixing up Pico and Pico W builds is the most common time-waster.
10. Installation Checklist
- Identified the exact board: Pico, Pico W, Pico 2 or Pico 2 W.
- Downloaded the matching stable
.uf2(RPI_PICO_W,RPI_PICO2_W, …). - Held BOOTSEL, plugged in, and saw the
RPI-RP2orRP2350drive. - Copied the
.uf2and watched the drive disappear. - Selected MicroPython (Raspberry Pi Pico) in Thonny and got a
>>>prompt. - Checked
os.uname()shows the right board. - Blinked the onboard LED with
Pin("LED"). - On a W board, connected to 2.4 GHz Wi-Fi and got an IP address.
What to Learn Next
Build up one piece at a time: read a button, scan for I²C sensors, then add Wi-Fi. The MicroPython on ESP32 and Pico W guide continues from here, and if you also have an ESP32, installing MicroPython on ESP32 with Thonny follows the same workflow with a different flashing step.




