Raspberry Pi Pico Projects

Getting Started With Raspberry Pi Pico With Thonny IDE

Raspberry Pi Pico With Thonny IDE

In this tutorial, we will show how to set up Raspberry Pi Pico With Thonny IDE I Raspberry Pi Pico is a low-cost, high-performance microcontroller board with a flexible digital interface. It is designed to be used with the MicroPython programming language, which is a very efficient implementation of the Python 3 programming language. Micropython is a version of python that has been designed to run on microcontrollers. This means that you can write python code that will run directly on your Raspberry pi pico board,

Requirements:

Software

  • MicroPython firmware for Raspberry Pi Pico
  • The Thonny Python IDE

Hardware

  • A Raspberry Pi Pico with soldered headers
  • A computer that can run the Thonny IDE
  • A micro USB cable
  • A breadboard and  jumper leads for connecting additional components (optional)

We are going to learn :

What is Raspberry Pi Pico?

Getting Started With Raspberry Pi Pico With Thonny IDE

Raspberry Pi Pico is an effective yet inexpensive microcontroller that was recently launched by the Raspberry Pi Foundation. This microcontroller is different from other microcontrollers available in the market because it is built on a brand new chip, the RP2040. The Pico also has a variety of peripherals that can be used with Micropython, including GPIO, I2C, SPI, and UART. I don’t want to lecture about the Raspberry pi Pico in full detail here. you can check here  Getting Started Raspberry Pi Pico – Pinout, Specs – Beginner Guide

What is Micropython?

micropython

Python is a programming language with many features, but one of the best things about it is that it’s easy to learn That’s where micropython comes in. Micropython is a version of python that has been designed to run on microcontrollers. This means that you can write python code that will run directly on your microcontroller, without the need for an operating system. This makes micropython perfect for writing code that needs to run quickly and efficiently, without the overhead of an operating system.

Why Micropython?

There are a number of reasons why you might want to use Micropython on the Pico. One reason is that it is a great way to learn about programming and electronics. Micropython is a very simple and concise language that is easy to learn.

The Pico also has a number of tutorials and examples available that show you how to use Micropython to control various hardware peripherals. Another reason to use Micropython on the Pico is that it is an excellent way to develop prototypes.

What is Thonny IDE?

thonny ide

Thonny IDE is a Python development environment that is designed to be simple and easy to use for beginners. Thonny comes with Python 3.7 built-in, so just make sure to have that installed on your computer. Thonny’s user interface is very straightforward. You can write Python code in the code editor and execute it in the debug viewer. It has a very intuitive user interface and a wide range of features that make it a great tool for learning and developing Python applications.

Why use Thonny IDE?

Raspberry Pi Pico is a microcontroller based on the RP2040 microcontroller chip and can be programmed using the Thonny IDE. Raspberry Pi Pico is a great microcontroller board for beginners. It is easy to use and can be programmed using the Thonny IDE. Thonny IDE is a great development environment for beginners and it makes it easy to develop for the Raspberry Pi Pico.

Raspberry Pi Pico is a great choice for beginners who want to learn microcontroller programming. Thonny IDE makes it easy to get started with programming on Raspberry Pi Pico.

How to get started with Raspberry Pi Pico With Thonny IDE?

Raspberry Pi Pico is a microcontroller board based on the RP2040 chip. It was released in January 2021. Thonny IDE is a Python IDE for Raspberry Pi Pico. that comes bundled with the Raspberry Pi OS, so you don’t need to install anything. Just open the Thonny IDE and you’re ready to go. Raspberry Pi Pico is a great little board for starting development with Python. In this guide, we will show you how to get started with Raspberry Pi Pico and Thonny IDE.

Install Thonny IDE and Start MicroPython :

You can program your Raspberry Pi Pico using MicroPython by attaching it to a computer via USB and then dragging and dropping files to it.

  • Install MicroPython to Pico
  • Install Thonny IDE
  • Upload codes

Installing MicroPython & Thonny IDE

Installation of MicroPython on Raspberry Pi Pico needs a “UF2” file to stand copied onto it. A UF2 file is a “binary data file” which contains a program that can be communicated from a PC to a microcontroller, such as an ESP32 or Pico board.

Raspberry Pi Pico uf2 File

The uf2 file below Download the MicroPython UF2 file from this link (click here);

To Install MicroPython on Pico board:

  1. Download the “MicroPython UF2 file” from here.
  2. Attach the cable to the  Raspberry Pi Pico & then press and hold the “BOOTSEL” button before plugging the USB cable into the computer. (Do not release the button)
  3. Release the button after pico is connected
  4. Release BOOTSEL once the drive RPI-RP2 seems on your computer.Raspberry Pi Pico uf2 file
  5. Drag and drop the MicroPython UF2 file onto the RPI-RP2 disk. Your Pico will reboot auto. You are now running MicroPython.
  6. You can access the REPL via USB Serial.
  7. Your Pico will reboot. That’s it, you are now running MicroPython on your Pico.
  8. Visit the Raspberry Pi Official Documentation page from here: Raspberry Pi Documentation.
Firmware & Releases

Raspberry Pi Pico With Thonny IDE Setup

A Thonny IDE is a software that gives its users an environment for performing programming, along with development as well as testing and debugging the application

  1. Download Thonny IDE from here download the IDE version for your specific operating system. install it.
  2. Open Thonny
  3. Connect the Raspberry Pi Pico to your computer. ,

Raspberry Pi Pico With Thonny IDE

4. Go to “tools” –> “options” –> “interpreter” –> select “MicroPython (Raspberry Pi Pico)” as the interpreter and select the COM port being used.

raspberry pi Auto Port Select

5. The port dropdown menu can be left to “automatically detect the Pico”. Click “OK” to close.

(NOTE: There’ll be a prompt asking to install MicroPython, click yes (as shown in the figure), and then you can check in a shell that Pico is connected.) Thonny Setup tutorial From Adafruit 

Conclusion

Writing Blink Code for the onboard LED of pico board.

Enter the following code, make sure you tap Enter after each line.

  • First, save the project on your computer as a “.py” file e.g blinky.pyTip You need to enter the .py file extension so that Thonny recognises the file as a Python file.
  • Navigate to File >> Save
  • Select “This computer” and save

Click in the primary editor panel of Thonny and enter the following code to toggle the onboard LED.

Click the “Run” button to complete the code.

Save the program on the Raspberry Pi Pico and give the name blink.py make sure While saving the file it is a name main.py

When the code will run & you can see the LED toggling on the board. Congratulations your Pico is now running Blinky

References

  • Raspberry Pi Documentation link
  • Raspberry Pi Datasheet link
  • Micropython on Raspberry Pi Pico link
  • Getting Started with Micropython on Raspberry Pi Pico link

Related Posts:

 

Related Articles

Leave a Reply

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

Ad
Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker