Getting Started with Raspberry Pi Pico: A Comprehensive Guide

关注、星标公众号,直达精彩内容




At the end of January 2021, the Raspberry Pi Foundation announced a major news release, launching the Raspberry Pi Pico, which ventures into the microcontroller field.

The Pico has attracted the attention of makers worldwide due to its powerful features and low price. This article will introduce you to this little gadget called Pico.

The original article comes from DroneBot Workshop, run by a very friendly grandpa. Those who can should follow him on YouTube.

This article uses MicroPython to program the Raspberry Pi Pico, so let’s see what this thirty-dollar microcontroller can do.

Introduction

The release of a microcontroller by the Raspberry Pi Foundation is a big deal, especially since this manufacturer of the world’s most popular single-board computer had never shown interest in microcontrollers before.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

Not only was the announcement of the Raspberry Pi Pico surprising, but the Raspberry Pi also created a new chip themselves. They did not base it on existing designs like ESP32 or SAMD21, but chose to create their own microcontroller.

So when it comes to the Pico, we are all beginners.

The Raspberry Pi also released a ton of technical documentation on their website, including a manual titled “Get Started with MicroPython on Raspberry Pi Pico.” It is available in both print and PDF versions for download.

Besides this, there is currently no deeper information available about the Pico. However, as time goes by, this situation will change quickly; the Raspberry Pi has authorized other manufacturers, including Adafruit, to use the RP2040 chip in their designs. In due time, this will bring us more code and development tools.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

Let’s first try connecting a bunch of things to the Pico and see what interesting things happen!

Raspberry Pi Pico

The Pico is a small board, about the size of an Arduino Nano. Like all Raspberry Pis, the packaging is very simple; it’s just the Pico inside a plastic wrapper, which is cut from a roll of packaging that looks very much like the packaging of the shrimp chips or candies we used to eat as kids.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

Let’s take a look at the Pico board

The Pico bought from the store is just this bare board, nothing more, it’s very environmentally friendly.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

The bare board does not come with pins, and you need to solder them yourself. This is a well-made circuit board that can also be used as SMD components, directly soldered to a printed circuit board.

Top View

From the top, the Pico looks like this.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

The main feature on the board is a microUSB connector at one end. It is used for both communication and powering the Pico.

Next to the microUSB connector is an onboard LED, which is internally connected to GPIO pin 25.

It’s worth noting that this is the only LED on the entire Pico board.

The power button is located a little lower than the LED, allowing you to change the Pico’s boot mode so you can load MicroPython and do drag-and-drop programming on it.

At the bottom of the board, you will see three connection points for serial debug options; we are focusing on the basics today, so we won’t go into this now, but advanced developers will be more interested.

In the center of the board is the “brain” of the entire board—the RP2040 MCU, which we will explore soon.

Ground Pins

There are several ground pins on the board, eight ground pins plus one additional ground pin on the three-pin debug connector.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

These pins are easy to spot; they are evenly spaced and square, unlike other connections which are round.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

One of the ground pins located at pin 33 is also designated as an analog ground.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

Power Pins

The Pico is a 3.3V logic device, but it can be powered by a range of power supplies due to its built-in voltage converter and regulator.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

All power-related pins are grouped together, near the microUSB connector.

  • VBUS – This is the power from the microUSB bus, 5V. If the Pico is not powered by the microUSB connector, there will be no output here.
  • VSYS – This is the input voltage, ranging from 2 to 5V. The onboard voltage converter will convert this to 3.3V for the Pico.
  • 3V3 – This is the 3.3V output from the Pico’s internal regulator. It can be used to power other components as long as the load remains below 300mA.

There are also several inputs that allow you to control the Pico’s power.

  • 3V3_EN – You can use this input to disable the Pico’s internal voltage regulator, thus shutting down the Pico and any components powered by it.

  • RUN – This can enable or disable the RP2040 microcontroller or reset it.

GPIO Pins

The Raspberry Pi Pico board has 26 exposed GPIO connections.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

The arrangement is nice, with a “gap” between GPIO 22 and GPIO 26 (these “missing” pins are used internally).

These pins have multiple functions, and you can configure up to 16 pins for PWM.

There are two I2C buses, two UARTs, and two SPI buses, which can be configured to use various GPIO pins.

Analog Pins

The Pico has three analog-to-digital converters, plus one internal converter for the onboard temperature sensor.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

The ADC has a resolution of 12 bits.

You can also provide an external precision voltage reference on the <span>ADC_VREF</span> pin. One of the ground points, specifically ADC_GND on pin 33, is used as the ground point for this reference.

RP2040 Microcontroller

The Raspberry Pi Pico is designed around the foundation’s new RP2040 microcontroller. Here are its specifications:

  • Dual-core 32-bit ARM Cortex-M0+ processor
  • Runs at 48MHz but can be overclocked to 133MHz.
  • 30 GPIO pins (26 exposed)
  • Supports USB host or device mode
  • 8 programmable I/O (PIO) state machines

The RP2040 can support up to 16MB of external flash memory, but the Pico only has 4MB.

The Raspberry Pi Foundation has many plans for this chip and has already authorized many other manufacturers.

Programming the Pico

You can get started with the Pico using one of two programming languages.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide
  • MicroPython – An interpreted language designed specifically for microcontrollers.
  • C++ – Many microcontroller users are familiar with C++ as it is used on Arduino and ESP32 boards.

While I was eager to use C++ with the Pico to extract every ounce of performance, I decided to go with MicroPython, like most people. In this early development phase, C++ tools are still in the final stages of development, and we look forward to the Pico being part of the PlatformIO and Arduino IDE board series.

Getting Started with Pico

When we received the Pico board, it was packaged in a plastic carrier with no extra parts.

Unless you plan to surface mount the Pico or your sole purpose is just to light up an LED, we all need some pins.

The Pico has 40 pins, 20 on each side. There are also three pins for the debug port.

A standard header pin has 40 pins, so you can halve one of the pin headers to use as the Pico’s pins. If you want to install pins on the debug connector, you will need another 3-pin header, either straight or 90 degrees.

Soldering a Pico

Before we can start programming the Pico, we need to do some soldering! Besides the DuPont header pins, we will also need a suitable soldering iron and some solder.

The soldering iron tip needs to be fine, and we will also need a clean sponge and a stand.

Additionally, we need a way to hold the Pico while soldering the pins, as they need to be installed at a precise 90-degree angle to fit into a breadboard without solder.

Many experiments use a breadboard to hold the pins; while this method works, it can potentially damage the breadboard due to heat or solder splashes.

So the best solution is to have an old breadboard to use as a pin holder.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

I personally prefer using a few cheap perfboards or prototyping boards. When I say “cheap,” I mean single-sided ones with no perforations, only one side being bare copper.

Two of these are great for holding the pins, and I often use them when I need to solder a small module or microcontroller.

Heat the soldering iron to a suitable temperature and heat the connection between the pin and the pad, applying solder on the other side; make sure not to apply solder directly to the soldering iron. Heat the component, not the solder.

If you want to solder the 3-pin debug connector (which is optional), you should probably do this first. The orientation of these pins is opposite to that of the GPIO pins. I used a small sticky pad to hold the board since the debug connector does not align with the GPIO pins on the grid.

Then it’s time to solder the 40 pins, 20 at a time! It really doesn’t take long; just use as much solder as necessary, avoiding solder bridges, and check it afterward.

Cleaning the Pico After Soldering

I like to clean my PCBs after soldering to remove the flux and resin from the solder core. This appears as brown stains around the solder joints.

This step is entirely optional, as the flux and resin do not adversely affect the operation or lifespan of the components. It just looks better!

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

If you want to clone your board, you will need some PCB cleaning agent or flux remover. Since it often leaves a little residue, I use isopropyl alcohol for cleaning.

PCB cleaning agents can be purchased online. Isopropyl alcohol can be found at your local pharmacy; be sure to buy a mixture that is pure alcohol and water (70%), not scented.

I work with an old toothbrush and some plastic containers in a basin. Remember to prepare a mask, gloves, and goggles.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

I scrub the pins with the toothbrush dipped in PCB cleaner and then rinse with isopropyl alcohol using the toothbrush.

Getting Started with Raspberry Pi Pico: A Comprehensive Guide

Let the board air dry naturally, or use an air hose, and afterwards, we will have a shiny new Pico!

Pico and Thonny IDE

Now that the Pico pins are connected, we can start experimenting with it.

I recommend placing it on a breadboard to prepare for our upcoming experiments.

While there are many IDEs we can choose to work with our new Pico, my recommendation is to use the Thonny IDE recommended by Raspberry Pi.

Thonny IDE

Thonny claims to be

Leave a Comment

×