Last Updated:
Raspberry Pi Pico

How to install MicroPython on RPi Pico & Pico W

UltraBlogger Team Pi Pico

Raspberry Pi Pico and Pico W are a series of microcontroller boards developed by the Raspberry Pi (RPI) foundation. Powered by the flagship dual-core RP2040 chip, they are versatile enough to be used for hobby projects as well as industrial applications. Both boards are almost identical, with the exception of Pico W being wireless-enabled. This means it has both Wi-Fi and Bluetooth capabilities.

As with other single-board microcontrollers (SBMs), RPI Pico is designed to run individual programs rather than a full operating system (OS). This makes them highly cost-effective (Pico priced at only 4$) for use in specialised deployments. As common for Raspberry Pi products, they come with 26 GPIO pins and series of peripherals including UART, SPI & I2C controllers, PIO state machines and host device support.

Pico has an official C/C++ SDK, although it's tedious to install the toolchain and deploy your programs. As such, an official MicroPython (Python for microcontrollers) port exists which makes programming the boards much simpler. Here, we look at ways to install MicroPython on them.

Connecting Pico to a PC

If you are connecting Pico for the first time, you can simply plug it in using a Micro USB cable to your PC's USB Port. It will show up as a masqueraded removable drive with 128 MB storage. In reality, it has only 2 MB flash storage.

Raspberry Pi Pico W BOOTSEL
Raspberry Pi Pico BOOTSEL Button

If however, it doesn't show up or this is not the first time you are connecting it, you have to find a small white button labelled 'BOOTSEL' on the board. Just keep pressing the button while connecting it to the USB port, and release it when the drive shows up. It's that simple!

Installing MicroPython firmware manually

Now, it's time to install the MicroPython firmware so you can actually start using it. To do so, you can use the built-in UF2 bootloader on the RPI Pico.

Pi Pico

  1. Download the latest MicroPython UF2 image for Pi Pico using this link. You can use a stable release or a nightly build.
  2. Copy or drag the UF2 file to the Pico removable drive. 

For Pi Pico W

  1. Download the latest MicroPython UF2 image for Pi Pico W using this link. At the time of writing, only nightly builds are available that are quite stable.
  2. Copy or drag the UF2 file to the Pico removable drive. 

That's it! If successful, the device will restart and you'll have a working MicroPython runtime on the Pico. Note: It won't show up as a removable drive now.

Flashing MicroPython using Thonny

Another option to install MicroPython is to flash the firmware using Thonny. It's a beginner friendly Python IDE that let's you write and easily transfer programs to Microcontrollers. If you plan to use this IDE with Pico, it makes sense to use that for flashing as well. Follow these steps for both Pico and Pico W:

  1. Download Thonny's installation package from the official website. Run the installer to set it up on your system.
  2. Connect the Pico to your PC while pressing the 'BOOTSEL' button, until it shows up as removable drive.
  3. Open Thonny and go to Tools -> Options menu. Then, open the 'Interpreter' tab.
  4. From the Interpreter drop-down, select 'MicroPython (Raspberry Pi Pico)'. In the Port drop-down, select 'Try to detect port automatically'.
  5. In the same window, click on 'Install or update MicroPython'. The Pico drive should be automatically selected. Or you can select it manually from the 'Target volume' dropdown. In the 'MicroPython' dropdown, select 'Raspberry Pi - Pico (or Pico W)'. Select the latest version if multiple versions show up in 'Version' dropdown.
    MicroPython RPI Pico Interpreter
  6. Now click on the 'Install' button. It will take a few seconds to copy the firmware to your Pico. Once finished, the progress bar will show 'Done'.
    MicroPython RPI Pico Installation
  7. Close the dialog and click on the 'OK' button in the options window. That's it, Raspberry Pi Pico's actual storage should show up on the 'Files' view at the left side. In the 'Shell' view, you should see the MicroPython REPL running on your PI.

That's it! You have successfully set up your Raspberry Pi Pico with the MicroPython runtime. You can continue to use Thonny or another code editor to program your board.