Programming RASPBERRY PI PICO With ARDUINO IDE-How Not to Give Up C Language on Raspberry Pico

by Maurizio Miscio in Circuits > Arduino

2952 Views, 20 Favorites, 0 Comments

Programming RASPBERRY PI PICO With ARDUINO IDE-How Not to Give Up C Language on Raspberry Pico

copertina.png
Programmare RASPBERRY PI PICO con ARDUINO IDE-Come non rinunciare al linguaggio C su Raspberry Pico

Hi guys, in this article we will see how to program the Raspberry Pi Pico with the Arduino IDE so as not to give up the C language when we use another maker board.

What Is Raspberry Pi Pico

pico-rp2040.jpg

The Raspberry Pi Pico is the first microcontroller produced by Raspberry Pi, which until then was known as a manufacturer of single board computers focused on the educational and maker markets.

The Pi Pico is nothing more than an alternative version to an Arduino Nano actually.

In Raspberry Pi products, the Pico is unique because it uses a new microcontroller chip also produced by Raspberry Pi. The RP2040 microcontroller!

The RP2040 is a powerful device with integrated voltage regulation and two internal PIO (Programmable Input Output) processors to enable the creation of custom I/O interfaces.

At just $4, the Pico has joined all those boards like Seeeduino XIAO that have a low-cost, high-performance microcontroller.

Preparing the Arduino IDE

arduino-ide-2-0.jpg

Pico would normally be programmed in MicroPhyton but the C community is too big to pass up. However, having said that, I refer you to another article which is the first of a series on how to program the Raspberry Pi Pico in MicroPhyton and with the Thonny IDE.

To program the Raspberry Pi Pico with the Arduino IDE, we will need to add the Board Manager to manage the new microcontroller.

Install the Board Manager on the Arduino IDE

finale 21.00_02_19_18.Immagine001.bmp
finale 21.00_02_24_17.Immagine002.bmp
finale 21.00_02_30_10.Immagine003.bmp

The  Raspberry Pi Pico Arduino Core is a board manager maintained on GitHub by user  Earle F Philhower  . This core covers not only the original Pico and Pico W, but also pretty much any RP2040-based board you want.

To add this to your Arduino IDE, you'll need to change your preferences to add a JSON string in the same way we've done for other boards like the ESP32 and Seeeduino XIAO.

You can do it as follows:

  • Open the Arduino IDE.
  • Click on the  File menu item at the top and select Preferences. The Preferences  dialog will open .
  • Within the Preferences dialog, look for a text box labeled "Additional Tab Manager URLs."
  • This is where you will enter a JSON string. If the box is empty you can paste it directly, otherwise click on the icon to the right of the box to open a text window that allows you to add multiple JSON strings, one per line.

The string you want to add is the following:

https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

After adding the string to the Add-in Manager URLs, you can click OK to save it in your Preferences

Install Raspberry Pi Pico Board

finale 21.00_02_37_20.Immagine004.bmp
finale 21.00_02_49_04.Immagine005.bmp

The JSON file entry doesn't actually install new Pico RP2040 boards but it points to a location where your Board Manager can get updates. You will need to add the new boards using the Boards Manager utility in the Arduino IDE.

Open the Boards Manager utility by selecting the  Tools menu. Scroll down until you see an entry for the type of board (for example, Arduino Uno) you're currently set up for. Highlight it and another menu will appear, allowing you to change your existing board or launch the Board Manager.

When the Boards Manager window has launched, filter your search by typing "Pico". You will get three results, the second one, "Raspberry Pi Pico/RP2040" is what you want.

Select it and click the  Install button to install the new Boards Manager entry.

It will take a minute to copy all the files, once you're done, you're ready to start using Pico W on your Arduino IDE.

Try Sketch Blink

finale 21.00_03_24_23.Immagine006.bmp

Now that you have the new tab manager files installed, I recommend you test it out. Since the standard method of testing ANY new board is the Blink sketch, refer to the lore.

In this case, it's a good choice, as it uses the "  LED_BUILTIN  " constant for the built-in LED and therefore we don't have to look for the pin associated with the Raspberry Pi Pico's built-in led (which is 25).

Upload the Blink sketch , found in the  Examples gallery, into the Arduino IDE We'll use it as-is, since it already uses "LED_BUILTIN", it should work with the Raspberry Pi Pico as well.

Once this is done, go to the port selection drop-down menu and select Raspberry Pi Pico at COM 3 (in my case it is 4, in yours it could be different)

Conclusion

This was how to program a Raspberry Pi Pico board with the Arduino IDE (in this case 2.0). See you in the next article / video.

Thank you for watching the video or reading the article.