Skip to content

uPesy only delivers currently in France.

Contents Menu Expand Light mode Dark mode Auto light/dark mode

Install MicroPython on Raspberry Pi Pico

What is MicroPython

MicroPython is a Python interpreter optimized for microcontrollers like the RP2040 or ESP32. Therefore, we can develop Python scripts that will be directly run on a Raspberry Pi Pico board or an ESP32. To do this, we install MicroPython on the board and then use software ( Thonny IDE for example) to write the Python script and send it to the board.


On the uPesy RP2040 DevKit version, MicroPython is already installed. If you have already used the Arduino IDE to program the board, you must follow this minor operation to put MicroPython back on it.

Install MicroPython on the Pi Pico in 30 seconds

The installation of MicroPython is done by a simple copy/paste of a file on the Raspberry Pi Pico board. To do this, download the latest stable version of MicroPython from the official website in .uf2 format.

Before connecting the board, you must put the Pi Pico in “USB” mode to transfer the firmware. To do this, simply hold down the BOOTSEL button while connecting the board to the computer.


Remember to take a cable that transmits data from the USB. It is okay if you can hear the characteristic Windows noise when plugged in.

The Pi Pico board reveals its memory as a classic USB key in this mode. Its name is RPI-RP2 . Just copy/paste the downloaded .uf2 file into the RPI-RP2 folder. The folder closes automatically, and the Pi Pico board restarts on MicroPython.


With the MicroPython firmware installed, it’s a bit like having some sort of elementary OS installed. Indeed, unlike the Arduino, we no longer send a binary program directly into memory (which will then be executed by the microprocessor). Still, we send a Python script to Micropython to interpret and run it. There is even a file manager in MicroPython.

The different processes between Arduino and MicroPython code

The different processes between a compiled code and MicroPython

MicroPython installation is already complete, just grab your favorite code editor and start programming. However, it is still necessary to communicate with the board.

Communicate between the Pi Pico board and the computer

The Raspberry Pi Pico board with MicroPython communicates through a serial link. This serial link is transmitted through USB.

Several tools can be used to communicate with this serial link:
  • The easiest way is to use an IDE that handles this communication. It will handle both the text editor and the communication with MicroPython of the Pi Pico.


    This is what the Arduino IDE software does with the Arduino boards.

    For MicroPython, the Raspberry Pi foundation’s recommended software is Thonny IDE. However, one can also use Mu software, Geany or VS Code.

  • There is also a specific extension for VS Code enthusiasts to communicate with the Raspberry Pi Pico.

  • You can interact with REPL (MicroPython Interactive Interpreter Mode) for advanced programmers via a serial terminal such as Putty, Minicom, screen. There are also tools like ampy and RSHELL, which allow saving Python scripts and managing the board’s file manager directly from a console.

Because of this plethora of tools, it is recommended for beginners to use Thonny IDE . For those already using VS Code, you can test the extension(there are several), then try other tools like Ampy and RSHELL.

Installation of the various tools for MicroPython

Thonny IDE

To install Thonny IDE, simply go to the official website , then choose and install the correct executable according to your operating system.


Thonny IDE is already present on Raspberry Pi, so you can program the Raspberry Pi Pico from a classic Raspberry Pi board. It may need to be updated to include the MicroPython part.

Setting up Thonny is very easy. During the first launch, you can choose the language.

change language in thonny IDE

Language choice when launching Thonny for the first time

We get a standard text editor with a Python interpreter. However, this is the computer’s Python interpreter, not the Pi Pico’s interpreter.

thonny ide home page

Thonny IDE overview

To fix this, all you have to do is:
  • Select the right Python interpreter by going to RUN> Select Interpreter

    run menu

    Thonny IDE RUN menu

  • Choose MicroPython (Raspberry Pi Pico)

    Select MicroPython as an interpreter in Thonny IDE for pi pico

    Choosing the Python interpreter

  • You can then specify which COM port should be used if the Pico board is already plugged into the computer or let Thonny IDE automatically choose the correct port once the board is plugged in.

MicroPython’s terminal should launch automatically:

MicroPython Terminal in Thonny IDE

Old Python shell replaced by MicroPython 1.17 shell.

If the shell has not been changed, you can try pressing the STOP button. Of course, the board must also be connected to the computer with MicroPython installed.

Now we can start writing our first Python script on Thonny IDE:

import time
 from machine import Pin

 print ("Hello World")
 p25 = Pin (25, Pin.OUT)

 while True:
   p25.on ()
   time.sleep_ms (250) ()
   time.sleep_ms (250)

I suggest you change the blinking time of the LEDs to realize how fast the loading of the new code is.


When saving the source code, Thonny IDE offers to save it either on the board or on the computer. Always prefer saving on the computer to avoid losing your code if you remove MicroPython accidentally.

We use cookies to make your visit to the site as pleasant as possible. Privacy Policy