Labs / MicroPython tutorials

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

Author: Li Zisheng · Source: FreakStudio open documentation, v1.3.0 · License: CC BY 4.0

Contents

1. Firmware Burning

1.1 Flashing MicroPython Firmware to Raspberry Pi Pico

In most parts of this tutorial, the Raspberry Pi used Pico adopts the MicroPython version firmware: RPI_PICO-20240602-v1.23.0.uf2.

You can download it via the following link: https://micropython.org/download/RPI_PICO/

If you do not want to use the pre-built version — for example, if you want to develop an extended C module for MicroPython — you will need to obtain the source code of MicroPython, modify it, and then cross-compile it to build your own MicroPython firmware binary file.

Introduction to Official MicroPython Firmware Versions

MicroPython officially provides a variety of firmware supporting multiple development boards (such as Pyboard, Raspberry Pi Pico, ESP32, WiPy), which can be downloaded from the following link:

https://micropython.org/download/

Meanwhile, different versions of firmware are also provided for different development boards. Taking pyboard as an example, starting from version v1.9.1, the firmware is divided into the following versions:

  • Standard Version (standard)
  • Double-precision floating-point version (double FP)
  • Threading Version (threading)
  • Double-precision floating point + threads
  • Web Version (network)

The basic modules are the same across different versions, but each version has its own unique features: for example, the double-precision floating-point version supports floating-point numbers with a higher precision than the 32-bit single-precision floating-point numbers of the standard version; the thread version enables multi-tasking functionality; the network version can connect to an external Ethernet module via the SPI interface.

In addition to being categorized by development board and features, the official MicroPython firmware can also be divided into the following types:

  • Official version: A version that has undergone extensive testing and features relatively stable functions
  • Historical version: A previous official version with fewer functions than the current official version
  • Nightly Build: A test version that includes some of the latest features but may have certain issues

The file names of official releases and historical versions only consist of: development board name + timestamp + version number, for example: ESP32_GENERIC-SPIRAM-20240602-v1.23.0.bin, while the file names of daily builds additionally include the build version number, such as ESP32_GENERIC-SPIRAM-20240608-v1.24.0-preview.34.g5903ee561.bin.

In addition, for some development boards for which the official has not provided firmware but are hardware-compatible, it is rather difficult for beginners to carry out source code porting and compile. At this point, we can download firmware for some other development boards from the Chinese MicroPython Community via the following link:

https://github.com/micropython-Chinese-Community/MicroPython_firmware

Currently, the firmware versions for development boards available in the Chinese community are as follows:

  • STMicroelectronics Boards
    • STM32L476DISC
    • STM32F429DISC
    • STM32F4DISC
    • STM32F411DISC
    • STM32F7DISC
    • STM32F769DISC
    • NUCLEO_L476RG
    • NUCLEO_F091RC
    • NUCLEO_F401RE
    • NUCLEO_F411RE
    • NUCLEO_L432KC
    • NUCLEO_F446RE
    • NUCLEO_F746ZG
    • NUCLEO_F767ZI
    • NUCLEO_H743ZI
  • nordic
    • nRF52840 DK
    • PCA10040
    • microbit
  • TEXAS INSTRUMENTS Boards
    • CC3200-LAUNCHXL
    • MSP-EXP432P401R
  • Third party boards
    • PYB Nano V11/V2
    • PYBCN V2
    • ESP-MP-01
    • CANNON
    • Neutron
    • XMC4700 Relax Kit
    • Seeed Arch BLE
    • Seeed Arch Link

In addition, the MicroPython Chinese Community also provides some relevant sample codes and materials:

  • Common sensor and other component drivers https://github.com/micropython-Chinese-Community/mpy-lib
  • MicroPython Task Scheduler
  • https://github.com/micropython-Chinese-Community/micropython-simple-scheduler
  • https://github.com/micropython-Chinese-Community/micropython-simple-scheduler
  • MicroPython Chinese Tutorial:

https://github.com/micropython-Chinese-Community/MicroPython_ChineseReference

https://github.com/micropython-Chinese-Community/MicroPythonChineseReference

When flashing the firmware, we first need to hold down the BOOTSEL button on the Raspberry Pi Pico, then connect the Raspberry Pi Pico to the computer via a USB cable while keeping the button pressed. Note: If the computer does not prompt that a new device is connected, it is very likely that the USB cable you are using is a charging cable instead of a data cable.

After the Raspberry Pi Pico is connected to the computer via USB, the Pico will be recognized as a mass storage device. Open This PC and you will find a new RPI-RP2 volume appears:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.1 Windows device recognition status of the Raspberry Pi Pico board

Open Device Manager, and by default two devices will appear: Universal Serial Bus device and disk drive:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.2 Raspberry Pi Pico device properties interface and firmware writing instructions

Simply drag the prepared firmware RPI_PICO-20240602-v1.23.0.uf2 file into the drive that appears after plugging in the Pico, and this will program the firmware into the flash memory of the Raspberry Pi Pico:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.3 Raspberry Pi Pico MicroPython firmware flashing and serial port parameter configuration interface

Programming the UF2 file into the flash takes a few seconds. Once completed, the development board will automatically restart, causing the RPI-RP2 drive to disappear, and then MicroPython will start running.

Open Device Manager to check the ports, and you will find a newly appeared COM port in Device Manager. We can use this port (actually the USB virtual serial port on the Raspberry Pi Pico) to access the REPL (similar to a command line) of the Raspberry Pi Pico.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.4 Raspberry Pi Pico serial port properties (flow control) configuration interface

1.2 MicroPython Firmware Version on Raspberry Pi Pico

Some of you may have noticed that the latest version of the MicroPython firmware currently is v1.27.0+, so why do most of the codes in our tutorials use v1.23.0?

Here, we have listed the change table for MicroPython firmware versions v1.23.0 to v1.27.0 for the Raspberry Pi Pico:

Version (release date)Main changes related to rp2 / Pico (summary)Impact on Pico users (brief)Recommended action
v1.23.0 (≈2024-05/06) (GitHub)Introduces dynamic USB device (machine.USBDevice); performance optimizations for the VM and runtime (about +10%); improved DMA access to PIO/SPI FIFOs; fixes for threads, lightsleep, UART IRQ latency, etc.USB device/CDC is more flexible (configurable at runtime); better performance and I/O stability, more reliable lightsleep/IRQ behavior. Positive impact on Pico W network/USB interaction.If you use USBDevice or deep sleep/IRQ, upgrade and run regression tests (USB behavior under lightsleep, UART interrupt latency).
v1.24.0 (2024-10-26) (GitHub)Supports RP2350 (Pico 2 / RPi Pico2), strengthens the RISC-V native emitter (RV32IMC), unifies TinyUSB CDC code, portable UART IRQ API; rp2 updated to pico-sdk v2.0.0; USB stays active during lightsleep; IPv6 enabled by default, etc.Native support for the new-generation Pico (Pico 2 / RP2350), including ARM & RISC-V modes. TinyUSB improvements make REPL/boot output more reliable after the host connects; UART IRQ interface behaves more consistently across boards.If using Pico2/RP2350: flash the appropriate firmware and test RISC-V native features, PIO, PSRAM (if present); migrate UART IRQ code to use the new API; verify TinyUSB boot buffering and REPL behavior.
v1.25.0 (2025-04-15) (GitHub)Adds ROMFS (read-only built-in, memory-mapped filesystem) support (.mpy can be executed in place) and provides the mpremote romfs tool; enables DTLS on rp2 (mbedTLS update) and improves networking and lwIP; enhancements for RP2350 (PIO side_pindir, more flexible SPI, WPA3, etc.).ROMFS can significantly reduce RAM usage and speed up module imports, suitable for memory-sensitive Pico projects; networking (including DTLS) is more capable on Pico W/2W but uses more memory; RP2350 peripherals and Wi-Fi features are more complete.Evaluate packaging commonly used libraries/resources into ROMFS (on boards with a ROMFS flash partition, or enable it yourself); if using TLS/DTLS, run memory/concurrency tests; verify WPA3, mDNS and network reliability on Pico W.
v1.26.0 (2025-08-09) (GitHub)rp2: enables compressed error messages (saves ~3 KB); switches back to and uses the pico-sdk alarm pool (sleep/timer improvements); supports machine.I2CTarget (I²C target devices are available on rp2); Thumb/ARM native emitter improvements (RP2040 supports longer jumps).Smaller firmware size, but error text is more compact; lightsleep and alarm implementations are more stable; I²C target devices can now be implemented in Python on Pico (rp2), with educational/prototyping value; the native compiler can generate larger/more efficient native functions (helps speed).If you rely on full verbose error logs, note the compressed errors; re-verify low-power features/timers (alarm pool); try machine.I2CTarget for a target prototype (or as a test fixture); if using native, retest the compilation/stack impact.
v1.27.0 (2025-12-06) (GitHub)Fixes DMA channel release logic; PIO supports pin wrap-around, fixes the upper-half pin issue on RP2350B; fixes alternate function configuration for pins numbered above 31; RP2350 adds alternate functions such as UART_AUX/XIP_CS1; enables hashlib.md5; updates TinyUSB to 0.19.0-24; supports Timer soft/hard interrupt callbacks; sys module is fully enabled by default.DMA resource leak fixed, improving long-running stability; PIO development is more flexible, and high-numbered pin peripheral functions are available on Pico 2; adds MD5 hash capability; USB compatibility and stability improvements; Timer interrupt response is more flexible; sys module features can be used without extra configuration.Test the stability of DMA-dependent projects (such as PIO data transfer, ADC batch sampling); verify high-numbered pins on Pico 2 and the PIO pin wrap-around feature; use hashlib.md5 for data verification; update USB-related code and test compatibility; adapt to the new Timer soft/hard interrupt callback feature.

Table 1.1 Overview of Version Differences and Improvements in MicroPython Firmware (v1.23.0 → v1.27.0)

From a teaching perspective, most of the fundamentals of MicroPython remain unchanged: the Python syntax/REPL interaction model, the core machine API concepts (GPIO, ADC, PWM, basic I²C/SPI read and write operations), the module import mechanism, and the debugging/serial interaction workflow all stay consistent between versions v1.23 and v1.27. As a result, classroom examples and exercise code can be reused in the vast majority of cases without modification, or only with minor adjustments.

Only a few low-level or advanced features have changed (e. g., added RP2350 support and RISC-V native emitter, in-place execution of ROMFS. mpy, DTLS/mbedTLS updates, machine.I2CTarget (I²C slave), TinyUSB startup buffer, sys.exit ()/exception behavior and error message compression, etc.), and we will gradually update these new features in subsequent tutorials.

2. Development Environment Setup Method

2.1 PyCharm

PyCharm is an extremely user-friendly Python IDE developed by JetBrains, which is compatible with Windows, macOS and Linux operating systems. For each of these platforms, PyCharm offers two editions, namely the Professional Edition and the Community Edition, and users can choose the one that best suits their needs:

Here, the Community Edition is sufficient. For the download and installation of PyCharm as well as the installation of the Chinese localization plugin, please refer to the following link:

(Ultra-detailed) Installation Steps for Python + PyCharm and Usage of PyCharm (Including Shortcut Keys)

https://blog.csdn.net/junleon/article/details/120698578

Chinese Localization for PyCharm

https://blog.csdn.net/VeryDelicious/article/details/118976379

2.1.1 MicroPython Plugin

2.1.1.1 Online Installation of the MicroPython Plugin

First, create a new folder, and I name it here as:

F:\elegance-devkit v1\Demo\00 PicoTest

Right-click the mouse and select: Open Folder as PyCharm Project

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.5 Trust project prompt window

Add "Open Folder as PyCharm Project" to the right-click menu for opening folders

If the "Open Folder as PyCharm Project" option does not appear in the right-click context menu, this is because you did not select the option to add PyCharm to the right-click menu during the PyCharm installation. As a result, you cannot directly select a folder to open it as a PyCharm project; instead, you have to launch PyCharm every time, load an unnecessary project first, and then open the actual folder you want from within PyCharm.

You can fix this by modifying the registry; please refer to the following link:

Add "Open Folder as PyCharm Project" to the right-click menu for opening folders

https://www.bianchengbaodian.com/article/e02e05369cb5d3868fe4d7ddc7e1989e.html

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.6 PyCharm interface keyboard shortcut hints

Click - File - Settings:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.7 PyCharm interface keyboard shortcut hints

Click [Plugins], enter "micropython" in the "Search" input box; this plugin enables functions including code editing, program flashing, and REPL execution:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.8 MicroPython plugin search and installation interface in PyCharm

Click Install to install the plugin, and after the installation is complete, click - Restart IDE:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.9 Restarting the IDE

Right-click on a folder, then select New > New Python File:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.10 Creating a new Python file

Create a new file named main.py:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.11 main.py file

Here, we first use miniconda to create a new environment named MicroPython_Learn, and the Python version we use here is Python 3.12.3:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.12 Adding a Python interpreter

miniconda

Miniconda is a package and environment management tool that not only manages packages but also isolates and manages environments for different Python versions, similar to the nvm tool for managing Node. js environments.

For the download, installation and specific usage of miniconda, you can refer to the following link:

Tutorial on Introduction, Installation and Usage of Miniconda3

https://blog.csdn.net/weixin_43828245/article/details/124768518

Next, let's go back to the PyCharm interface and click the button at the bottom right to add the interpreter for our current project:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.13 MicroPython environment selection interface

Select the virtual environment option, click the "Existing" option, click the three-dot button on the right side of the interpreter column, select the python.exe file in the virtual environment installation path, and click OK:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.14 MicroPython device parameter configuration

You can see that the name of the current virtual environment appears in the lower right corner of the IDE, indicating that the interpreter has been added successfully:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.15 Development tool environment initialization

Next, click File > Settings again, select "Languages & Frameworks" > MicroPython, check the "Enable MicroPython support" option, choose Raspberry Pi Pico as the device type, and enter "COM3" in the device path field:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.16 Plugin configuration instructions

Next, we use the pip command in the command line to install the adafruit-ampy tool:

pip install adafruit-ampy==1.0.5
02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.17 Dependency package installation command

ampy (Adafruit MicroPython Tool)

ampy (Adafruit MicroPython Tool) is a command-line utility that enables interaction with CircuitPython or MicroPython boards via a serial connection. Ampy is designed to be a straightforward command-line tool for managing files and executing code on CircuitPython or MicroPython boards over a serial connection.With ampy, you can send files from your computer to the file system of your development board, download files from the development board to your computer, and even send Python scripts to the development board for execution.

For more usage instructions, please refer to the link: https://www.pypi.com.cn/project/adafruit-ampy/

Some libraries and their version information required for MicroPython development using PyCharm are as follows:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.18 Viewing environment package versions with pip list

So far, we have completed the setup of the PyCharm IDE Raspberry Pi Pico MicroPython Development Environment. Next, let's test the programming and running of programs with PyCharm by copying the following code into main.py:

# Python env   : MicroPython v1.23.0
# -*- coding: utf-8 -*-        
# @Time    : 2024/6/10 6:52 PM
# @Author  : Li Qingshui
# @File    : main.py
# @Description : File for testing the PyCharm MicroPython environment setup. If it runs successfully, the LED on the Raspberry Pi Pico blinks

# ======================================== Import Modules ========================================

# Hardware-related modules
from machine import Pin
# Time-related modules
import time

# ======================================== Global Variables ============================================

# ======================================== Functions ============================================

# ======================================== Custom Classes ============================================

# ======================================== Initialization ==========================================

# Power-on delay of 3 s
time.sleep(3)
# Print debug message
print("FreakStudio: MicroPython Pico Test")

# class machine.Pin(id, mode=-1, pull=-1, *, value=None, drive=0, alt=-1)
# Set pin 25 as a normal output; pin 25 is connected to the onboard LED
# Create a machine.Pin instance named led
led: Pin = Pin(25, Pin.OUT)

# ========================================  Main Program  ============================================

# The following code loops, blinking the LED
while True:
    # Set the pin high: LED on
    led.on()
    # REPL outputs "LED ON"
    print("LED ON")
    # Delay for 1 s
    time.sleep(1)
    # Set the pin low: LED off
    led.off()
    # REPL outputs "LED ON"
    print("LED OFF")
    # Delay for 1 s
    time.sleep(1)

This code is located in the folder of the supporting materials: elegance-devkit v1\Demo\00 PicoTest.

After that, we need to modify the run configuration of the main.py file. Right-click [main.py] in the Project window to bring up a context menu, select [Modify Run Configuration…] from this menu to edit the run configuration, and the "Edit Run Configuration" dialog box will pop up.

Enter the Flash program file name in the "Name" edit box, here enter Flash main.py, click the Apply button, and then click the Confirm button.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.19 MicroPython project run configuration selection
02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.20 MicroPython project run configuration interface

You can also edit the running configuration in the upper right corner:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.21 Select a run configuration

Click the green arrow in the upper right corner to start running the MicroPython program:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.22 Click the run configuration

You can view the program download progress in the "Run" terminal:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.23 Terminal download progress

You can see the green LED on the Pico development board blinking at an interval of 1 second. When you run mpremote in the command line, you will see the debug information from the code being output continuously:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.24 MicroPython controlling the Raspberry Pi Pico LED blink demo

When we don't want the Raspberry Pi Pico development board to execute this program, we can click Remove All Files from MicroPython Device under the MicroPython option in the tools menu of Pycharm IDE to remove the program flashed in the Pico:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.25 MicroPython device file management operations

Alternatively, after opening the mpremote remote connection tool in the command line, press the ctrl+ c key:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.25 MicroPython REPL interactive environment

We can also connect to the REPL of Raspberry Pi Pico in PyCharm:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Figure 3.26 MicroPython REPL interactive environment in PyCharm
2.1.2.1 Offline Installation of the MicroPython Plugin

This plugin will no longer be available after 2025 and cannot be found via search in the plugin panel, but we can still install it via an offline method:

https://plugins.jetbrains.com/plugin/9777-micropython/versions/stable

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

Locate the MicroPython plugin page on the JetBrains Marketplace (as shown in Figure 1), and select the plugin version compatible with your current PyCharm version (for example, 1.4.6-2024.2 in the figure corresponds to the PyCharm 2024.2 series), then click "Download" to download the plugin's ZIP Compressed Packet (save it to a local folder):

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
02 Setting up the MicroPython Development Environment — Draft Document Tutorial

In PyCharm, click "File" > "Settings" in the top menu bar (or press the shortcut key Ctrl+ Alt+ S):

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

In the left sidebar of the settings interface, select "Plugins", click the gear icon in the upper right corner, and then select "Install Plugin from Disk" in the dropdown menu:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

In the pop-up file selection window, locate the previously downloaded MicroPython plugin ZIP package, select it, and then click "OK":

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
02 Setting up the MicroPython Development Environment — Draft Document Tutorial

The plugin will be installed automatically. After the installation is complete, the "Restart IDE" button will appear on the interface (as shown in Figure 8). Click this button to restart PyCharm, and the plugin will take effect.

2.1.2 MicroPython Tool Plugin

After JetBrains integrated the Community Edition and Professional Edition of PyCharm in 2025, it carried out a lightweight adjustment to its plugin system. The original MicroPython plugin was officially optimized and upgraded to MicroPython Tool (which integrates the core functions of the original plugin + new features of PyCharm), becoming the officially recommended MicroPython development plugin adapted to the new version of PyCharm, with more unified functions and stronger compatibility:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

Enter the IDE:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

Next, let's proceed with the plugin installation:

  1. Open the integrated PyCharm, and click "File" in the top menu bar → "Settings"(shortcut key Ctrl+ Alt+ S);
  2. Select "Plugins" from the left navigation bar, and you will be directed to PyCharm's Extension Marketplace;
  3. Enter MicroPython Tool in the search box to find the corresponding plugin.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

After installation, connect a MicroPython development board (such as ESP32/ESP8266/Raspberry Pi Pico/STM32) to your computer via a USB cable, launch the plugin, and select the connection method in the pop-up configuration window:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

The other options in this MicroPython Tools settings interface function as follows (explained by section):

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

In the File System panel below, you can find the "management interface" for the internal files of the development board, which allows you to directly view and operate all files stored in the connected development board (for example, the main.py and dht22.py shown in the figure are code files on the development board):

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

REPL is the "real-time command line" of the development board. After a successful connection, it will display the MicroPython version of the development board (as shown in the figure MicroPython v1.26.1 on Raspberry Pi Pico), which allows you to directly input code and execute it immediately. It is a tool for quickly debugging hardware and testing code snippets.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

The "Current File" menu at the top serves as the entry to access the "Run/Debug Configurations", and the core configuration for subsequent file flashing is initiated from here.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

This is the creation interface for "Run/Debug Configurations", which is a prerequisite operation before burning files:

  1. Click "Current File" at the top → select "Edit Configurations", and the "Run/Debug Configurations" window will pop up;
  2. Click the "+(Add)" button in the upper left corner of the window → select "MicroPython Tools", and 3 function options will appear:
    • Upload : Burn (upload) files/projects to the development board (this is the "burning" function you need);
    • Execute: After uploading the file, execute the file directly on the development board;
    • Compile: First compile the Python code into MicroPython bytecode (in. mpy format, which saves more space on the development board and runs faster), then upload it.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

This is the core configuration interface for single-file / multi-file programming, and you can execute the programming once the configuration is completed:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

This is the configuration interface of "Compile Project"(it is not direct flashing, but an optimization step for flashing):

Visual Studio Code (hereinafter referred to as VSCode) is a lightweight yet powerful cross-platform open-source code editor (IDE) that supports Windows, OS X and Linux. It has built-in support for JavaScript, TypeScript and Node.js, and features a rich plugin ecosystem, through which other languages such as C++, C#, Python and PHP can be supported by installing corresponding plugins.

You can refer to the following link for the download and installation of VSCode:

Install VSCode on Win10 and Configure the Python Environment

https://www.cnblogs.com/waff/p/VScode-Python.html

Then right-click on an empty space in the folder and select "Open Folder with VSCode":

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
VSCode folder trust confirmation dialog

First, we need to install the Node. js dependency to support the Pymakr plugin required for embedded MicroPython programming, which can be downloaded and installed via the following link: https://nodejs.org/en/ After the installation is complete, check the Node version number via the CMD command to confirm whether the installation is successful.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Conda environment activation and Node version check in PowerShell

Then click the Extensions icon in the left menu bar to enter the plugin search interface, type "Pymakr" to search for the relevant plugin, and click "Install" to proceed with the installation:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Pymakr extension installation and MicroPython code editing in VS Code

After the installation is complete, close VSCode. When you reopen VSCode, the pymakr.json configuration file will automatically open by default, and we need to modify it and save the changes. If the json file does not pop up automatically, press Ctrl + Shift + P, type pymakr, and select Global settings to bring it up.

Add "Open File with VSCode" to the right-click menu for opening folders

If the "Open with VS Code" option does not appear in the right-click context menu, this is because you did not select the option to add VS Code to the right-click menu during the VS Code installation, which makes it impossible to select a folder to open as a VS Code project. As a result, you have to launch VS Code every time, load an unnecessary project first, and then open the file you actually want from within VS Code.

You can fix this by modifying the registry; please refer to the following link:

Set up to open files and folders with VSCode via right-click in Windows Settings

https://blog.csdn.net/m0_45219210/article/details/123664120

Add "Open File and Folder with VSCode" to the Right-Click Menu in VSCode [Windows]

https://blog.csdn.net/qq_37596943/article/details/131781224

For the specific process, please refer to the following link:

MicroPython Programming with Visual Studio Code

https://docs.tpyboard.com/zh/latest/tpyboard/tutorial/vscode/

Thonny is a new Python IDE for learning and teaching programming that can make program visualization a natural part of the beginner's workflow. Its prominent features include various ways of stepping through code, step-by-step expression evaluation, intuitive visualization of the call stack, and modes for explaining the concepts of references and heap. It supports educational research by logging user actions to replay or analyze the programming process. It is free to use and open to extensions.

It has the following characteristics:

You can refer to the tutorial for downloading and installing Thonny:

(Latest) How to directly download and install Thonny (an editor for Python)

https://blog.csdn.net/m0_57202121/article/details/135958433

After the download and installation are complete, we first launch the Thonny IDE:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Opening a MicroPython code file in Thonny

Then open our MicroPython program, using the same path as the one applied in PyCharm above:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
MicroPython REPL interactive environment

Then click the Python version number in the bottom right corner of Thonny, and select the corresponding Python interpreter: MicroPython (Raspberry Pi Pico):

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

Click to configure the interpreter, and just configure it as follows:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Thonny interpreter configuration dialog

Click the run button in the upper left corner:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Running MicroPython code in Thonny

You can see the LED blinking, while the terminal outputs debug information:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
MicroPython code execution log

Use the "Save As" option in the file to save the test program. At this point, you need to select a storage location:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Saving code to the Raspberry Pi Pico in Thonny

You can choose different storage locations. Just select the corresponding storage space when reopening it in the future.

Thonny comes with a built-in visual package manager that makes it easy for beginners to install and uninstall various third-party Python packages. You can open it by clicking *Tools* -> *Manage Packages* at the top of the IDE:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Managing packages on the Raspberry Pi Pico in Thonny

In addition, we can click "View" at the top of the IDE to display multiple windows such as Plotter, stack, Variables, and Object Inspector, which facilitates program debugging:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Thonny debug view

2.4 Building MicroPython Development Environment Based on VS Code in Linux Environment

2.4.1 Setup of MicroPython Development Environment on Linux (Container-based)

For details, please refer to: Building MicroPython Development Environment on Linux (Container-based)

Here, we use VSCode with Dev Container (containerized Development Environment) for MicroPython development. The container communicates with physical boards (such as /dev/ttyACM0, /dev/ttyUSB0, etc.) via mpremote, keeping the code synchronized with the host machine's folders.

Placing the Development Environment in Docker + VSCode Dev Containers and using it together with mpremote for joint debugging with the device can deliver a workflow that is repeatable, consistent and low-maintenance: team members do not need to install complex dependencies on their respective hosts, and can directly start the container to get the same toolchain (mpremote, Python, mpy-cross, etc.);Containerization also isolates device access, permissions, and dependencies to avoid polluting the host system. Meanwhile, it enables real-time synchronization between code and devices via workspace mounting, significantly accelerating iteration and debugging between the host machine and target board, and facilitating quick onboarding for new users as well as stable delivery.

Points to note:

Update the package index and install common tools before starting:

sudo apt update
sudo apt install -y docker.io git
# Optional: if VSCode is not installed, first install the .deb from the official website and then use apt, or install it with your distribution's package manager

Next, we add user permissions (for serial ports and Docker), and first check the permissions of the device:

ls -l /dev/ttyACM0
# Example output: crw-rw---- 1 root dialout 166, 0  Sep 3 15:52 /dev/ttyACM0

Then add yourself to the docker and dialout groups:

sudo usermod -aG docker $USER
sudo usermod -aG dialout $USER

To activate a new group identity, you need to log out, log back in, or restart your computer; alternatively, you can use newgrp for temporary activation (valid for the current shell):

newgrp docker
newgrp dialout

Next, install the VSCode extension: Dev Containers (search for it in the Marketplace and install it), then place the https://codeberg.org/eoelab/cenv/src/branch/main/Denv/upython directory's. devcontainer folder into your workspace.

In the VSCode menu, select: Remote-Containers: Open Folder in Container. ..(or select "Open in Container" in the lower right corner):

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
VS Code dev container initialization screen
02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Language environment directory inside the dev container

Wait for the container to build and initialize (the first time will pull the mirror and install dependencies), and you will see the development container name displayed in the lower left corner, as well as the log panel of Dev Containers:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Language environment directory inside the dev container

Develop in the container terminal or VSCode editing window just as you would on the host machine. Common mpremote commands:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
VS Code dev container extension installation log
# Show the mpremote version to check that it is available
mpremote --version

# Connect to the device and open the REPL (replace with your device)
mpremote connect /dev/ttyACM0 repl

# Run a single file on the device (no upload needed)
mpremote connect /dev/ttyACM0 run main.py

# Upload a file directly to the device
mpremote connect /dev/ttyACM0 fs put main.py :/main.py

# Mount a host directory on the device (good for quick iteration)
mpremote connect /dev/ttyACM0 mount . run main.py

# Terminate the current task: Ctrl+C (on the command line)

If your devcontainer.json has mapped the device to the container, mpremote can directly access the device by using /dev/ttyACM0 inside the container. If no mapping is configured, mpremote will prompt a device not found error or a permission error.

For a single file, simply right-click and select mpremote > Run file on remote device to execute it:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Project structure inside the dev container

For multi-file/project development, open a terminal and run mpremote mount. run main.py to get started:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Remote execution and upload of MicroPython code

Use ctrl+ c to terminate the current task. You can switch the file to be executed at any time simply by running the command again, no extra copying is needed, and it stays in sync with the host file, making it ideal for development scenarios.

2.4.2 Building MicroPython Development Environment on Linux+ VSCode (Pure Local Version)

Building MicroPython Development Environment with Linux and VSCode (Pure Local Version)

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
02 Setting up the MicroPython Development Environment — Draft Document Tutorial

2.4.3 Build MicroPython Development Environment with Linux and PyCharm

Building MicroPython Development Environment with Linux and PyCharm

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
02 Setting up the MicroPython Development Environment — Draft Document Tutorial

3. Online simulation platform supporting MicroPython

When it comes to learning embedded systems, a good development board is indispensable. But what if you don't have an embedded (MCU) development board at hand and are eager to learn embedded knowledge? In this case, we can use some online simulation platforms to complete the relevant learning of embedded knowledge. An online simulation platform can be understood as a simulation of a real microcontroller and peripheral sensors, where we can complete code writing, flashing and running, and observe the working status of the microcontroller and sensors at the same time.Here, we recommend two online simulation platforms that support MicroPython, namely Wokwi and Unicorn.

3.1 Wokwi

Wokwi is a powerful and practical free-to-use online simulator for embedded systems and Internet of Things applications, which allows users to build detailed circuit diagrams and write and run code in real time for mainstream microcontrollers such as ESP32, STM32, Arduino and Raspberry Pi Pico in a virtual environment without the need for actual physical hardware.For enterprise-level engineering project development, although Wokwi may seem to have limited functions in some high-complexity or specific hardware interaction scenarios, it undoubtedly provides an extremely convenient and low-cost learning and Development Environment for electronic DIY enthusiasts, school teaching and remote home-based developers.

With the Wokwi platform, learners and developers can easily drag and drop various electronic components to build Modularization circuit designs just like physical operations, and write and debug programs via the integrated code editor. Such a simulation process not only eliminates the risk of hardware damage that may be caused by physical debugging, but also greatly lowers the cost threshold for technical education — learners no longer need to invest a large amount of money in purchasing various development boards and supporting components to master the knowledge of different modules.All in all, Wokwi, as an all-in-one online service, simplifies the design and debugging of embedded programming and IoT projects, catering to the entry-level needs of beginners while facilitating flexible practical exploration for advanced users.

And according to the introduction on Wokwi's official website, it not only supports online simulation, enabling the entire process of editing and running simulations to be completed in the cloud, but also supports local editing and compiling of programs in the form of a VScode plugin, after which the binary files can be run on the simulation platform, which well protects the security of developers' program codes.

At the same time, Wokwi also has some special features, including:

The website of Wokwi is: https://wokwi.com/

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
MicroPython online simulation and REPL environment

Here, we choose the Raspberry Pi Pico development board and click on any MicroPython routine:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Selecting Pi Pico hardware simulation in Wokwi
02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Wokwi MicroPython example project

Here we select the "Blink" LED blinking example, click the green button to run it, and you will see the LED blink:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
Pi Pico LED blink simulation in Wokwi

3.2 unicorn

Unicorn is a lightweight, cross-platform, and multi-architecture CPU emulator framework, which allows us to focus better on CPU operations while ignoring the differences between machine devices. Just imagine that we can apply it to these scenarios: for instance, when we simply need to simulate code execution instead of requiring a physical CPU to perform those operations, or when we want to analyze malicious code and detect virus signatures in a safer manner, or when we aim to verify the functionality of certain code during the reverse engineering process, using a CPU emulator can greatly facilitate our work.

MicroPython unicorn contains the MicroPython port for this virtual microcontroller, available at: https://micropython.org/unicorn/

We open MicroPython unicorn, select an example program of "I2C LCD", click to run, and we can see that icons are displayed on the LCD screen.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial
MicroPython unicorn online simulation and REPL environment

4. Graphical Programming of MicroPython

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

bipes is a beginner-friendly tool for MicroPython hardware development: it is a browser-based online tool that requires no local software installation. Users can directly drag and drop the graphical blocks on the left (such as those in categories like logic, hardware control, sensors, etc.) to piece together MicroPython code — as shown in the figure, the "set output pin" block is used to control the on-board LED (GPIO25 pin) of the Raspberry Pi Pico to light up.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

BIPES supports a variety of development boards (including ESP8266, ESP32, and Raspberry Pi Pico), and can connect to microcontrollers via Wi-Fi or serial port.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

The left-side menu provides dedicated blocks for multiple sensors such as DHT11/22 (temperature and humidity), ultrasonic sensors, gyroscopes, and more.

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

It is also equipped with a device interaction and log viewing area:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

We can also manage files between the development board and the local machine:

02 Setting up the MicroPython Development Environment — Draft Document Tutorial

This website also provides a Device tab, which is the reference area for development board pins, displaying the complete pinout of the Raspberry Pi Pico, with different colors corresponding to different functions (for example, GPIO is marked in green and I2C in blue).

References

https://blog.csdn.net/yuanzywhu/article/details/113483661

https://www.instructables.com/How-to-Use-PyCharm-With-Raspberry-Pi-Pico-W-and-Mi/

Chapter 1. The MicroPython Environment

https://blog.jetbrains.com/pycharm/2018/01/micropython-plugin-for-pycharm/

Install the software

pycharm-professional-2024.1.1.exe (714.7 MB): third-party installer, download it from the publisher

Activation tool.rar 104 KB

Version Record

Version Number

Modifier

Time

Content

v1.0.0

Li Zisheng

2025/09/16

Document initialized, based on MicroPython version V1.23.0.

v1.1.0

Li Zisheng

2025/12/05

Add a figure caption.

v1.2.0

Li Zisheng

2025/12/19

Added Section 4: 4. Graphical Programming with MicroPython and Installation & Usage of the MicroPython Tool Plugin

v1.2.1

Li Zisheng

2025/12/27

Added the introduction to the MicroPython v1.27.0 firmware.

v1.3.0

Li Zisheng

2026/03/11

Added the environment setup methods for VSCode and PyCharm in the Linux environment.