Menu Close

Raspberry Pi Pico

Raspberry Pi Pico is based on a new microcontroller RP2040 designed by Raspberry Pi themselves. This is quite a low cost board and appears to be capable enough. I have just purchased a couple and going to document it here while I explore how it works. Rather than writing up too much, I’ll go straight to the steps needed; you can read the lengthier versions elsewhere if interested.

Raspberri Pi Pico Pinout

Connecting with a computer

I’m using a Windows 10 computer. Press and hold the BOOTSEL button on Raspberry Pi Pico and plug it in a USB socket on the computer. It appears as a USB flash drive:

Raspberry Pi Pico on Windows 10

When you open this drive, it has two small files on it:

Default files on Raspberry Pi Pico

The text file INFO_UF2 has the following contents:

And the INDEX html file has the following contents:

Opening this INDEX file in browser basically redirects you here:

Downloading and installing MicroPython

Download MicroPython UF2 file from here:

Save it somewhere you can find it easy, for example on the Desktop. The file I downloaded is rp2-pico-20220117-v1.18.uf2

MicroPython UF2 file

Now drag and drop this file on to Raspberry Pi Pico (RPI-RP2):

Copy the MicroPython UF2 file on Raspberry Pi Pico

When I did this, Raspberry Pi Pico restarted by itself when file was copied, and then I saw a Windows message saying it was installing new hardware, perhaps F5 mode something. The removable flash drive RPI-RP2 did not appear again.

Downloading and installing Thonny IDE

Go to Thonny website:

Thonny website

Download the Windows version. Save it where you can find it.

Thonny Installer

Double click on the downloaded file to start installation.

You will probably get a security warning, click Run:

Windows security warning

Choose an option:

Thonny Installation Options

I selected “Install for all users”, and it asked for permission once more.

Install for all users
Accept the agreement
Installation location – keep the default unless you have a reason not to
Shortcut option
Tick “Create desktop icon” if you want it there for easy access
Click Install
Click Finish to end the installation process

Now you should have an icon on your Desktop for Thonny if everything went well:

Thonny icon on Desktop

Running for first time:

First run options – I picked Raspberry Pi for Initial settings – Don’t do this, pick Standard
Thonny running in Raspberry Pi mode

If you picked Raspberry Pi initial settings, you will get the above interface, which doesn’t have menu for more tools and options. Click on the “Switch to regular mode” in upper right corner, then close Thonny and open again.

Thonny running in Standard mode

Now go to Tools > Options:

Click on Options… in Tools
Select MicroPython (Raspberry Pi Pico) in the Interpreter tab in Options

After selecting MicroPython (Raspberry Pi Pico), additional option to pick a Serial Port number is displayed. You can leave it to the default “Try to detect port automatically”, unless you have multiple Serial Port devices attached. If you do have multiple devices, you can figure out which one is from the Raspberry Pi Pico by unplugging it from the computer and noting which Serial Port number disappeared. Plug it in again and pick the appropriate port number.

Port option – Leave it to “Try to detect port automatically”

Thonny will confirm in Shell that MicroPython for Raspberry Pi Pico with RP2040 is the current interpreter if it can connect to the Raspberry Pi Pico.

To check that the interpreter is working, you can type a command in Shell and see if it works. For example, type

Whatever you type between the quotation marks should be printed back in the Shell window

Running a test program

Looking at the pinout diagram (at the top of this page), the onboard LED is attached to pin 25 (GP25)

LED pin on Raspberry Pi Pico

We can write a program to blink this LED.

Copy the following program in Thonny IDE

Click on Save button:

Save button

Where to save dialogue will open, click on Raspberry Pi Pico:

Click on Raspberry Pi Pico

Type a file name. File name must have “.py” extension. Click OK to save:

File must have .py extension

Click Run button and the LED on the Raspberry Pi Pico should start blinking:

Running the program

 1,382 total views,  2 views today

Leave a Reply

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