In this blog post, I would like to show you how to put the Pico into operation, install the first programme and possibly solve some initial problems. Here we go.
What do we need
- Raspberry Pi Pico
- MicroUSB cable for data transfer
- PC with internet connection (alternatively: Raspberry Pi 4(B))
The first impression
The Raspberry Pi Pico and the RP2040 chip used on it are documented very well and in detail on raspberrypi.com. In terms of CPU clock, its 133 MHz puts it behind the ESP32. It does not have a WiFi/Bluetooth chip onboard. However, it has plenty of GPIOs, including two I2C interfaces, three 12-bit ADC converters (counting from 0 to 4095) and an on-board temperature sensor (connected to ADC4). Also a PIO (programmable IO interface) with four state machines, which can be used to emulate hardware interfaces, for example. The Pico is designed to run very power-efficiently, which should make it suitable for mobile battery operation. A hardware debug interface is also available.
Important note: as with the large Raspberry Pi, the pin voltage is only a maximum of 3.3 V. Sensors or actuators that work with 5 V must be operated with an intermediate logic level converter!
Here is the pinout:
Don't get confused. There is no status LED that lights up when you connect the Pico via USB. There is an onboard LED (we also make it flash directly). But you can't tell what mode the Pico is in, or if it has been detected at all. You can only see that in the host system.
Programming the Pico
The most important thing first: to transfer a binary (i.e. the compiled programme) to the Pico, you usually have to press and hold the BOOTSEL key and then connect the Pico via USB. A USB drive called "RPI-RP2" then opens, onto which the programmes are copied (e.g. by drag and drop) if the development environment does not do this automatically. The files must be available as *.uf2.
- Press and hold BOOTSEL
- Connect the Pico via USB
- Open USB drive (if not done automatically)
- Copy uf2 over
The Pico will then restart and the LED on the board should flash.
Programming with MicroPython
One way to get MicroPython onto the Raspberry Pi Pico is to use the Thonny Python IDE. This is available for Windows, Linux (also ARM) and MacOS at thonny.org. Download the program and install it. On Linux, I recommend running the following command in the terminal:
bash <(wget -O - https://thonny.org/installer-for-linux)
This should then install the current version.
On the Raspberry Pi (a current version of the Raspberry Pi OS [with desktop] is recommended, download from here), the Thonny Python IDE is already pre-installed. It starts in Simple UI mode by default, i.e. with the menu bar hidden. Enlarge the window to the right until you see the note "Switch to Standard Mode" in the upper right corner. Click on it and restart the Thonny IDE.
From here on, the process should be the same on all systems. In the "Extras" menu, select the item "Options" (the name depends on the language of the programme interface). There you will find the tab "Interpreter". In the upper drop-down menu, select "MicroPython (Raspberry Pi Pico)" and then in the lower field, select the COM port to which the Pico is connected (the name of the port differs from system to system). Next you should select "Install or update the firmware" at the bottom right of the window.
A window should then appear with the title "Install MicroPython Firmware for Raspberry Pi Pico". Now disconnect the USB connection to the Pico, press and hold the BOOTSEL button, reconnect it to the PC, wait for it to be re-recognised and possibly for the driver to be re-set up and then select "Install". Once this process is complete, close the windows. At the bottom right of the Thonny main window you should now see "MicroPython (Raspberry Pi Pico)". In the lower part you will find the command line. There you will see the MicroPython interpreter with version information and the command prompt >>>.
The firmware may not be installed completely under Raspberry Pi OS. You can download it here (under Firmware -> Releases click on [.uf2]). Then start the Pico in download mode by pressing BOOTSEL and copy the downloaded file into the Pico's USB memory. Then start the Thonny IDE.
If you have problems starting the MicroPython Raspberry Pi Pico interpreter (recognisable by the missing prompt >>> in the lower window area), then set the interpreter to "MicroPython Generic".
If you disconnect and reconnect the USB connection to the Pico, you will probably have to restart the interpreter. To do this, click on the name of the interpreter at the bottom right of the window and simply select it again. The input prompt and interpreter information should then reappear in the command line.
For the first test, copy this short programme into the editor window and save it as main.py:
Start the programme by clicking on the green triangle in the upper area. The green LED on the pico should now flash.
Raspberry Pi and the Pico Arduino
You can now program the Pico with the Arduino IDE. Download the latest version of the programme from this website and carry out the installation.
On the Raspberry Pi 4(B): under Raspberry Pi OS, select the Linux ARM variant. Execute the following commands in the terminal (version 1.8.16 may be different for you):
Change to the download directory
tar -xf arduino-1.8.16-linuxarm.tar.xz
sudo mv arduino-1.8.16 / opt
Move Arduino IDE to the opt folder
Perform the installation
You can now start the Arduino IDE from the start menu via the "Development" item.
Under Linux on the PC, you may still need to run a script if the upload to the Pico does not succeed. It can be found (the version number might differ) under
there you execute the post_install.sh:
The installation procedure for the Pico Core is the same as for the ESPs. Add this line
in the preferences as an additional board administrator URL:
Then open the board manager under Tools -> Board -> Board Manager and enter "pico" in the search field. Install the Arduino Mbed OS RP2040 Boards Core. I recommend you also install the Raspberry Pi Pico/RP2040 Core as it comes with more sample sketches:
Now select the Raspberry Pi Pico under Tools -> Board -> Arduino Mbed OS RP2040 Boards or Raspberry Pi RP2040 Boards:
Open the Blink Sketch via the menu File -> Examples 01.Basics. If the microcontroller is put into download mode with BOOTSEL, no port may appear. Nevertheless, the upload should work. In this mode, the device is displayed as a USB drive. The compiled binary will then be copied to it (automatically). As soon as this process is completed, the port is also displayed.
Under Raspberry Pi OS, however, a port will already be visible. You could load the sketch "Fade". To do this, you must select the board from the Core by Earle F. Philhower, III. Only then will the example sketches be visible under Examples -> rp2040:
Then start the compile and upload process as usual. When this procedure is complete, it should look like this and the onboard LED on the pico should fade in and out:
To use the serial monitor, e.g. for the example sketch "Temperature", you must change the port after the upload process:
Then you can open the serial monitor and see the screen output. In this case, the values of the internal temperature sensor of the Pico:
These operating systems do not support the RP2040, i.e. there is no driver for the Pico to be recognised on the USB port. However, someone found this solution to get it to work after all. I would like to briefly describe the procedure here.
- Behind the link just mentioned are instructions on how to rewrite the driver file given there. I have done this for you. Download the file pico-serial.inf
- Connect the Pico to your PC (without BOOTSEL)
- Select the Start button and enter "devmgmt.msc" in the search and confirm with Enter.
- In the device manager that then opens, an item with a yellow exclamation mark called "Board CDC" should appear under "other devices".
- Right-click on Board CDC and select "Update driver software...".
- Select "Search for driver software on the computer".
- Click on "Browse..." and select the downloaded pico-serial.inf then click on "Next".
- If the message "The publisher of the driver software could not be verified" appears, select "Install this driver software anyway".
- If this was successful, the device is now called Pi Pico Serial Port and is assigned a COM port
I had some problems at the beginning. After I had programmed the Pico under Linux with the Arduino IDE, it then also ran under Windows 7. However, the name of the port was then called ArduinoPico or also Raspberry Pi Pico in the device manager. When it appears, you can right-click on it again and update the driver. Then select "Select from a list of device drivers on the computer". Scroll down to "Atmel, Inc." under Manufacturer on the left and select Pi Pico Serial Port on the right. As an example sketch, you can then select "Temperature" again in the Arduino IDE, or just this simple program:
After the upload, the same name as in the device manager should appear as the port. When you open the serial monitor, the famous "Hello World" should appear. Using Windows 7 or 8 is not so easy to implement. With a little tinkering, however, it is possible.
If the upload process does not work at all after compiling, this workaround will help:
In the preferences of the Arduino IDE, activate the item "Detailed output during compilation". After compiling the Blink sketch, look in the lower window for the directory to the .uf2 file. For me it is:
The AppData folder is hidden. Via the item "Organise" select "Folder and search options". In the window that opens, select the "View" tab at the top and scroll down in the selection to the item "Hidden files and folders". There you can "Show hidden files, folders and drives".
Start the Pico with BOOTSEL in download mode and copy the Blink.ino.uf2 to the USB drive. The onboard LED of the Pico should now flash.
Further programming options
On this website, the user Shabaz shows in great detail how to program the Pico under Windows in C/C++ with Visual Studio Code and compile CMake. The Getting Started Guide for C/C++ SDK and MicroPython SDK from raspberrypi.com are also very detailed documentations. You can also use Eclipse as a programming environment. However, this then belongs to the realm of professional programming, is much more complex to set up and is no longer simply a quick fix.
With the Thonny IDE, you can get the Pico up and running relatively quickly with Python and on various systems. Support for the Arduino IDE is still relatively new, but it already works quite well. If you are used to this environment, you can use it to program the Pico like an ESP or ATmega328 compatible microcontroller in C/C++. Both languages are as good as covered.
I wish you good succeed!