Raspberry Pi Pico – First Look (Part 1)

This post is an introduction to the Raspberry Pi Pico. The Pico is a new microcontroller from the Raspberry Pi Foundation. This small, cheap and flexible microcontroller platform is great for learning to code with MicroPython. The RPi Pic is a radical change from previous Raspberry Pi boards, because it’s not a Linux computer, but a budget microcontroller board like Arduino!

Get off to a great start

If you’re a novice, and you want to get a head start on microcontrollers, then the Raspberry Pi Pico would be the great option to start with because it is the lowest cost and smallest size development board that supports both C/C++ and micro-python. On the technical side, it is equipped with RP2040 microcontroller chip developed inhouse by Raspberry Pi Foundation itself. The RP400 is their first dual-core ARM Cortex M0+ processor based budget-friendly microcontroller. The Pico board is designed for use with breadboards and surface mount carrier boards, and the dual-core processor permits multiprocessing at clock rates up to 133MHz. Note that the board doesn’t run a full operating system, but instead launches programs you write in either MicroPython or C/CPP on a host computer or a regular RPi and upload to it. The Raspberry Pi Pico is agnostic platform and it will work with Windows, Mac and Linux machines.

Pico is powered by Raspberry Pi’s own custom silicon – the RP2040 SoC – which features an Arm Cortex M0+ processor running at up to 133 MHz, with 264K of SRAM and 2MB of onboard storage. The RP2040 chips are fabricated at TSMC on their 40nm process. Compared to the traditional Raspberry Pi, Pico consumes much less current, and is an efficient board for embedded projects. Talking of power, you can power the Raspberry Pi Pico via the micro USB port, or you can use the VSYS GPIO pin to provide power between a range of 1.8V to 5.5V (cheerful range for lithium batteries). Since there is no battery charging option available via the Pico, an external circuitry would need to be used.

Key features include:

  • RP2040 microcontroller chip designed by Raspberry Pi in the United Kingdom
  • Dual-core Arm Cortex M0+ processor, flexible clock running up to 133 MHz
  • 264KB of SRAM, and 2MB of on-board Flash memory
  • Castellated module allows soldering direct to carrier boards
  • USB 1.1 with device and host support
  • Low-power sleep and dormant modes
  • Drag-and-drop programming using mass storage over USB
  • 26 x multi-function GPIO pins
  • 2 x SPI, 2 x I2C, 2 x UART, 3 x 12-bit ADC, 16 x controllable PWM channels
  • Accurate clock and timer on-chip
  • temperature sensor
  • Accelerated floating-point libraries on-chip
  • 8 x Programmable I/O (PIO) state machines for custom peripheral support

The official pinout diagram (Pico R3 Pinout) is also given here for your reference:

The RP2040 is a dual-core Arm Cortex-M0+ microcontroller developed by the Raspberry Pi ASIC team. The name RP2040 is in fact a code detailing the features of the chip (and hinting at versions coming after). RP simply means Raspberry Pi. The 2 refers to the number of cores. The 0 to the type of core, in this case Arm Cortex-M0+.The 4 to the amount of RAM available, calculated using the equation floor(log2(ram/16k)). And finally, the trailing 0 is the amount of non-volatile memory available, again using the equation floor(log2(non-volatile/16k) and defaulting to 0 if none is available.

To make things easier, 26 general-purpose input/output (GPIO) pins on the RP2040 are brought out to the Pico’s headers. The Pico also includes a serial-wire debug (SWD) header, while the micro-USB port at the top of the board provides power and data, with a “BOOTSEL” button allowing the board to switch to a mass-storage mode for drag -and-drop loading of new and improved firmware. Also, it seems that a variety of accessories designed for the incredibly powerful RP2040 platform by Adafruit, Arduino, Pimoroni, and SparkFun are now available.

List of a few useful Rpi Pico links:

Key components used in the RPi Pico board (As seen in the official schematic Rev 3):

RP2040: Microcontroller (Raspberry Pi)

RT6150B: Current-Mode Buck-Boost Converter https://www.richtek.com/assets/product_file/RT6150A=RT6150B/DS6150AB-05.pdf

W25Q16JVUXIQ: 16 M-Bit Serial Flash Memory (SPI) https://www.mouser.in/datasheet/2/949/w25q16jv_spi_revg_03222018_plus-1489727.pdf

AEL12.0: 12MHz Clock Oscillator https://www.digchip.com/datasheets/parts/datasheet/000/AEL1210CSN-12_0MHZ-pdf.php

The hands-on approach

I was lucky enough to score some hands-on time with the Rpi Pico last month. In this session I am going to include a few guidelines for starting a quick play with your Pico board, based on my empirical experience of course. In my agile tests I used Windows 10 (x64) and followed both the official and unofficial online documentation to get started.

At this time, it’s worth noting again that while most microcontrollers can only be programmed in C or C++, the Pico also offers support for MicroPython which is a slenderized edition of Python that is specifically formulated for micro devices. This makes it a great cheerful choice for tyros who want to design and build their own devices but don’t have a keen interest to learn low-level programming.

Okay, let’s move on to the initial “soft” steps!

With MicroPython

At first, install the latest Thonny IDE on your Windows PC (https://thonny.org/). Now you’re now ready to move on to the next step and connect your Raspberry Pi Pico. You will probably need to add the MicroPython firmware. So, press the BOOTSEL button on your Raspberry Pi Pico and hold it while you connect the other end of the micro USB cable to your computer. This puts your Raspberry Pi Pico into USB mass storage device mode.

And then 0pen Thonny from your application launcher. In the bottom right-hand corner of the Thonny window, you will see the version of Python that you are currently using. Click on the Python version and choose MicroPython (Raspberry Pi Pico).

A dialog box will pop up to install the latest version of the MicroPython firmware on your Raspberry Pi Pico. Click the Install button to copy the firmware to your Raspberry Pi Pico. Note that you don’t need to update the firmware every time you use your Raspberry Pi Pico. Next time, you can just plug it into your computer without pressing the BOOTSEL button, and see it as a serial device in Windows Device Manager.

Now you can create a MicroPython program to blink the onboard LED on and off in a loop. Make sure that your Raspberry Pi Pico is connected to your computer, and click in the main editor pane of Thonny, enter the following code, and click the Run button to run your code.

from machine import Pin, Timer
led = Pin(25, Pin.OUT)
timer = Timer()
def blink(timer):
timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)

Thonny will ask whether you want to save the file on This computer or the MicroPython device. Choose MicroPython device, and enter blink.py as the file name.

Finally, you can see your program will blink the LED on and off until you click the Stop button (watch the quick test movie https://youtu.be/TEQZk6Baym0).

With C/C++

You need to download the Blink UF2 file (https://www.raspberrypi.org/documentation/pico/getting-started/static/85aac7081a166b7a3d0739970c3927c9/blink.uf2) . Thereafter, push and hold the BOOTSEL button and plug your Pico into the USB port of your computer as done before. Next, drag and drop the Blink UF2 binary onto the RPI-RP2 volume. Pico will reboot, and the onboard LED should start blinking. Here you can see the actual code https://github.com/raspberrypi/pico-examples/blob/master/blink/blink.c

Naturally, the first program anyone writes when using a new microcontroller is to blink an LED on and off. Since the RPi Pico also has a single on-board LED connected to GPIO pin 25, it’s pretty easy.

Note that the Raspberry Pi Pico board comes with a breadboard-friendly layout, but you’ll need to solder the requisite headers on yourself. The castellated holes on RPi Pico lets you solder it down as a module without needing to put any headers in, however it may not be so convenient for your simple try outs. So, now is the time to prove your selling skills!

Bottom Line

Even though I only played around with it a little bit, I was very impressed by the Raspberry Pi Pico. It’s an interesting piece of electronics indeed. The complete lack of wireless connectivity (Wi-Fi/Bluetooth) limits what can be achieved (we can establish a wireless network via an external module though). Moreover, the C workflow is a bit tricky, but programming in MicroPython is pretty easy, with integrated support with the beginner friendly Thonny Python IDE.

Arduino has built up an extensive development platform over the years. When it comes to open-source development, more minds are always better. Unsurprisingly, both the Arduino and Raspberry Pi platforms have their fair share of well-experienced users. So, with Arduino’s promised support for Raspberry Pi Pico, we can expect some miracles (https://www.seeedstudio.com/blog/2021/01/29/arduino-ide-support-announced-for-the-raspberry-pi -pico).

This is your time right now. Believe in yourself, and find out how far you can go. I will go build something that works. Good Luck!

Leave a Comment