Thonny IDE How To Guides - Featured Image

Posted on

by

in

How to guides in Thonny IDE using MicroPython

Introduction

This post is a collection of my Thonny IDE how-to guides when working with MicroPython. I will continually update this post for different scenarios or issues that I have encountered when working with this awesome Thonny IDE.

I have written a quick start guide on how to use Thonny IDE in MicroPython if you want a more structured tutorial.

Related Content:
MicroPython Development Using Thonny IDE

Thonny How to Guides:

How to download Thonny IDE?

Go to this URL and download the Thonny installer that is appropriate for your operating system.

How to set the MicroPython interpreter in Thonny IDE?

Click Run then Configure Interpreter

Thonny Run Configure Interpreter

Select the appropriate interpreter for your MicroPython device.

Thonny IDE Options Intepreter Tab

How to connect/re-connect with your MicroPython device in Thonny IDE?

Click the Stop/Restart backend or Ctrl + F2 at the top menu.

Thonny Stop Restart Backend

How to interrupt running MicroPython script in Thonny IDE?

Click the Run menu and then click the Interrupt Execution.

Thonny Interrupt Execution

Thonny IDE: Device is busy or does not respond

Click the interrupt execution button.

How to install MicroPython libraries or packages in Thonny IDE?

First, make sure that your MicroPython Device is connected and detected by Thonny IDE. Please check the above guide if you don’t know how to do this.

Next, interrupt the running MicroPython script. Please check the above guide if you don’t know how to do this.

Click on Tools – Manage Packages

Thonny Tools Manage Package

Search for the package that you want to install. In my case, I am looking for uTemplate and then clicking the Search on PyPi button.

When the Search Result comes back then click the package that you want to install.

Thonny Search for Package

Click the Install button and when a pop-up comes just click yes.

Thonny Install Package or Library

Your library should be installed in the lib folder of your MicroPython device

Thonny MicroPython Device Library Folder

How to uninstall MicroPython libraries/packages in Thonny IDE?

First, make sure that your MicroPython Device is connected and detected by Thonny IDE. Please check the above guide if you don’t know how to do this.

Next, interrupt the running MicroPython script. Please check the above guide if you don’t know how to do this.

Click on Tools then Manage packages.

Thonny Tools Manage Package

Select the library or package you want to uninstall. Click the Uninstall button afterwards.

Thonny Uninstall Library

This should delete the library or package in the lib folder of your MicroPython device.

How to upload files to your MicroPython Device using Thonny IDE?

First, interrupt the currently running script in your MicroPython device. Refer to the guide above on how to perform this interrupt if you are not sure.

In your Files explorer, select all the files that you want to upload and then right-click then select Upload to / submenu.

Thonny Upload to Device

This will upload the files to your MicroPython device.

Thonny - MicroPython Device

How to format code in Thonny IDE?

Install the latest Thonny IDE that is applicable to your operating system. Your Thonny IDE should have a version that is greater than 4.0.

Thonny Manage Plugins

In the search field, type in “thonny-black-formatter” then click it, and then click the Install button.

Thonny Plugin thonny-black-formatter

When you want to format a Python code then go to Tools then Format with Black.

Thonny Format with black
If you like my post then please consider sharing this. Thanks!

6 responses to “How to guides in Thonny IDE using MicroPython”

  1. How to interface DHT11 with MicroPython? – donskytech.com

    […] First, we need to install the utemplate library or package into our MicroPython device using Thonny IDE. If you do not know how this is done then please refer to my separate post. […]

  2. Control DS18B20 using MicroPython with a Weather Station Project

    […] Next, install the uTemplate library on your MicroPython device. If you are unsure how this is done then you can follow my How to install MicroPython libraries or packages in Thonny IDE? […]

  3. How to Install MicroPython firmware on Raspberry Pi Pico?

    […] Related Content: MicroPython Development Using Thonny IDEHow to guides in Thonny IDE using MicroPython […]

  4. MicroPython: Interfacing with SSD1306 OLED display

    […] Related Content: How to install MicroPython libraries or packages in Thonny IDE? […]

  5. Raspberry Pi Pico W: BME280 Weather Station Dashboard

    […] Install the two libraries using Thonny IDE and if you are not familiar with how this is done then you can see the following How to install MicroPython libraries or packages in Thonny IDE? […]

  6. Pico W – MicroPython MQTT tutorial using umqtt.simple library

    […] Related Content: MicroPython Development Using Thonny IDEHow to guides in Thonny IDE using MicroPython […]

Leave a Reply

Your email address will not be published. Required fields are marked *