Hello readers, I hope you all are doing great. In our previous tutorial, we discussed the installation procedure of Visual Studio Code for programming Raspberry Pi Pico.
We have already mentioned in our previous tutorials that RP2040 or Raspberry Pi Pico supports multiple programming languages like C/C++, Circuit python, MicroPython cross-platform development environments. Raspberry Pi Pico module consists of a built-in UF2 bootloader enabling programs to be loaded by drag and drop and floating-point routines are baked into the chip to achieve ultra-fast performance.
There are multiple development environments to program a Raspberry Pi Pico board like Visual Studio Code, Thonny Python IDE, Arduino IDE etc.
So, in this tutorial, we will learn how to install Thonny Python IDE to program the Raspberry Pi Pico board using Micropython programming language.
Downloading Thonny Python IDE for Windows
Thonny Python IDE (Integrated development environment) is a development tool designed for beginners. The major feature of using Thonny is that it is easy to operate and this development environment also provides a faithful representation of function calls. The Thonny IDE is compatible with Linux, MacOS and Windows OS.
- To download the Thonny Python IDE follow the given link: https://thonny.org/
- This is the official website of Thonny where we have different download versions for different OS.
- Click on ‘Windows’ to download the installation setup for Windows OS (as shown below).
Fig. 1 Download thonny
Installing Thonny Python IDE
- Once the installation setup is downloaded successfully for Windows next step is the installation of the IDE.
- To install the Thonny Python IDE in your system, double-click on the downloaded file.
- Select “Install for all users”.
Fig. 2 Choose Installation Mode
- Follow the basic installation procedure.
- Accept the license agreement and press next.
Fig. 3 Accept the agreement
- Select the installation/destination location.
- You can keep the default location or you can also change the location by clicking on
Fig. 4 installation location
- Now, select the “Start menu folder” and press ‘Next’.
- If you want to create a desktop icon for Thonny then check the respective icon and press Next (as shown below).
Fig. 5 Desktop icon
- Finally, press Install to install the setup.
Configuring the Raspberry Pi Pico for programming with MicroPython
MicroPython is a programming language that runs directly on embedded hardware, for example, ESP and Raspberry Pi Pico. It is a full implementation of the Python (3) programming language.
Programming Raspberry Pi Pico is a very easy process. Users can program the board by connecting it via USB port, and then just drag and drop the file into Raspberry Pi Pico.
Download the MicroPython UF2 file
- To download the micropython UF2 file for raspberry Pi Pico programming follow the given link :
- Scroll down the page for MicroPython UF2 file and download the file to your system, as shown below:
Fig. 6 Download Micropython UF2 file
Connecting Raspberry Pi Pico board with laptop/computer
- Press and hold the BOOTSEL button from the Raspberry Pi Pico development board.
- Connect or plug the Raspberry Pi Pico board to your system/computer via USB cable and release the BOOTSEL button once the Pico is connected to the computer.
- Now you should see a new volume in your system i.e., RPI-RP2.
- Drag and drop the downloaded MicroPython UF2 file into RPI-RP2 This UF2 file will reboot your system.
Select Interpreter and Install MicroPython Firmware
- Open the Thonny IDE.
- Go to Run >> Select Interpreter.
Fig. 7 Select Interpreter
- Select the necessary/required interpreter which is MicroPython (Raspberry Pi Pico) as shown below:
Fig. 8 MicroPython for Raspberry Pi Pico
- Press “Install or update firmware”.
- Again press Install.
- Make sure that your system is connected to internet.
How to check whether Micropython firmware is installed successfully or not and whether it is working or not?
- Go to View >>
- In the file list (on left side of the screen) a complete list of all the local files and document saved on your system will be displayed and along with that your should see Raspberry Pi Pico file in the same list (this is the file saved in Pico).
- Again go to View >> Shell.
- In shell type some command like printing a message as shown below:
Fig. 9 Printing a message with MicroPython (Pi Pico)
- If the command is executed successfully means the firmware is successfully installed or updated and we are ready to program our Raspberry Pi Pico with Thonny integrated development environment.
So, this concludes the tutorial and the installation procedure of Thonny Python IDE (Windows) for raspberry Pi Pico programming.
In our next tutorial we will discuss how to write a program for raspberry Pi Pico programming to control GPIOs using MicroPython programming language.