What is a Raspberry Pi Pico and what does it do?

The Raspberry Pi Pico is a microcontroller board similar to Arduino rather than a Linux device. The Raspberry Pi Pico’s main selling points are its $4 price tag. The latest RP2040 chip, offers plenty of power for embedded projects and allows people of any age or skill to learn coding and electronics.

Can I use a Raspberry Pi Pico as my main computer?

No. Unlike the Raspberry Pi, which is a general-purpose computer that runs the popular Linux operating system, the Pico is a much simpler device that lacks a central operating system and can only be configured to perform particular tasks or monitor attached peripherals, usually as part of an embedded system or Internet of Things device.

Got a Raspberry pi pico chip? Need to know how to use it? We’re here to assist you.

This article explains how to connect your Raspberry Pi Pico to another computer. The Raspberry Pi Foundation recently announced the Raspberry Pi Pico as a successful microcontroller in the open-source electronics world. The Pico has many of the same features as a typical Arduino circuit. The Raspberry Pi Pico is unlike previous Pis in that it is a microcontroller board similar to Arduino rather than a Linux device. The Raspberry Pi Pico’s main selling points are its $4 price tag and the latest RP2040 chip, which offers plenty of power for embedded projects and allows people of any age or skill to learn coding and electronics. Everything you need to know about raspberry pi pico chip is mentioned here. Getting started with Raspberry pi pico has just become more easy.


HardwareA raspberry pi pico
A computer
A micro-USB cable
Electronic components: Buttons, LED, Resistors
A bread board
Male-male jumper wires
An external 5V power supply
SoftwareSoftware for setup in python programming 
1. Micro python
2. Thonny python IDE

Software for setup in C/C++ programming
1. Visual studio coke
2. Cmake 

Guide to Raspberry pi pico:

The Raspberry Pi Pico is a microcontroller production board. In other words, it’s a printed circuit board that houses a particular kind of processor that’s built for physical computing: the microcontroller. Even though its size is of a stick of gum, it packs a remarkable amount of punch thanks to the RP2040 microcontroller at its heart.

RP2040 Controller:

It has a dual-core Arm Cortex-M0+ CPU, 264KB of internal RAM, and up to 16MB of off-chip Flash support. I2C, SPI, and uniquely Programmable I/O are among the many customizable I/O solutions available (PIO). This allows an infinite number of applications for this small and inexpensive kit.

The Pico has an onboard LED that can be managed and used to verify the microcontroller’s basic functionality. However, we’d like to put the capabilities to the test on a piece of external hardware. Use an RGB LED to test the Pico’s general-purpose inputs/outputs (GPIOs), as well as pulse-width modulation (PWM) to control the LED’s brightness (s).

Specifications of Raspberry Pi Pico

  • Raspberry Pi produced the RP2040 microcontroller chip in the United Kingdom.
  • Dual-core Arm Cortex M0+ CPU with a versatile clock speed of up to 133 MHz
  • 2MB of Flash memory and 264KB of SRAM
  • Soldering directly to carrier boards is possible with the Castellated module.
  • USB 1.1 with host and system support
  • Modes for low-power sleep and dormancy
  • Drag-and-drop scripting for USB mass storage
  • There are 26 GPIO pins that can be used for different functions.
  • Two SPI channels, two I2C channels, two UART channels, three 12-bit ADC channels, and sixteen controllable PWM channels.
  • On-chip timer and accurate clock.
  • Sensor for determining temperature.
  • On-chip floating-point libraries for accelerated computations.
  • For custom peripheral support, there are 8 programmable I/O (PIO) state machines.
  • To view the datasheet of microcontroller RP2040 Click Here
  • To view the  datasheet of Raspberry Pi Pico datasheet Click Here

Steps to setup the Raspberry Pi Pico

To get started with the Raspberry pi pico, follow the setup steps given below.

Link to your device with a micro-USB cable after pressing and holding the BOOTSEL button on the Pico. Once the RPI-RP2 drive appears on your screen, release BOOTSEL.

  1. Click the INDEX.htm file in the RPI-RP2 drive that appears in the Drives tab to open the Raspberry Pi website in the window.
  2. Pico can be programmed in two ways as
  • C/C++
  • MicroPython

For more details you can refer the following video

Setup for Raspberry pi pico with C/C++

Note: To view the Raspberry Pi Pico C/C++ SDK Libaries and Tools Click Here

  1. Download and install Visual Studio Coke
  2. Download and install Cmake
  3. During the installation of Cmake choose the option: Add Cmake to the system PATH for all users
  4. Then Download and install Build Tools for Visual Studio
  5. Select and install C++ build tools
  6. Install Python, Git, and ARM GCC Compiler
  7. Get code
  8. Create Pico folder as (C:\development\pico)
  9. Then download zip code of pico SDK from Github and pico examples from Githu
  10. Extract to the pico folder
  11. Rename removing the master suffix
  12. Building at the command line
  • Start-up PowerShell and type the following:
  • stex PICO_SDK_PATH “c: \development\pico\pico-sdk”

PowerShell should be closed and a new PowerShell should be opened. To make a build folder inside pico-examples, type the following and then navigate to it:

Type on Windows PowerShell:

cd .\pico-examples\
mkidr build
cd build
cmake -G "NMake Makefiles"

Step 11: Now, in order to create the code and for the PowerShell to function, the environment variables for Microsoft build tools (specifically, nmake) should be set up correctly. If you get an error, try using the Developer Command Prompt for Visual Studio 2019.

Step 12: Simply type nmake after opening the prompt and navigating to the develop folder as before. It will begin constructing all of the instances (it will take a while).

Step 13: Troubleshooting NMake not found problems

Using Visual Code to Construct:

Note: Before attempting these moves, make sure you can construct effectively from the command line:

  • Pick Settings from the cog at the bottom-left of the browser.
  • Expand Extensions, choose CMake Tools setup, and then scroll down to Cmake: Click on Add Item after configuring the environment.
  • After that, scroll down to Cmake: Generator and set up it.
  • Close the Settings window and then select File->Open Folder from the File menu.
  • Then this pop-up will appear after you press Select Folder in the bottom-right corner of the browser. Select Yes
  • It’s worth noting that Visual Studio Code often generates a slew of pop-ups in the lower-right corner. You can normally ignore them (unless there is a mistake or a message of interest), but once you open a new file, a stream of pop-ups appears, and Visual Studio Code becomes ready to provide extensions and advice to help you deal with the files better.
  • Then, for arm-none-eabi, pick GCC.
  • If you don’t see the popup, pick No Kit Selected from the blue bar at the bottom of the browser, and then GCC for arm-none-eabi.
  • Click View->Output to see the output. If the build stalls, don’t hesitate to press PROBLEMS to see any alarms or errors.

Note: If you only want to create one demo in the future, you will avoid the build tools go through any of the files. To do so, go to the blue bar and press on the text [all] to the right of the Build text. There will be a long-range of targets to choose from. start typing hello serial in the box that appears, and then pick the objective if you’re just interested in (say) the hello serial program in the hello world folder. so the next time you press Create, it will just build the goal. finally By clicking there again and picking everything, you will return to creating all goals.

For running the application:

  • To see the.uf2 file, go to the relevant directories as seen in the screenshot below (if you cannot see any file suffixes you should change the View settings in File Explorer so that you can always see suffixes)
  • When you hold down the BOOTSEL button and plug the Pico’s USB attachment into your PC, the.uf2 file appears in the USB storage drive letter that appears (release the button after you’ve inserted the Pico into the PC). Ensure you program the application into the Flash memory and run it immediately.

Troubleshooting of your running application:

Write code to illuminate one or more LEDs to show whether or not a certain point in the code, or a data value, has been reached.

  • To transfer text-based debug information via USB to the attached PC, use printf statements. A serial link will appear on the PC. You can view it using applications like PuTTY. You can also use the scanf feature to grab user keyboard input.
  • To specifically phase through code, analyse variable text, or even memory locations, use the low-level debugger ‘gdb.’

Putting Intellisense to Use (Code Assistance):

  • If you open Visual Studio Code and navigate to the pico-examples folder, you can find some squiggly lines in the source code. It’s a little problem that won’t have an effect on your project until you compile it. However, fixing the squiggly line problem is perfect because it means Visual Studio Code would be able to assist you with writing code more effectively, by choosing the feature name with your mouse and pressing F12 (or right-clicking and selecting Go to Definition). Intellisense can also assist you when you type code by offering useful auto-completions.
  • If Intellisense isn’t running, for example, you’ll get nothing if you click F12 on the line stdio init all(). It would be difficult to determine where the feature stdio init all is located or what it does. You’d know right away if Intellisense was operating.
  • The squiggles are no longer visible when you open the code file.
  • If you press F12 when clicking on stdio init all, Visual Studio Code will open the header file the defines that feature. stdio.h is the name of the header file, by the way.

Setup for Raspberry pi pico with MicroPython

Are you new with micropython? Get the official guide Click Here

Step 1: Download the UF2 File MicroPython from the website of MicroPython

Step 2: Drag the UF2 file to the RPI-RP2 drive and drop it there. The Raspberry Pi Pico will reset, and MicroPython will now be mounted.

To write your own program, you’ll need tools that can connect with the Pico and write programs on it. For MicroPython, we’ll use Thonny. Follow the steps below to get started with Pico programming using Thonny IDE.

Step 3 – Download and install Thonny from Thonny website for your OS (Windows, MAC, or Raspbian).

Step 4 – Select Install from a local file in Thonny’s Tools > Manage Packages menu. Find the file to install. You can find it in the location where it was downloaded. Restart Thonny after you’ve finished.

Step 5 – Connect the Raspberry Pi Pico to your screen, then go to Tools > Options > Interpreter tab in Thonny. Pick MicroPython from the interpreter dropdown menu (Raspberry Pi Pico). The Pico will be detected automatically if the port dropdown menu is left blank. To close the window, click Ok. 

Step 6 – When the pico Board is plugged in, A firmware installation tab for the Raspberry Pi Pico will appear; press Install to install the appropriate files to connect with Thonny using Pico.

Step 7 – The MicroPython version and Raspberry board will appear in the Python Shell (also known as REPL, Read, Eval, Print, Loop). It will now update to display that the Pico is attached and running after effective installation.

Step 8 – We can write a fast print function to say “Hello World” as a test. To run the code, press Enter.

Creating a blinking program for the pico’s onboard LED

Writing a pico program is similar to writing a python program in that you must import certain files that will be used to customize pins and use functions that the hardware will use.

To ensure that we can program the Raspberry Pi Pico successfully, we’ll write the hardware version of “Hello World,” which will flash an LED. This short test verifies that our hardware is functional and introduces the MicroPython language and syntax in its most basic form.

We must first wire up our test circuit before we can begin writing code. This would necessitate soldering header pins to the Raspberry Pi Pico.

Items needed to complete this project:

  • A small bread board
  • 1 LED
  • 1 330 ohm resistor
  1. To focus the Raspberry pi pico on the central channel, place the Raspberry Pi Pico on the breadboard. But make sure the Micro USB port is on one of the breadboard’s ends.
  2. In the breadboard, place a 330 Ohm resistor with one leg in line with GND, which is pin 38. But note the other leg should be placed in the breadboard’s – rail. Hence this creates a GND rail on which all of the pins are attached to GND.
  3. Insert an LED into the breadboard at pin 34, with the long leg (the anode) into the anode and the short leg (the cathode) into the GND rail. Now, the circuit is complete.
  4. Import the libraries you’ll like. Then we begin by importing two MicroPython libraries and writing our code in the big blank space above the REPL. The first is the Machine library’s Pin type and the second is utime, which is used to regulate the speed of our code.
from machine import Pin
import utime

5. Make an entity called “led” that will serve as a connection between the physical GPIO pin and our code. In this case, GPIO 28 (which corresponds to physical pin 34 on the board) will be set as an output pin, allowing current to flow from the Raspberry Pi Pico GPIO to the LED. The object is then used to tell the GPIO pin to pull low. In other words, this ensures that the GPIO pin is disabled at the start of the project.

led = Pin (25, Pin.OUT)

6. We turn the LED on and off within a while True loop, a loop with no end, and print a message to the Python Shell (REPL) to show that the loop is running. Finally, we add a sleep command to stop the code for one second between each loop iteration.

while True:
led.toggle ()
print (“Toggle”)

7. Choose to save the code to the MicroPython computer by clicking Save (Raspberry Pi Pico). Finally this is how your code should look like.

Final code

from machine import Pin
import utime
led = Pin (25, Pin.OUT)
while True:
led.toggle ()
print (“Toggle”)

8. Save the software in pico and call it something special (avoid using main.py or info.py).

9. Then to run the code, press the green play/arrow button. The Python Shell will change every second to say TOGGLE the LED.

10. The software will run, and the LED on the board as well as the output in the Python shell will blink.

Pico’s architecture is distinguished by the absence of pin labels on the device’s end. On the bottom, they’re all neatly numbered, but just pins 1, 2, and 39 are labelled on the top. With their latest $4 microcontroller console, the Pi Foundation has a winner. Getting started with Raspberry Pi Pico is easy.

Other projects of Raspberry pi pico

1. How to use a motion sensor with Raspberry pi pico

2. Adding a reset button to your Raspberry Pi Pico

3. How to use Ultrasonic Sensor with Raspberry Pi Pico

4. How to use Raspberry Pi Pico with DC Motors


0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments