WHAT IS RASPBERRY PI PICO AND HOW TO GET STARTED WITH IT

This blog takes a look at how one can get started with the Raspberry Pi Pico, a low-cost, high-performance microcontroller board with flexible digital interfaces

What is Raspberry Pi Pico? If you are a young maker, chances are you already know about the Raspberry Pi. The Raspberry Pi Pico then is the latest offering from the manufacturers of the Raspberry Pi. In this blog, we shall take a look at Raspberry Pi Pico, its key features (including hardware and software specifications), its pinout, how one can set it up and even light an LED using it.

What is Raspberry Pi Pico?

Raspberry Pi refers to a series of small single-board computers developed in the United Kingdom by the Raspberry Pi Foundation in association with Broadcom. The boards have been made keeping in mind the promotion of teaching basic computer science to kids. The latest offering by Raspberry Pi is the Raspberry Pi Pico, a new flexible IoT board. Essentially, it is a microcontroller board built on silicon and designed at the Raspberry Pi Foundation.

Priced at merely $4, Raspberry Pi Pico is smaller than the average Pi and indicates how the foundation is now looking to branch out into microcontrollers and custom silicon.

Raspberry Pi Pico pinout

In order to use it well, it is recommended to get well acquainted with the Raspberry Pi Pico pinout. The diagram below explains this.

Raspberry Pi Pico projects

As a microcontroller, the Raspberry Pi Pico can be used in many projects, be it Internet of Things (IoT), Adafruit Neopixel projects, data logging, small to medium scale robotics, projects needing interfacing with cameras, analog sensing (using environment sensors) and more.

Raspberry Pi Pico unboxing, setting up and first program (lighting an LED)

The Raspberry Pi Pico comes in a small pouch. Once we open it, we see that it comes as a bare chip without any of the headers on.

Next step is soldering on the headers.

Now that the headers are on the Raspberry Pi Pico, we are ready to connect it to our laptop with the USB cable and get started with some programming.

How to program Raspberry Pi Pico

The first step now is to hold down or push the white colored boot button that you find on the Pico and then plug the other end of the USB cable into your laptop. This could be a Mac, a Raspberry Pi or a Windows PC.

Now that the Raspberry Pi Pico is connected to the laptop through the USB cable, it will show up like a USB mass storage on your laptop. It will have an INDEX.HTM file inside it and an INFO_UF2.TXT file.

Now what coding language does Raspberry Pi Pico use? The answer is MicroPython. And to get MicroPython onto it so that we can start writing our code, what we need to do is look up ‘getting started with the Raspberry Pi Pico’ online. The top search result should lead us to the Raspberry Pi website.

Right up at the top, you’ll see three options: first, there’s the board specifications and the Raspberry Pi Pico pinout diagram (that we have already shared above) that one can refer to while building one’s circuits.

What we need to look at is the Getting started with MicroPython section.

In this section, you will see a Download UF2 file button. Click on it and drag and drop it into the USB mass storage folder.

It will now automatically configure itself such that we can run MicroPython on it.

The next thing we need is IDE to write our code and for this the Thonny IDE is recommended. So you search online for Thonny, click on the first link and then you have different versions that can be downloaded depending upon your operating system (OS).

Bear in mind it comes already installed on the Raspberry Pi. Since we are here using a Windows OS, we shall download the version for Windows. It’s a small installation.

Next step is setting up Thonny real quick. It works with the Raspberry Pi Pico out of the box. We just need a small setting to be configured. Accept the defaults here.

One can even create a desktop icon. Now go ahead and launch the Thonny IDE. First thing we need to do is to go Run and choose Select interpreter.

Now in the dropdown you will find an option called MicroPython (Raspberry Pi Pico). Select it.

You can leave the port to be detected automatically, just click on OK.

At this point, it will show MicroPython on the shell. This tells you that it’s connected and now one can code on the Pico.

For us to write our code, we will start a new file and type — from machine import Pin.

You can refer to this in the MicroPython SDK document that’s available on the Raspberry Pi website (https://www.raspberrypi.org/).

Let’s also import the time module, which will be useful while blinking the LED.

Next we will create a variable for the LED and first we will blink the LED that is on the board and for this we create an object of type pin. The onboard LED is at pin 25.

Let us now turn on this LED by typing led.value(1)

Next we give it a second’s delay. Then we type led.value (0)

At this point, you will be able to see the LED on the board blink.

Now that we have gotten the Raspberry Pi Pico’s inbuilt LED to blink, our next task is to blink an external LED using MicroPython. For this, we need an LED, a resistor of at least 220–330 Ohms and two male-to-male jumper wires.

First connect the LED across the middle of the breadboard with the anode to your left and the cathode to the right.

Connect the resistor to the right of the cathode and plug it in to the ground rail on the side.

Next you connect the ground pin — refer to the pinout diagram for Raspberry Pi Pico to know the ground pins — to the right of the board (from the user’s POV) and thus the third from the bottom. Plug into the side such that the entire rail is ground.

Then use GPIO 15 which is the last pin to the user’s left and connect it to the anode of the LED.

To use a different pin, we shall write the code for led1 at GPIO 15.

Now let’s make a program where the LED continues to blink until we stop it. We can also say here led1.value(1) and turn it off in the same way and run it.

Now we will see the LED on the breadboard blink every one second.

So in conclusion, the Raspberry Pi Pico is an interesting and easy-to-use device. The advantage of being able to write and run Python code makes it an appealing choice, one that can be used as part of many maker adventures.

Here’s a video outlining the above steps about the unboxing, setting up and writing the first program to blink an LED using the Raspberry Pi Pico:

Raspberry Pi Pico first impressions:

What are the key features of the Raspberry Pi Pico? We shall look at them in this section. Firstly, what language is Raspberry Pi Pico? It is important to know that Raspberry Pi Pico can be programmed using either C/C++ or MicroPython and there is IDE support for Visual Studio Code and Eclipse.

Raspberry Pi Pico: Meant for makers

What is particularly interesting is the fact that it is the first time that a hobby chip has been designed to run Python well. It is completely oriented towards maker needs, putting it in the same category as development boards by Arduino, Adafruit, Sparkfun and Pimoroni. What’s more, you can directly integrate/ solder the Pico onto your own board thanks to its castellated edges.

Raspberry Pi Pico Specs

Raspberry Pi Pico hardware:

On the hardware front, the Pico seems to have an edge over its competitors. Just like the ESP32, Pico is built on a 40 nanometer process and it is dual core as well.

Its Arm Cortex MO+ processor on it is such that there are a lot of libraries available.

Additionally, it has 264 KB SRAM and 16 MB Flash, which makes it pretty fast.

The Pico boasts programmable IO pins, which is quite unusual but it opens up the possibilities of connecting with virtually any peripheral out there. The analog pins in turn allow one to connect it to analog sensors.

The 16 Pulse Width Modulation (PWM) channels come in handy when you have a bunch of motors to control and it has Universal Asynchronous Receiver-Transmitters (UARTS) as well which are used for communicating over serial.

When it comes to the power consumption, the Raspberry Pi Pico accepts power inputs ranging from 1.8V to 5.5V. So it could be powered by two or three AA cells in series, or a single lithium-ion cell. It consumes little power and has different modes; it consumes particularly low power when in a dormant mode. This means one can easily run it up to a week with a rechargeable battery.

Raspberry Pi Pico software:

Like mentioned earlier, it is the first chip specifically created to run Python well. It has special floating point libraries for better performance. And although it is a hobby board, it does offer a C/ C++ tool chain. This in turn allows one to move from Python to something with better performance. For Artificial Intelligence (AI) and Machine Learning (ML) projects, it has a port of TensorFlow Lite, aka Tflite — an open source deep learning framework for on-device inference — already.

Raspberry Pi Pico programming:

To program the Pico, one can use MicroPython along with Thonny IDE that is available on the Raspberry Pi, Windows, Linux and Mac. One can also program it using C/ C++, using the GCC-based toolchain and with the Visual Studio Code integration. Like all Raspberry Pis, it has its own book and ample documentation.

When compared to its ESP counterparts, the Pico does fare rather well. It enjoys Arduino IDE support, plus the 32-bit Pico is faster and easier to program than the AVR 8-bit microcontroller by Arduino.

The Pico can be paired with many development boards; the Arduino Nano variant will come fitted with WiFi, Bluetooth, IMU and a microphone. There’s another Arduino variant with a 5v pin for Neopixel projects.

The Adafruit dev boards, on the other hand, will boast support for circuit playground which allows one to use all kinds of Adafruit peripherals. The Sparkfun dev board has a USB C for a different set of use cases.

Raspberry Pi Pico use cases

The Raspberry Pi Pico is thus a well-rounded package that combines the good features of its competitors such as the Teensy and the ESP range. In keeping with Raspberry Pi tradition, it has good documentation and community support too. It is thus a reliable maker board and priced at a mere $4, it is easy on the pocket too.

The Pico is ideal for Internet of Things (IOT) projects, Neopixel projects, small to medium robotics projects and data logging purposes. Due to its analog pins, one can use it with environment sensors and one can also configure it to work with cameras.

You can watch this video to take a quick look at the specs of the newly launched Raspberry Pi Pico:

(This blog was originally posted in the Blogs section of the YoungWonks website on February 01, 2021 under the headline: What is Raspberry Pi Pico and How To Get Started With It? To read more such blogs and to claim a free trial coding class for your child, please visit: https://www.youngwonks.com/

Blog written by: Team YoungWonks (Written by: Vidya Prabhu; Illustration by Leonel Cruz)

--

--