Raspberry Pi Pico Guide: Basics, Programming and Uses (2024)

Raspberry Pi Pico Guide: Basics, Programming and Uses (1)

Raspberry Pi Pico is the first microcontroller board from the Raspberry Pi Foundation. It is built around the RP2040 chip, and comes with 264KB of on-chip RAM as well as 2MB of on-board flash memory for storing and writing code. Compared to the Raspberry Pi, Pico is mainly designed to interact with hardware, it is smaller, cheaper and has lower power consumption, you can think of it as an alternative to the Arduino in some ways.

To make things easier, we have rounded up its features, variants, use cases and resources. Besides we also did some comparisons for your comprehensive understanding.

Raspberry Pi Pico

The Raspberry Pi Pico is a budget-friendly, high-performance microcontroller development board with versatile digital interfaces. It's equipped with the RP2040 chip and comes with 264KB of on-chip RAM as well as 2MB of on-board flash memory, and boasts up to 26 multifunctional GPIO pins.

Here are the main features:

  • Dual-core cortex M0+ processors at up to 133MHz.
  • 264kB of SRAM, and 2MB of on-board flash memory
  • Designed with castellated edges for direct soldering onto user-designed PCBs.
  • Supports USB 1.1 host and device modes.
  • Two low-power modes: dormant and sleep.
  • Drag-and-drop programming using mass storage over USB
  • Offers up to 26 multifunctional GPIO pins.
  • Includes 2 SPI, 2 I2C, 2 UART, 3 12-bit ADC, and 16 controllable PWM channels.
  • Features precise onboard clocks and timers.
  • Includes a temperature sensor.
  • Provides onboard hardware floating-point libraries.
  • Incorporates 8 programmable I/O (PIO) state machines for custom peripheral support.

Raspberry Pi Pico Pinout

The key to unlocking Pico's full potential lies in understanding the pinout - the arrangement of pins that serve as the interface between the board and various components.

The Raspberry Pi Pico comes with 40 pins that can be used to connect electronic components. Of those 40 pins, 26 are programmable GPIOs that you can use to connect peripherals like sensors, motors, and LEDs, or even establish communication with other microcontroller boards.

  • 3 power pins: 3V3 (OUT), VSYS, and VBUS, all are marked as red on the pinout diagrams.
  • 26 programmable 3.3V GPIOs pins. They are are numbered from GP0 to GP28 and colored in a light green color on the diagrams.
  • 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, 16 × controllable PWM channels
  • 8 × Programmable I/O (PIO) state machines for custom peripheral support.
  • Castellated module allows soldering directly to carrier boards.
Raspberry Pi Pico Guide: Basics, Programming and Uses (2)

Raspberry Pi Pico Models

The Pico family has four models for now, the PICO series addresses the gap in the microcontroller field for Raspberry Pi. It is based on the RP2040 chip and comes in four variants.

  • Pico: The original Pico
  • Pico H: Has pre-soldered headers for prototyping and experimentation
  • Pico W: Has inbuilt Wi-Fi and Bluetooth support
  • Pico WH: Has both pre-soldered headers, inbuilt Wi-Fi, and Bluetooth support

Among them, standard Pico and Pico H are almost identical. Standard Pico serves as a castellated module that allows soldering directly to carrier boards, while the Pico H comes with pre-soldered headers. (i.e., places to connect wires). Therefore, if you want to connect wires to a regular Pico, you will need to solder the headers yourself.

The Raspberry Pi Pico W and Pico WH have added Wi-Fi features based on the original Pico, hence the W, making the two more suitable for IoT applications and networking needs.

The pinout for the different models is very similar, the only difference is the GPIO pin that controls the onboard LED and the location of the debug pins.

Raspberry Pi Pico Guide: Basics, Programming and Uses (3)
Pico models comparison
ModelMain ChipVoltage RegulatorUSBFlashRAMFeature
PicoRP2040DC-DC, 800mAMicro USB2MB264KB
Pico HRP2040DC-DC, 800mAMicro USB2MB264KBPre-soldered headers
Pico WRP2040DC-DC, 3000mAMicro USB2MB264KBOnboard WiFi, Bluetooth support
Pico WHRP2040DC-DC, 3000mAMicro USB2MB264KBOnboard WiFi, Bluetooth support, pre-soldered headers

Programming with Raspberry Pi Pico

Pico uses a convenient drag-and-drop programming approach: simply connect Pico to the computer via USB, and the computer will recognize Pico as a high-capacity storage device. You can then drag and drop programming files into it to complete the program writing process.

Before programming, choose your language first, you can use one of the following based on your preference and application:

  • MicroPython - A python variant made specifically for microcontrollers, recommended by Raspberry Pi.
  • C/C++ - Many microcontroller users are familiar with C++ as it is used on the Arduino and ESP32 boards!

Raspberry Pi website offers both Pico C/C++ SDK and Pico Python SDK, providing step-by-step tutorial to get started with your Pico coding journey.

Beginners can code their Pico effortlessly using MicroPython, while experienced coders have the option to stick with C or C++.

After picking your preferred language, the next step is to select your development tool. Your choice will vary depending on your selected language. If you go for C/C++, Visual Studio Code(VS Code) and Arduino IDE are ideal options. If you like to work with MicroPython, Thonny or VS Code is suitable for you. All of these IDEs can work on Windows, MAC and Linux.

Thonny is a compact and user-friendly Python IDE (Integrated Development Environment) that is well-suited for beginners. It has a simple infrastructure for extensions and includes some known plug-ins. Its debugger is designed specifically for learning and teaching programming, some of its features were proposed and supported by the Raspberry Pi Foundation. You can write MicroPython programs directly in Thonny and upload them to Pico for execution. Plus, it comes with the latest stable Python, so there's no need for additional Python download and installation, making it very convenient for beginners.

VS Code offers excellent support for multiple programming languages and a wide range of features, including Git integration, debugging tools, and extensions that allow you to customize your workflow. If you are using both C++ and Python, VS Code is a better choice without the cost of switching between different IDEs caused by different languages. Plus, its rich and powerful extensions will undoubtedly speed up your development and streamline your coding experience!

When developing with the Pi Pico, it is often necessary to reset the board. This is typically due to one of the following reasons:

  • Debugging or restarting the code so that it can start executing from the beginning.
  • Restarting due to a communication issue with the computer via USB.
  • Switching to mass-storage mode to enable dragging and dropping of a new UF2 file.

Since Raspberry Pi Pico does not have a reset button, making it inconvenient for users to programming, in which case using a Pico expansion board will be helpful.

Raspberry Pi Pico Guide: Basics, Programming and Uses (4)

Datasheets and Tutorials

For your reference, below we made a list containing various Pico relevant datasheets and resources.

Programming

Raspberry Pi Pico vs Raspberry Pi

In a nutshell, Raspberry Pi is a single-board computer(SBC), while Raspberry Pi Pico is a type of microcontroller(MCU). Raspberry Pi specializes in computing and the Pico is more focused on control.

Unlike Raspberry Pi, Pico is mainly designed for embedded applications due to its ability to interact with hardware. Specifically, Pico is typically used for electronic work related to controlling electronic components such as motors, and sensors. You can use it as a standalone development board or as a complement to Raspberry Pi.

While Pico cannot be used as a personal computer, it is ultra-compact and budget-friendly, making it ideal for those who want to enjoy doing some electronic-related work.

We sum up some of its main differences/advantages as follows:

OS-free. Pico doesn't have an onboard operating system, nor does it have an SD card slot used for OS installation or storage. It is more stable compared to OS-driven boards, leading to faster response times and lower system overhead.

Faster bootup. Pico can boot up quickly and switch faster between working and sleep mode. Besides, it doesn't require a proper shutdown when powering off, allowing you to simply turn it on again to resume working.

Lower latency. As a single-board computer, the Raspberry Pi is largely designed for general-purpose computing, leading to additional latency in handling GPIO pins, whereas the Pico doesn't have to worry about OS overheads, allowing it to maintain low-latency GPIO operations.

Lower power consumption. Pico has an impressive power consumption of only 6 milliwatts in sleep mode. In contrast, even the most energy-efficient Pi Zero model in its low-power mode still consumes at least 100 milliwatts of power.

Below, let's take a brief look at the comparison of Raspberry Pi Pico and the typical Raspberry Pi models

ModelReleasedWiFi/BluetoothCPURAMPrice
Raspberry Pi Pico2021-01NoDual-core 133MHz264KB$4
Raspberry Pi Zero W2015-11YesSingle-core 1GHz512MB$15
Raspberry Pi 4 model B 4GB2019-06YesQuad-core 1.5GHz4GB$55

Raspberry Pi Pico vs Raspberry Pi Zero

Raspberry Pi Pico Guide: Basics, Programming and Uses (5)

Of all Raspberry Pi modules, the Pi Zero and Pico are the most affordable and the smallest ones. Despite being almost the same size, the Raspberry Pi Zero and Pico are different in their nature. The main difference is that the Zero tends to be a mini computer while the Pico is a controller. Both are suited for small-scale projects, IoT, and embedded applications.

The Raspberry Pi Zero comes in three versions. The Raspberry Pi Zero is the basic version without Wi-Fi and Bluetooth capabilities. The Raspberry Pi Zero W is the network version, with a built-in wireless network card and support for Bluetooth and Wi-Fi functions. The Raspberry Pi Zero WH is based on the Raspberry Pi Zero W but comes with pre-soldered 40-pin headers, making it convenient for user debugging and usage.

Here's a handy table to compare the two.

Raspberry Pi Zero WRaspberry Pi Pico W
Dimension65 x 30mm51 x 21mm
CPUSingle-core processor at 1GHzDual-core at 133MHz
RAM512MB264KB
StorageUp to 1 TB with an SD card2 MB
Pins40 GPIO pins40 pins, 26 of which are programmable GPIOs
ConnectivityBuilt-in Wi-Fi and BluetoothWi-Fi and Bluetooth
Price$15$6
Operating SystemLinux, RaspbianNo
PurposesGeneral-purpose computing and desktop applicationsEmbedded systems and microcontroller projects

With dormant and sleep of two low-power modes, the Raspberry Pi Pico consumes a minuscule amount of power compared to the Pi Zero. If your project doesn't demand the additional processing power of the Raspberry Pi Zero, opting for the Raspberry Pi Pico can help minimize power consumption. This makes it a more suitable choice for straightforward, portable projects powered by a battery pack.

Raspberry Pi Pico vs Arduino

Speaking of microcontrollers, many probably will think of the Arduino, so we compared the Raspberry Pi Pico with the Arduno NANO.

Raspberry Pi Pico WArduino NANO
Dimension51 x 21mm45 x 18mm
CPUDual-core 133MHz1 core at 16MHz
Frequency (Clock Speed)125 MHz by default16MHz
RAM264KB32KB
Flash Memory2MB32 KB of which 2 KB used by bootloader
Operating Voltage1.8 - 5.5V5V
Wireless ConnectivityWi-Fi, BluetoothWi-Fi, Bluetooth
Pins40 pins, 26 of which are GPIOs30 pins, 14 of which are 14 digital pins that can be used as GPIOs.
Analog I/O Pins38
Development LanguagesMicroPython, C/C++Arduino (based on C/C++)
IDEThonny, VS CodeArduino IDE

With expansive and active community support, both Arduino and Raspberry Pi Pico are great for physical computing projects and IOT, which is more suited for you? It comes down to you and specific needs. If you have experience with Python, Pico could be your go-to option. If you are comfortable with C/C++, both Pico and Arduino are viable choices.

If your project demands complex computations and high performance, then Pico is the way to go. On the other hand, if you prioritize real-time responsiveness, low power consumption, and simple control, then Arduino Nano is a great pick!

Raspberry Pi Pico Guide: Basics, Programming and Uses (6)

Python vs MicroPython

Python is a general-purpose programming language widely used in fields such as data analysis, artificial intelligence, web development, scientific computing, and more. Python interpreters typically run on desktop or server operating systems, often requiring substantial computational resources and storage space.

MicroPython is a lightweight version of Python designed for running on embedded systems. Compared to regular Python, MicroPython interpreter only has a small footprint of around 100KB, is compiled into a binary executable for efficient execution, and is optimized for high performance. It uses a lightweight garbage collection mechanism and removes most of the Python standard library to accommodate the resource constraints of microcontrollers.

MicroPython can run on microcomputers, microcontrollers, and other resource-constrained devices. Compared to Python, MicroPython consumes fewer computational resources and requires less storage space, making it better suited for embedded systems, IoT, and other resource-limited application scenarios.

Additionally, MicroPython offers some specialized features and libraries, such as direct access to hardware resources, support for multitasking and coroutines, among others. Therefore, if you need to program with Python on embedded devices, MicroPython is an excellent choice. However, if you require tasks involving large-scale data processing, web application development, and similar tasks, then Python would be the more appropriate choice.

Related questions

What is a Raspberry Pi Pico used for?

Pico is typically designed for embedded applications, controlling electronic components such as motors, and sensors. It is better suited to running simple tasks in basic electronics projects. It can be used for physical computing learning, electronics projects, remote controls, and smart home applications, etc. You can use it as a standalone development board or as a complement to Raspberry Pi.

Can Raspberry Pi Pico run Linux?

Pico does not support the direct installation of Unix/Linux operating systems. As a microcontroller built largely for embedded systems, Pico's main purpose is to execute a specific application or function without the need for a complex operating system.

While you can't install Linux on Pico, it does support another Unix-like operating system called Fuzix, which is a minimal Linux-like operating system designed for less capable processors.

How to power Raspberry Pi Pico?

Pico's safe operating voltages are between 1.8V and 5.5V, allowing it to be powered from various sources. One handy way is to connect the micro-USB port to a laptop, desktop, or Raspberry Pi computer by a micro-USB to USB cable. If you want to run your Raspberry Pi Pico without a computer, you need to use a USB power supply or a suitable battery pack and connectors, such as a single Lithium-Ion cell, a two or three cell battery pack or a battery pack with a micro-USB to USB cable.

The Pico can be powered through the onboard micro-USB port or GPIO pin 39 (VSYS), it has two input voltages:

  • VBUS (USB Power Input): The micro-USB input voltage, which is usually 5V
  • VSYS (External Power Input): The main system input voltage, which can range from 1.8V to 5.5V

You can find detailed step-by-step practice on the Raspberry Pi website.

Can Raspberry Pi Pico run Python?

Yes. More specifically, it runs codes written with MicroPython. To run Python programs in Pico, you typically write your Python codes with MicroPython and upload them to Pico. MicroPython is a lightweight Python branch optimized for smaller microcontrollers like Pico. It provides several helpful specialized packages and rich APIs for directly controlling the microcontroller's GPIO, I2C, SPI, and various other hardware resources.

What is a Single Board Computer(SBC)?

A Single Board Computer is a type of computer that integrates a CPU, memory, storage, and interface components on a credit card-sized printed circuit board. It is highly compact yet powerful, making it very popular for various purposes, such as education, embedded applications, IoT and DIY projects. Like a typical computer, a single board computer has an operating system and requires external power to work.

Common known SBCs include the Raspberry Pi and Nvidia Jetson Series. The former is widely used for education, programming and DIY projects, and the latter is mainly designed for AI and edge computing.

In appearance, a single board computer is just a tiny bare motherboard. Its most noticeable difference from regular computers lies in the absence of peripherals such as a screen, mouse, keyboard, and casing. Equipped with peripherals, some of SBCs like Raspberry Pi can be used as an ordinary PC.

What is a Microcontroller(MCU)?

A microcontroller is a small computer system that integrates a chip, timers, various input/output devices, and limited memory and storage space. It is typically designed for embedded systems to control specific tasks or functions. Due to its compact design and low power requirements, it is often used in a wide variety of electronic devices such as home appliances, automotive systems, industrial controls and embedded systems. Common MCUs include Arduino, SMT32 and Raspberry Pi Pico.

The biggest distinction between an SBC and a microcontroller is that SCB focuses on computing, while the microcontroller leans more towards control. Also, SBCs can run multiple tasks at once, whereas microcontrollers typically run only one task repeatedly.

Microcontrollers work without an operating system, start up quickly, consume less power, usually run a single program, and focus on a specific task and light-duty applications.

Raspberry Pi Pico Guide: Basics, Programming and Uses (2024)

References

Top Articles
Latest Posts
Article information

Author: Sen. Emmett Berge

Last Updated:

Views: 5870

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Sen. Emmett Berge

Birthday: 1993-06-17

Address: 787 Elvis Divide, Port Brice, OH 24507-6802

Phone: +9779049645255

Job: Senior Healthcare Specialist

Hobby: Cycling, Model building, Kitesurfing, Origami, Lapidary, Dance, Basketball

Introduction: My name is Sen. Emmett Berge, I am a funny, vast, charming, courageous, enthusiastic, jolly, famous person who loves writing and wants to share my knowledge and understanding with you.