Skip to content

Tutorial

Raspberry Pi Pico W and Pico 2 W: Install MicroPython with Thonny or UF2

Hold BOOTSEL, drag the correct UF2 file, open the REPL and blink the onboard LED. Includes the Pico vs Pico W vs Pico 2 W firmware differences and what to do when the drive does not appear.

  • 6 min read
  • Updated November 7, 2026
Raspberry Pi Pico W and Pico 2 W: Install MicroPython with Thonny or UF2

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:

BoardChipWirelessFirmware to downloadBootloader drive name
PicoRP2040NoRPI_PICORPI-RP2
Pico W / WHRP2040Wi-Fi 4 + Bluetooth (CYW43439)RPI_PICO_WRPI-RP2
Pico 2RP2350NoRPI_PICO2RP2350
Pico 2 WRP2350Wi-Fi 4 + Bluetooth (CYW43439)RPI_PICO2_WRP2350

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

  1. Unplug the board.
  2. Hold down the white BOOTSEL button.
  3. Plug the USB cable in while still holding it, then release.
  4. A drive called RPI-RP2 (Pico, Pico W) or RP2350 (Pico 2, Pico 2 W) appears on your computer.
  5. Drag the .uf2 file onto that drive.
  6. 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

  1. Open Thonny and go to Run → Configure interpreter….
  2. Choose MicroPython (Raspberry Pi Pico) as the interpreter. On Pico 2 boards, newer Thonny releases list it under the same entry.
  3. Set the port to < Try to detect port automatically >, or pick the board's port (COMx on Windows, /dev/ttyACM0 on Linux, /dev/cu.usbmodem… on macOS).
  4. 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:

main.py
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):

main.py
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.py runs first at every power-up, for setup such as Wi-Fi.
  • main.py runs 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:

main.py
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:

main.py
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:

StatusMeaningWhat to check
-3Wrong passwordRetype it; it's case-sensitive
-2Network not found2.4 GHz band, SSID spelling, distance to the router
-1Connection failedRouter security mode; WPA3-only or enterprise networks may refuse it
1Still connectingGive it longer, or move closer
3Connected with an IPWorking

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

ProblemMost likely causeFix
No BOOTSEL drive appearsCharge-only cable, or BOOTSEL released too earlyAnother data cable; hold BOOTSEL before plugging in
Drive appears but copying fails or does nothingWrong file (ZIP, HTML page) or wrong chip's firmwareRe-download the .uf2 for your exact board
Thonny: "port busy" or "device not found"Another program owns the port, or wrong interpreterClose other serial tools; Run → Configure interpreter; Ctrl+F2
Shell shows no >>>A script is running in a loopClick Stop, or press Ctrl+C in the Shell
ImportError: no module named 'network'Non-wireless firmware on a W boardFlash the _W build
Pin("LED") raises an errorSame: non-wireless firmwareFlash the _W build
ImportError for a desktop Python packageDesktop packages don't run on MicroPythonLook for a MicroPython version, or install one with mip
Board resets in a loop after saving main.pymain.py crashes or hogs the CPU at startupStop 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-RP2 or RP2350 drive.
  • Copied the .uf2 and 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.

Continue learning

Related articles

All articles

Signal In

Built from what makers search for

The lookups piling up in SolderHub's search bar every day shape what we publish next — new component pages, board guides, and firmware notes, sent out as they go live.

By subscribing you agree to our Privacy Policy. Unsubscribe anytime.