Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

The Raspberry Pi Pico is a powerful and affordable microcontroller board that provides a great platform for learning and experimenting with electronics. While the official MicroPython and C/C++ SDK support for the Pico is excellent, many makers may prefer to work with the Arduino IDE due to its extensive library support and familiarity.

MAKEUSEOF VIDEO OF THE DAY
SCROLL TO CONTINUE WITH CONTENT

The RP2040 support is basically third-party support for the Arduino IDE that makes it convenient to program a Raspberry Pi Pico on the IDE. It’s really just like installing the ESP32 boards through the additional boards manager option in the Arduino IDE.

Here is how to program your Raspberry Pi Pico with the Arduino IDE using this third-party support.

What You’ll Need

Before we start programming the Raspberry Pi Pico with the Arduino IDE, make sure you have the following components ready:

  • Raspberry Pi Pico board
  • USB-A to micro-USB cable to connect the Pico to your computer
  • Arduino IDE installed on your machine (Windows, macOS, or Linux)

Installing the Arduino IDE

Arduino logo

The installation process is quite straightforward (especially if you are on Windows). Avoid the Windows Store version of the Arduino IDE. Instead, download the Windows ZIP or plain Windows executable from the Arduino website.

During installation, let it install any suggested device drivers to make it easy for the IDE to identify the Pico board when trying to upload your first program.

The process might be a little longer for Linux users, but we have covered how to install the Arduino IDE on Linux in great detail.

Installing the Arduino Core for RP2040

Arduino Uno Board close-up

To enable Raspberry Pi Pico support in the Arduino IDE, you need to first install the necessary resources and enter an additional boards manager URL. This URL provides access to the required resources for the automatic installation of Raspberry Pi Pico support. It may sound complicated, but the process is fairly straightforward.

There are two possible ways that you can do this: using the Boards Manager on the Arduino IDE or using Git. Let's explore both methods.

Using the Arduino IDE Boards Manager

Open the Arduino IDE. Go to File > Preferences (or Arduino IDE > Preferences on macOS) to open the window, as shown below.

preferences window of the Arduino IDE

Remember that if you are already using any other URLs (for example support for ESP32 boards), they will all be listed here, so don’t overwrite them. Simply enter the following URL on a new line into the Additional boards manager URLs field:

https://arduino.github.io/arduino-pico/package_rp2040_index.json

Click on OK to close the Preferences window.

Additional Boards Manager field of the Arduino IDE

Go to Tools > Board > Boards Manager in the IDE.

Boards manager option of the Arduino IDE-1

In the Boards Manager, search for RP2040 and click on Arduino Mbed OS RP2040 Boards by Arduino.

Screenshot for rp2040 search on Arduino IDE

Click on Install to install the board package. This will trigger a large download that may appear stuck at some points since it's approximately 300MB.

Installing via Git

This is the alternative method. If you are using Git on Windows, make sure you enable the Win32 long paths during installation. If you don’t enable them, Git won’t be configured to use them, meaning you may experience errors when trying to clone the submodules.

To get the latest versions, use this set of commands on the Git bash:

 mkdir -p ~/Arduino/hardware/pico
git clone https://github.com/earlephilhower/arduino-pico.git ~/Arduino/hardware/pico/rp2040
cd ~/Arduino/hardware/pico/rp2040
git submodule update --init
cd pico-sdk
git submodule update --init
cd ../tools
python3 ./get.py

Selecting the Board and Port

In the Arduino IDE, go to Tools > Board and select Raspberry Pi Pico from the list. Next, go to Tools > Port and choose the appropriate port that represents your Pico.

Uploading Sketches

Connect your Pico board to the computer using the USB cable. Just make sure the Pico is in bootloader mode by holding down its BOOTSEL button (located near the USB port) while plugging in the USB cable. Then, hit the upload button (right arrow icon) to transfer and run the sketch.

Please make sure to save your Pico's existing MicroPython scripts in the MicroPython file manager before entering bootloader mode. Keep in mind that initiating a new program will overwrite all flash memory.

After the initial upload, you won’t need to put the board in bootloader mode while uploading sketches as the Arduino-Pico core supports auto-reset. This tool serves to remember the correct device to reset for subsequent uploads.

In detail, there's a series of things that happen::

  • The serial link through the COM port is halted.
  • The Pi Pico switches to USB mode, mimicking a mini USB key.
  • The newly compiled program with the UF2 extension is transferred and stored in the board's memory.
  • The Pi Pico reboots and executes the new program while re-establishing the serial link.

In rare cases of a hard hang with the Pico's USB port not responding to auto-reset, follow the initial procedure of holding the BOOTSEL button while plugging in the Pico to enter the ROM bootloader.

To ensure everything is set up correctly, you can upload the classic Blink sketch to the Raspberry Pi Pico.

Go to File > Examples > 01.Basics > Blink to open the Blink sketch.

Blink Example on the Arduino IDE

Or simply just copy this block of code:

 void setup() {
    pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
    digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(750); // wait for a second
    digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
    delay(750); // wait for a second
}

Click on the Upload button (right-arrow symbol) or go to Sketch > Upload to compile and upload the sketch to the Pico. The first compilation may take a long time, but that is completely normal.

The built-in LED on the Raspberry Pi Pico should start blinking if everything is successful.

Since this porting hasn't been around for long, some libraries might not work properly with the Raspberry Pi Pico boards.

Transform Your Ideas With Pico and Arduino IDE

With the availability of comprehensive libraries and a wide range of tools at your disposal in the Arduino IDE, you can confidently transform your ideas into tangible reality. The resources provided by the Arduino ecosystem and the power of the Raspberry Pi Pico give you the flexibility to build more robust projects.