Getting started with Raspberry Pi Pico with MicroPython

Getting started with Raspberry Pi Pico with MicroPython

Getting started with Raspberry Pi Pico


Getting started with your Raspberry Pi Pico might seem like a difficult task. The programming, various projects to begin with, and thousands of confusing websites exposing you to hundreds of paths that you can take.

But, believe us when we say that kickstarting your journey with the Raspberry Pi microcontroller is Childs play.

Within this article, we will be looking at the different aspects of how to get you started in the gigantic world of IoT and help you navigate through Raspberry Pi Pico and its programming language MicroPython.



What is Pico and what is its use?

Pico is the first microcontroller manufactured by the Raspberry Pi foundation. It is one of its kind and does not share the specifications with its other counterparts. Since it is a microcontroller, we write our codes on a different machine using an external application and consequently “flash” it onto the microcontroller over USB. Pico is a custom “System on Chip” (SoC) that features a dual-core Arm Cortex M0+ processor running at 133 MHz, 264KB of SRAM and 2MB of flash memory for storing files on it.


We can easily use our microcontroller to control and receive input from a variety of electronic devices. Seems exciting, right? Well, it is!


Getting started with Pico


1. Installing Micro-Python

Your Raspberry Pi Pico supports a variety of high-level programming languages, these include micro-python, c, c++ etc. We will be dealing with micro-python within this article.


To get started with micro-python for your Raspberry Pi Pico, download the Micro-Python UF2 file from the Micro-python tab.


Getting started with Raspberry Pi Pico and Micropython


  1. Connecting Pico: Push and hold the BOOTSEL button on your pico and then instantly connect the board to your laptop/ computer using the micro USB cable. Once the drive RPI-RP2 appears on your computer, release the button. Your Pico board is now connected to your device.


  1. Pico and MicroPyhton:  Open the RPI-RP2 drive that appears in the Drives tab and drag and drop the UF2 file. By default, the Raspberry Pi Pico with RPwill reboot and run MicroPython.


2. Downloading and Starting Thonny IDE

You can start programming with MicroPython for your Raspberry Pi Pico using 2 IDEs

  • Thonny IDE
  • uPyCraft IDE

We will have a look at the Thonny IDE in this article and use it to start writing codes onto your Raspberry Pi Pico.


Firstly, you need to download the Thonny editor onto your computer to start writing codes. You can download the IDE from the given link:


Raspberry pi PICO and Micropython



Connect the Raspberry Pi Pico to your computer. Open Thonny and then head to the tools bar and click on options. Open the Interpreter tab and select MicroPython (Raspberry Pi Pico) from the drop-down list. The port dropdown menu can be left to automatically detect the Pico.

Finally, click on ‘ok’.


As soon as you plug in your Pico, a firmware installation tab will appear. Click on “install” to successfully link your Raspberry board, MicroPython and Thonny IDE together. Once the installation completes, the shell will show the MicroPyhton version and the Raspberry board.


In the shell, write print(“Hello World”) to test. Press enter and you will get this as the result :


hello world micropyhton


Now that everything is in place, let’s start with a bit more programming. Shall we?

To get started with your Raspberry Pi Pico, let’s write a code to blink an LED using a few lines of code and your board.


To get your on-board LED, which is connected to the GPIO25 blinking, copy and paste the following code onto the editor:

from machine import Pin, Timer

led = Pin(25, Pin.OUT)

timer = Timer()

def blink(timer):


timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

Save the code using the extension “.py”. Thonny will ask whether you wish to save the code on the computer or the “MicroPython device” Choose, MicroPython device. Click Run and you should see the on-board LED switching between on and off until you click the Stop button.


raspberry pi pico board micropython


If you wish to make things a little more interesting, let’s add some other parts to our project. For getting an external LED blinking using your Pico, you need the following things:

  1. A half-size breadboard
  2. An LED
  3. A 330 Ohm resistor

Start by inserting your Pico into the breadboard. Make sure it is inserted into the central channel and the Micro USB port is at one end of the breadboard.

Now, insert a 330ohm resistor into the breadboard. One of the legs should be inline with GND, which is pin 38 while the other one should be inserted into the rail of the breadboard.

Next comes the LED of which the anode should be connected to pin 34, and the short leg inserted into the GND rail. Now, that our circuit is all set up, let’s start coding! Copy the following code onto your editor:

from machine import Pin


import utime

led = Pin(28, Pin.OUT)


while True:

led.toggle() print(“Toggle”) utime.sleep(1)


fritzing micropython


To run the code, save it using the extension “.py” on the MicroPython device and click Run. You will see the LED flashing on and off.


led blick pico and micropython


Congratulations! You have successfully completed your first project on your Raspberry Pi Pico and have understood the basics of using the Raspberry Pi devices. With the MicroPython and Thonny IDE on your computers ready to be used, you are all geared up to take on any project and start coding!

Head onto the given link to explore multiple projects for your microcontroller.



See alsoRaspberry Pi 4 Computer- Latest Raspberry Pi with 4 GB RAM


Let us know what you think about Getting started with Raspberry Pi Pico with MicroPython in the comment section below.


If you like this post subscribe our YouTube Channel for IoT video Tutorials. You can also find us on Twitter, Facebook, and Instagram for more updates.

Start your IoT journey with IoT Basics from IoTDunia.


See alsoThe best operating system for your Pi ; OS for Raspberry Pi



References and Image credit:

how to electronics


IoTDunia is working towards a vision of empowering the youth by providing them with great professional opportunities with Internet of Things to build world class ecosystem.