Learn electronics, coding, and projects — step by step.

Micropython Basics: Thonny IDE

Table of Contents

Before you can start writing and running MicroPython code, you need an environment that allows you to easily communicate with your development board. One of the most beginner-friendly tools for this is the Thonny IDE — a lightweight Python editor that includes built-in support for MicroPython boards such as the ESP32, ESP8266, and Raspberry Pi Pico.

Thonny simplifies the setup process by combining everything you need into a single interface: a code editor, a Python shell, and a tool for flashing MicroPython firmware onto your board. Let’s walk through the setup process step by step.

Step 1: Install Thonny

Visit the official website at https://thonny.org and download the latest version of Thonny for your operating system. Installers are available for Windows, macOS, and Linux.

Once the installation is complete, launch Thonny. You should see a clean interface with two main areas:

  • Editor area — where you write and save your scripts.
  • Shell (REPL) — the interactive console at the bottom of the window where you can type and test commands directly.
Thonny IDE Interface Screenshot
Figure 1: The Thonny IDE interface showing the editor and shell.

Step 2: Connect Your MicroPython Board

Plug your development board (ESP32, ESP8266, or Raspberry Pi Pico) into your computer using a USB cable. Make sure the cable supports data transfer, not just charging. If you are using Windows, your computer may automatically install the necessary USB drivers. If not, you might need to manually install the drivers for your board model.

Once connected, the board should appear as a serial device or COM port on your system. You don’t need to configure it manually yet—Thonny will detect it in the next step.

Step 3: Install MicroPython Firmware

MicroPython firmware is what allows your board to understand and execute MicroPython code. Thonny makes this installation process straightforward:

  1. Open Thonny and go to Tools → Options.
  2. Click the Interpreter tab.
  3. In the Interpreter dropdown, select your board type, such as MicroPython (ESP32) or MicroPython (Raspberry Pi Pico).
  4. Click the Install or update MicroPython button.

Thonny will automatically download the latest firmware and flash it to your board. This process usually takes less than a minute. Once it’s done, you’ll see a confirmation message indicating that the installation was successful.

Installing MicroPython Firmware via Thonny
Figure 2: Installing or updating MicroPython firmware in Thonny.

Step 4: Select the Interpreter and Port

After flashing the firmware, you need to tell Thonny which interpreter and serial port to use:

  1. Go back to Tools → Options → Interpreter.
  2. Select your board again from the dropdown menu.
  3. Under Port, choose the port where your board is connected. It may look like:
    • COM3 on Windows
    • /dev/ttyUSB0 or /dev/ttyACM0 on Linux
    • /dev/tty.usbmodem* on macOS
  4. Click OK to save your settings.

Step 5: Verify the Connection

Now that your board is connected and the firmware is installed, it’s time to confirm that everything works. In the Thonny Shell (the bottom pane), you should see a MicroPython prompt similar to the one below:

MicroPython v1.xx on 2025-xx-xx; ESP32 module with ESP32 Type "help()" for more information. >>>

Try typing a simple command to ensure the interpreter responds correctly:

print("Hello from MicroPython!")

If you see the message Hello from MicroPython! printed in the console, congratulations — your setup is complete! 🎉 You now have a working MicroPython environment ready for programming and experimentation.

💡 Tip: If your board isn’t detected, try another USB cable, check your drivers, or use the “Stop/Restart backend” button in Thonny. Many issues are solved by simply reconnecting the device.

With Thonny and MicroPython set up, you’re ready to write your first hardware-interactive program in the next section — blinking an LED!

×



Related Articles: (by Series)