How to Interface RGB LED with the Raspberry Pi Pico Board

What is the Raspberry Pi Pico board?

The Raspberry Pi Pico Board is a tiny fast and versatile board using the RP2040 microcontroller chip, all created by Raspberry Pi in the UK. As a microcontroller, it is perfect for small projects such as those incorporating the IoT, analog sensing and smaller robotics, etc. 

The Raspberry Pi Pico board can easily be reprogrammed over USB using a PC/ Raspberry Pi through its  C/C++ SDK or the official MicroPython port.

Image Courtesy:

Board Specifications

The Raspberry Pi Pico is a single-sided 51x21mm printed circuit board around 1mm thick. It can be further broken down into the following components

  • RP2040 microcontroller chip

  • The ARM Cortex-M0+ processor

  • 264kB of SRAM, and 2MB of onboard Flash memory

  • The castellated module allows soldering directly to carrier boards

  • USB 1.1 Host and Device support

  • Low-power sleep and dormant modes

  • Drag & drop programming using mass storage over USB

  • 26 multi-function GPIO pins

  • 2×SPI, 2×I2C, 2×UART, 3×12-bit ADC, 16×controllable PWM channels

  • Accurate clock and timer on-chip
  • Temperature sensor

  • Accelerated floating-point libraries on-chip

  • 8×Programmable IO (PIO) state machines for custom peripheral support

Pinout and Description 

GPIO Pinout 

The Raspberry Pi Pico board has a total of 40 I/O pins, out of which 26 are multifunction 3.3V GPIO pins, 8 ground pins, and 3 pins for debugging. You can see the complete pin layout below.

Image Courtesy:

I/O pins on Pico board

26 multi-function GPIO pins are exposed whereas an additional 27th pin can be used for the LED. The GPIOs are fixed at 3.3V. GPIO0 to 22 are digital whereas 26-28 are available for use as either digital or an ADC input. It also comes with 2 × SPI, 2 × I2C, 2 × UART, 3 × 12-bit ADC, and 16 × controllable PWM channels

The Pico board as mentioned before, supports analog to digital converters, while 3 are exposed via pinout, the fourth is an internal channel is available only for the internal temperature sensor. Therefore, you can use the analog value at ADC4 to calculate the temperature. 

The chip has two SPI peripherals, Each SPU supported a master and slave mode. Similarly, the chip also has two I2C controllers. They can also be used in master or slave mode coming at standard, fast, and fast plus mode.

Next are the two identical UART peripherals and the PMW channels. The microcontroller contains 8 PMW blocks, each providing 2 signals leading to a total of 16 signal outputs. 

Power pins on Pico board

The power pins on the board are used to power the pico board using its power source or power the sensors/peripherals working with the pico board. These include pins 36,37,39, 40 also knows as the VBUS, VSYS,  3V3_EN, and the 3V3(Out) pins. 

Ground pins on Pico board

There are two types of ground pins on the Pico board, a digital ground and a ground pin for analog input/output. Pins 3,8,13,18,23,28,33 and 38 are GND pins whereas pin 33 is AGND, also known as analog ground. 

The Pico board also has a number of test point pins. These are only visible from the side of the board and are used during the manufacturing process for testing out the board. These are TP1-TP6. TP1 is the ground pin. TP2 and TP3 can be used in place of the micro-USB, TP4, and TP5 are not to be used at all. 

An additional pin is also present. The RUN pin is RP2040 enabled, used to reset the RP2040 microcontroller. 

Image Courtesy:

Programming the Pico board

The Raspberry Pi Pico board can be programmed using either C/C++ SDK or MicroPython. You will also get two software development kits (SDKs) for each C/C++ and Python. 

Setting Up the Raspberry Pi Pico

Follow the following steps to have your Raspberry Pi Pico board up and running. 

  1. Go to and download the MicroPython UF2 file.

  2. Next, you will press and hold down the BOOTSEL button on your Pico board. Use a micro-USB cable to connect your computer to the board and then release once connected.

  3. The board will appear as a mass storage device “RPI-RP2” on your computer.

  4. Move the UF2 file onto the RPI-RP2 drive. The Raspberry Pi Pico will reboot and run MicroPython. 

Next, you will set up the Thonny IDE in your Raspberry Pico Board. Why the Thonny IDE? Well, an IDE software will essentially help you write code much more easily and Thonny is perhaps the best option to opt for. 

  1. Install Thonny IDE for your operating system. You can download it from for free.
  2. Next, you will have to download the backend for Thonny to communicate with the Pico board.

  3. Next open Thonny. Go to Tools > Manage Packages and select “Install from local file”.

  4. See where the file has been downloaded and install. Once complete, restart your Thonny.

  5. Now, connect your Raspberry Pi Pico board to your PC following the steps above.

  6. Open Thonny and go to Tools > Options.

  7. Click on the “Interpreter” tab.

  8. Go to the dropdown list and select “MicroPython (Raspberry Pi Pico).

  9. The Port will automatically detect the Pico.

  10. Finally, click “OK” to close. 

The Python Shell will not indicate that the Pico is connected and working, 

Interfacing RGB LED Module with Pico Board

You can easily interface the RGB LED module with the Raspberry Pico board by following the steps below. By the end of the project, the RGB LED will start blinking by the code you run.

Image Courtesy:

  1. First, you will connect the Pico board with the RGB LED module using the GPIO pins.

  2. Next, connect the Pico board with your PC using a micro USB cable (follow the steps of connecting your Pico board to your PC mentioned above)

  3. Open Thonny IDE, go to Tools > Options.

  4. Select the “Interpreter” tab.

  5. Select MicroPython from the dropdown. The port will automatically be detected. Click OK to complete.

  6. Use the code given here:

  7. Once you run the code, the RGB LED will start blinking. Save the code either on your PC or MicroPython device. 

Related posts

Using the DHT11 Sensor with Raspberry Pi to Measure Temperature and Humidity

Getting Started on your Raspberry Pi | Quick and Easy Guide

Top 8 Common Issues with Raspberry Pi and how to resolve them