================================================================================================================================================

Sunday, January 9, 2022

Raspberry Pi Pico - A Tiny Power-Packed Development Board

 




Raspberry Pi Pico is a relatively new, tiny but powerful development board designed by the Raspberry Pi (UK), which is based upon RP2040 microcontroller chip, developed in-house by Raspberry Pi. The microcontroller has dual-core Arm Cortex- M0+ Processor, running at clock up to 133MHz, with 264KB internal RAM and supports up to 16MB of external Flash. Multicore operation is supported by a pair of four entry FIFOs (one in each direction between the cores).

The Pi Pico board has 2MB of on-board QSPI Flash, which is programmable through USB Mass Storage Device mode or using Serial Wire Debug port. It also features wide range of flexible I/Os, like GPIO, UART, I2C, SPI, USB and also Programmable I/O (PIO), which is unique to this board. The board has small footprint with solderable headers. It is very cost-effective, available from large number of vendors, may be available in your nearest electronic shop, too. This opens doors for utilization towards a wide range of applications for novices as well as experts.

Detailed information on Raspberry Pi Pico is available here:

Following image with Pin-diagram of Pi Pico gives idea about various I/Os of the device: (courtesy- Raspberry Pi website):


The Pi Pico can be programmed in C/C++ (SDK support is provided by Raspberry Pi), Arduino or MicroPython. A lot of resources have already been made available in such a short time, for this board. That actually shows the rapid growth of interest in Pi Pico and usage by hobbyists/ professionals together. New libraries, packages and platform supports are getting added at quite a fast pace.

I've liked this board so much that I'm literally hooked to it 😊. The purpose of my this post is just to put up an introduction with resource pointers, which I wanted to do for quite some time, before I start posting experimental codes also, using it.


The Pico-SDK: This is official SDK from Raspberry Pi team, for writing C/C++ or assembly language code for Pi Pico, full with headers, libraries and build system, designed to provide an API and programming environment. Multicore support examples are also given.

Pico-SDK GitHub page provides detailed description and links for documentation for using the SDK projects. The SDK can be easily setup with VS Code for programming the Pi Pico. It also has the example projects to demonstrate the use of SDK for various peripherals/ interfaces of the device.


The Pico-Arduino: The addition of the Arduino support has made Pi Pico even more easier to use for any newcomer who wants to get hands-on experience with it. 

There are two packages, shown in Arduino Boards Manager, "Arduino Mbed OS RP2040 Boards" and "Raspberry Pi Pico/RP2040" as shown here:



Both these board support Pico-SDK functions also. Raspberry Pi Pico/RP2040 GitHub page shows detailed information on installation and usage of the package with Arduino. Arduino Pico Document  provides detailed information on writing the code, with examples. This document by Earle F. Philhower, III, is getting updated, like, every other day! :)  This board also supports multicore programming using additional setup() and loop() functions (named setup1() and loop1()).

The  Arduino Mbed OS RP2040 Boards package supports Pico with Mbed RTOS for Arduino. This is really powerful. The Mbed OS is already being used widely in ARM Cortex devices, and support for the same in Pico Arduino makes things even more versatile and mighty by providing access to the various Mbed APIs inside Arduino.

With PlatformIO for VS Code: PlatformIO is a powerful IDE, which can be used for Pi Pico Arduino. The "Raspberry Pi Pico" board is shown in the Board Explorer of PlatformIO home menu. This is same as "Arduino Mbed OS RP2040 Boards" in Arduino IDE. The platfomIO provides professional features of code editing, auto code-completion suggestions / intelliSense, debug options, etc., which are not available currently in Arduino IDE.

Both the above Arduino packages have different default pin assignments for I2C, SPI, etc. Hence, interchangeability of the code has to be properly checked before changing the board setting. As lot of work is currently going on, I suppose there will be a single combined package in the future, which will do away with some of the initial confusion while programming.


Pi Pico with MicroPython: Pi Pico can also be used with MicroPython (or CircuitPython) interpreters, which make programming still easier for newbies who want to avid C/C++, or for programmers already experienced in Python.

Micropython.org page for Pi-Pico provides quick-start reference on installation and usage of micropython on Pi Pico. Also, Raspberry Pi official Datasheet of Python SDK is filled with detailed info on coding with micropython, with examples. This GitHub page also provides ready to use examples in micropython.

Thonny is easy to use, light-weight Python IDE for beginners. The Raspberry Pi page here provides getting started with micropython using Thonny IDE. The Adafruit page provides details on configuring Thonny with CircuitPython for Pi Pico.


Supporting Base Boards: Raspberry Pi Pico is easy to use on breadboard itself for initial prototyping or testing work, great for hobbyists. But if you need some proto board with ready connections for experiments, the Maker Pi Pico Base board looks great. It has got LEDs already mounted on each GPIO pin, providing visual feedback on the code functioning. It has also got other peripherals like microSD card, buzzer (speaker), audio jack, pushbuttons and also connector for ESP32 device for adding WiFi to the project. It's also available online, I think at most places. Here is my board:


You can also opt for a simple GPIO extension boards, like these:



These board are available on amazon, needs to just search for Pi Pico. You'll also get these or similar easily from your local suppliers, too. (In my recent experience during the chip shortage period, I've found getting Pi Pico boards far easier than many other development boards. That's one more incentive to use them!)

Summary:

I hope this gives you the idea of how easy it is to get started with Pi Pico board. The board is really cute, beautifully manufactured! Once you hold it in your hand, may be you'll fall in love with it, too!!😊 Small and yet, it is so powerful for such a size! Go ahead and grab one, you won't regret it.! 👍


Further Reading/ References:

  1. Raspberry Pi Pico Getting Started (Intro to setting up development environment, programming and loading the code into the board)
  2. RP2040 Microcontroller Datasheet (device datasheet of the chip itself)
  3. Pi Pico Board Datasheet (Pico board details with electrical, mechanical specs, powering, components, schematics and application briefs)
  4. Pi Pico Pinout (Pinout with alternative functions)
  5. Pi Pico Hardware Design Reference (Must read before you go ahead with making more hardware connections, other than blinking LEDs!)
  6. Pi Pico C/C++ SDK (C/C++ API function/interface details)
  7. Pi Pico Python SDK  (Python API function/interface details)
  8. Pico-SDK Documentation (doxygen)
  9. Arduino Pico documentation (details of Arduino API implementation)
  10. MicroPython Quick Reference for Pi Pico
  11. Beginner's Guide for R-Pi Pico (A nice starting guide with hardware setup and programming in MicroPython, from seeedstudio.com)


No comments: