A Raspberry Pi Pico is a popular microcontroller (MCU) option for hobbyists and IoT professionals alike. It holds a special place in the IoT world because of its small physical size paired with relatively high processing power and low energy consumption. Add to that the huge mainstream adoption of its larger siblings (Raspberry Pi 1 through 4) making Raspberry Pi hardware well-known throughout the IoT world. The Pico is also exceptionally cheap, especially compared to the siblings, and you can get started with one in just minutes. You don’t need extensive programming knowledge, and there’s enough documentation online to keep you busy experimenting for weeks on end.
Read on to learn about features, alternatives, projects, and resources for programming a Raspberry Pi Pico.
Raspberry Pi Pico family and features
The Raspberry Pi Pico isn’t just one microcontroller. It’s a family of high-performance MCU boards. These include the Raspberry Pi Pico, Pico H, Pico W, and Pico WH. The Pico and Pico H are nearly identical, the only major difference being that the Pico H comes with pre-soldered headers – meaning places to connect wires – whereas the Pico doesn’t. So if you want to attach wires to a normal Pico, you’ll have to solder the headers yourself.
The Pico W and Pico WH add an onboard Wi-Fi module that lets the device connect to the Internet. The only difference between the Pico W and Pico WH is again that the WH has pre-soldered headers.
All four options have the following features:
- RP2040 MCU
- Dual-Core Arm Cortex M0+ processor
- Clock speed of up to 133 MHz
- 264 KB of SRAM and 2 MB of flash memory
- One USB 1.1 port
- Low-power or dormant modes
- 26 General Purpose Input/Output (GPIO) pins
- Temperature sensor
- 2 x SPI, 2 x I2C, 2 x UART, 3 x ADC
- Eight programmable I/O state machines
All four Pico types also have an onboard LED, which will be important for your first project. If you already have some experience with IoT and MCUs, feel free to skip down to the next section. Otherwise, here’s a rundown of what some of those features mean and why they’re important.
Let’s start with the MCU. Most of the Raspberry Pi designs are single board computers (SBCs). They have high processing power for their size, and they can perform the same basic actions as your desktop computer. They typically use RaspberryOS, which is based on the Linux operating system. By contrast, a microcontroller board doesn’t have the ability to run a full operating system. So, while on your desktop or laptop, you can open up multiple applications, an MCU will only run one application at a time.
Consider a standard smart security camera. Its only function is to stream video, so it doesn’t need a full OS. Instead, the Raspberry Pi Pico operating system will be a real-time operating system (RTOS) that only performs one action at a time.
As far as a processor, the ARM processors are extremely popular for IoT and have the highest level of energy efficiency among the most common processor types. The M0+, which is the processor the Raspberry Pi Pico employs, is even more efficient than the typical ARM processor. The 133 MHz clock speed, meaning how fast the processor executes instructions, isn’t especially fast. Still, that speed is more than adequate for a typical IoT application. For reference, a smart fitness device with multiple sensors and functions might have an absolute maximum clock speed of around 300 MHz.
When the specs show 264 KB of SRAM and 2 MB of flash memory, what that means is that the device has 264 KB of memory that only remains on the device as long as there’s power. When the device is unplugged, turned off, or the battery runs out, that memory gets destroyed. Flash memory, by contrast, is memory that stays on the device even after the power is turned off. In other words, it’s the device’s data storage repository.
The Raspberry Pi Pico also has 26 GPIO pins. A pin is basically a small hole that lets you connect external devices. For example, there’s a pin that lets you connect an extra LED light to the board if you want.
SPI, I2C, UART, and ADC are each different types of input protocols/formats. Having a wide variety is what lets you use the Pico for so many different projects and applications. Finally, a programmable I/O state machine is an input/output component that you can program for all different functions and protocols. Having eight makes the Raspberry Pi Pico particularly flexible.
Alternatives to the Raspberry Pi Pico
While the Raspberry Pi Pico stands on its own as a great option for your projects, there are plenty of other options as well. Here’s how they line up against the Pico.
Raspberry Pi Pico vs. Arduino Uno
Compared to the Arduino Uno board, which has a similar physical size, the Raspberry Pi Pico has considerably more processing power and input options. For example, while the Pico has a max clock speed of 133 MHz, the Arduino Uno only goes up to 16 MHz. It has only 32 KB of RAM and just 16 KB of flash memory. The Uno also has fewer I/O pins than the Pico, higher power consumption, and a higher price. The Arduino Uno is still a popular choice, in large part because it’s compatible with Arduino’s large suite of open source tools, libraries, and the Arduino Integrated Development Environment (IDE).
Raspberry Pi Pico vs. Zero
The Raspberry Pi Zero is a full-fledged computer in its own right, with an onboard microprocessor (MPU) rather than an MCU. It can run multiple applications simultaneously, and it has a high clock speed and 512 MB of RAM along with 8 GB of flash memory, plus 40 I/O pins to the Pico’s 28. It’s also the smallest Raspberry Pi MPU available. However, it has a considerably higher power consumption than the Raspberry Pi Pico, and it’s considerably more expensive: $15 while the Pico costs just $4.
Raspberry Pi Pico vs. ESP32
Espressif’s ESP32 MCU family is small and has around twice the processing power and speed of the Pico. While the exact specifications vary among the MCUs in the family, they generally have two additional I/O pins and twice the flash memory compared to the Pico. However, they also consume double the energy and are nearly twice as expensive. So the Pico is probably preferable for a first project. Also the ESP32 is a commercial project whereas the Pico is backed by the Raspberry Pi Foundation, a registered charity with the aim to educate.
Programming a Raspberry Pi Pico
Let’s consider a simple starter project. Just as software programmers traditionally start by writing a simple program to print “Hello World,” hardware programmers traditionally start by writing a simple program to get a light to blink on and off. In this case, you’ll set up the Raspberry Pi Pico to blink a light on and off at set intervals.
To do that, you’ll need to write some code. A Raspberry Pi Pico responds to a variety of coding languages, including C, C++, and MicroPython. MicroPython is a more lightweight and simple version of traditional Python, and it is the most common language used by Raspberry Pi Pico hobbyists. So if you know Python already, it should be easy for you to get started with MicroPython on the Raspberry Pi Pico, and you shouldn’t have any trouble with this starter project.
What you’ll need: hardware
For this project, you won’t need anything but the board and a USB cord. You’ll use your computer to provide power and to program the device. If you want to continue using the Pico for other projects, however, you’ll need to connect it to an external power source so it still works when it’s not plugged into your computer.
Alternatively, you can get a Raspberry Pi Pico starter kit on Amazon or another site. The kit will typically provide the Raspberry Pi Pico MCU board, a USB cable, a breadboard, some LEDs and resistors, and tutorial resources of some kind. A breadboard is just a plastic board with holes. You can plug the Pico into it and then connect other electrical components to the board as well, including a power source.
What you’ll need: software
You’ll also need to have certain software installed on your computer for Raspberry Pi Pico programming. Most projects use the Thonny Integrated Development Environment, which you will need to download and install. Next, download the MicroPython file to your computer, and you’re all set to start programming.
Step 1: Connect to your computer
Connect your USB cord to the USB port on the device. Then press the small white button on the Raspberry Pi Pico board – called the boot selection button – and plug the other end of the USB into your computer while still holding the button down. You can release the button after the device is connected to your computer. In your file explorer, you should see a new connected device called “RP1-RP2.”
Step 2: Install MicroPython on the Pico
Copy the MicroPython file you downloaded. Open the RP1-RP2 device in your file explorer and paste the MicroPython file there.
Step 3: Set the interpreter for Thonny
Open the Thonny software. Under the Run toolbar, click “Select Interpreter.” There will be a dropdown menu with many options, one of which will be “MicroPython (Raspberry Pico).” Select that and click “OK.”
Step 4: Write your program
Type or paste the following code into the main window of the Thonny software:
led = machine.Pin(25, machine.Pin.OUT)
This code will cause the LED light to be on for one second and then off for one second in an infinite loop, or until the device is unplugged.
Step 5: Run program
Next hit the run button, which has a play symbol on it. A popup will ask you where you want to save the file. Click “Raspberry Pi Pico”. When you name the file, make sure to add .py at the end so that the MCU recognizes the language as MicroPython. You might, for example, name it LED.py. However, if you want the file to automatically run every time you plug in the device, name it main.py. This will tell the Pico that it’s the only program it needs to pay attention to and that it should immediately run the program on startup. Next click “OK.” Now your light should be blinking at regular intervals. Congratulations on successfully completing your first programming project on your Raspberry Pi Pico.
More Raspberry Pi Pico projects
Of course, you don’t have to stop at just making a light blink. There are some other great starter projects listed below.
Raspberry Pi Pico camera
You can set up the Raspberry Pi Pico to run a smart camera and stream video. Nabto has a video streaming app that bypasses firewalls and provides the lowest level of latency possible. Read our guide for a detailed explanation of how to connect the Raspberry Pi video camera to your smartphone so you can control it directly through a secure connection. The app and Nabto’s SDK are open source, so you can make changes as desired.
Raspberry Pi Pico display
One interesting project for a Raspberry Pi Pico is attaching an electronic display directly to the board and programming the display. You could use the display to count off seconds like a stopwatch, or you could use it to display the temperature based on the temperature sensor data. You can even program the display to show certain shapes at certain intervals. It will, however, require some extra wiring and tools to work properly, and you’ll need a more advanced knowledge of Python.
Raspberry Pi Pico programmable logic controller (PLC)
A programmable logic controller (PLC) is a small device that can automate certain industrial processes. For example, it can automate repetitive tasks performed by machinery in an automotive factory. You can create a simple version of a PLC with a Raspberry Pi Pico using special open-source software called Beremiz4Pico, though your device will have some limitations compared to a typical industrial-level PLC. Most PLCs have more I/O pins than the Pico to support enhanced functionality across a variety of automation use cases.
The Raspberry Pi Pico is a cheap and easy option for anything from learning programming to prototyping to creating IoT devices from scratch. Its flexible design provides endless possibilities for projects that will keep you busy for some time to come.