Getting Started with Raspberry Pi Pico: Setup & First Script

If you click our links and make a purchase, we may earn an affiliate commission. Learn more

So you just picked up a Raspberry Pi Pico and are wondering: “What will I do with this thing?” It doesn’t have an SD card slot or an OS, so it isn’t business as usual. Well, don’t worry, here’s your beginner’s guide to getting started with the Raspberry Pi Pico.

The Raspberry Pi Pico is a microcontroller, not a single-board computer. To get started, it is connected to a computer using a USB cable, and code is written on the computer using a compatible IDE and programming language. The code is then run directly on the Raspberry Pi Pico.

In this article, I’ll help you with the first steps to get started quickly with a Raspberry Pi Pico, including coding your first program. Let’s start with the requirements to make sure you understand how different it is.

If you’re like me and sometimes mix up syntax between programming languages, I’ve got just the thing for you. I’ve put together a Python cheat sheet with all the essential syntax in one place, so you can keep it handy and avoid any confusion. Download it here for free!

Requirements to use a Raspberry Pi Pico

If you’re completely new to the Raspberry Pi Pico, or if you don’t even have one yet, I recommend reading our introductory article here first, I’ll skip the theory here and tell you what you need to get started.

Raspberry Pi Pico (any version)

First on the list is of course a Raspberry Pi Pico board. Now, there are several variants of the Raspberry Pi Pico. Let’s see which one you have depending on the descriptions below.

  • Raspberry Pi Pico: The original model, is equipped with the RP2040 microcontroller. It offers basic functionality with GPIO pins (without headers) and doesn’t support wireless connectivity.
  • Raspberry Pi Pico H: Similar to the Pico, but with pre-soldered headers for easy connection to breadboards and other components. It also includes a 3-pin debug connector.

    Pre-soldered headers mean the pins are already attached for easy plug-and-play, while ‘no headers’ require you to solder pins yourself for custom setups.
  • Raspberry Pi Pico W: This variant includes built-in Wi-Fi, making it ideal for IoT projects where wireless connectivity is needed.

  • Raspberry Pi Pico WH: This variant combines the features of the Pico W with pre-soldered headers and the 3-pin debug connector, perfect for wireless projects.

A Computer or Raspberry Pi

As you can’t install an operating system on the Raspberry Pi Pico, we need to use another device to write the code on it. This other device can be a computer (Windows, Linux, or Mac) or a Raspberry Pi.

Note: I attempted to use a Chromebook to program the Raspberry Pi Pico, but ultimately gave up due to the challenges involved. It was a complicated process that didn’t end successfully, so I don’t recommend it.

Micro USB Cable

The Raspberry Pi Pico has only one port: a micro USB. It allows you to power the board and connect it to your computer to upload the code from your development environment.

So you’ll need a cable that is typically micro USB on one side and standard USB A on the other side (something like that is perfect).

Something not working as expected?
You can get answers from real experts in minutes.
Get help with your setup

Remember, the Raspberry Pi Pico is a microcontroller. Not a single-board-computer like other Raspberry Pi boards, including the Raspberry Pi Zero.

Warning: While the Raspberry Pi Pico might look similar to the Raspberry Pi Zero, there is a huge difference in their capabilities and use cases. We already have a post about the differences between a Raspberry Pi Pico and a Raspberry Pi Zero if you want to learn more.

Getting ready to code for the Raspberry Pi Pico

To this point, I assume that you already know the setup logic: Connect the Raspberry Pi Pico to a computer, write the code, and run it.

Recommended next step
Master Python on Raspberry Pi

Want to build real Raspberry Pi projects with Python? This book starts from scratch and guides you toward practical scripts, automation, APIs, cameras and more.

Learn Python on Raspberry Pi

Well, not so fast. Let’s start by first understanding which programming languages are supported by the Raspberry Pi Pico

Choose a programming language

The Raspberry Pi Pico supports several programming languages, including:

  • MicroPython: A lightweight version of Python designed for microcontrollers, ideal for beginners due to its simplicity and ease of use.
  • C/C++: Offers more control and efficiency, making it suitable for performance-intensive projects.
  • CircuitPython: An Adafruit-supported version of Python, similar to MicroPython and focuses on easy hardware interfacing.
  • Arduino: Recently supported via the Arduino IDE, allowing users familiar with Arduino libraries to program the Pico. (Raspberry Pi Pico vs Arduino: Which One Should You Use?)

In this post, I will use MicroPython. I have also tried using C, it is also a good option but I found MicroPython easier to begin with.

If you have some JavaScript skills, you’re in luck—the Raspberry Pi developers have been working on bringing JavaScript to the Pico using the XS JavaScript engine. You can check out the discussion in the forum to see their progress. Last time I checked, you could write code to blink the LED lights, so there’s likely been more progress by now.

Note: This tutorial is based on Windows 10/11. Therefore, if you are using an older version of Windows or an operating system like Linux or Mac, there might be slight differences.

Install Thonny IDE

There are many IDEs that you can use but when it comes to working with the Raspberry Pi Pico, I always recommend using Thonny.

Thonny is a beginner-friendly Python code editor pre-installed on most platforms, including Raspberry Pi OS. What truly sets this IDE apart is its built-in support for MicroPython, an integrated debugger for troubleshooting, and easy file management on the Pico.

If you have never used Thonny before, I recommend checking out our Thonny beginner’s guide, which takes you through the installation process and help you explore the advanced features of the IDE.

As I stated earlier, I will be using Windows for this tutorial. First, head to the official website and download a compatible version (in my case, it’s 64-bit). There are also download options for Mac and Linux.

Install MicroPython on the Raspberry Pi Pico

After installing Thonny on your computer, install MicroPython firmware on your Raspberry Pi Pico. This firmware will be needed to run the MicroPython code that you will write on the Thonny IDE.

Now follow the steps below.

  • Connect the Pico: Begin by plugging one end of your Micro-USB cable into the Pico. But DON’T connect the other end to your computer just yet!
  • Find the BOOTSEL Button: Look for the small button located on the top of your Pico; this is the ‘BOOTSEL’ button. You can see it in the image below.
  • Initiate Firmware Installation: Hold down this BOOTSEL button and connect the other end of the USB cable to your computer USB port. Keep holding the button until you see your Pico light up. You might notice it appears as a new device on your computer but don’t worry about that for now.
  • Open Thonny: Release the BOOTSEL button and launch Thonny on your computer. Thonny will immediately detect the Raspberry Pi Pico connected to your PC and you should see it listed in the ‘Device’ dropdown menu at the bottom right of the screen.


  • Install MicroPython: Click ‘Install MicroPython…’ from the list.
  • Configure Installation Options: A new dialogue box will appear with installation options. Follow the settings in the screenshot below: choose the RPI-RP2 target volume, select the Raspberry Pi Pico or Pico H variant, and pick the latest version available (at the time of writing, it was 1.22.0).

Setting up Thonny

Thonny can be used with various development boards, not just the Raspberry Pi Pico. It supports other MicroPython-compatible boards, such as the ESP8266 and ESP32, as well as standard Python development on PCs.

Related: ESP32 vs Raspberry Pi Pico: When to Use Each in Your Projects

Therefore, in this tutorial, we must configure/tell Thonny that we are using the Raspberry Pi Pico.

Click the “Run” menu at the top and select “Configure interpreter.”

The “Thonny Options” window will open and you will see two main dropdown menus. In the first dropdown menu, select the interpreter you want to use. Select “MicroPython (Raspberry Pi Pico).”

In the second dropdown menu, select the connection port where your microcontroller (e.g., Raspberry Pi Pico) is connected to your computer.

Note: When you plug in your microcontroller, it will typically appear as a COM port on Windows (e.g., COM3, COM4) or as a /dev/tty device on macOS and Linux (e.g., /dev/ttyUSB0). Thonny auto-detects available ports, but you might have to manually select the correct port for your microcontroller if you have multiple devices connected.

Programming Your Raspberry Pi Pico

Now that your Raspberry Pi Pico is set up, it’s time to dive into programming! Let’s start with a simple test program and then move on to lighting up the onboard LED. Afterward, we’ll try a slightly more advanced program to explore what the Pico can do.

Write the first default (test) program

Let’s begin with a basic “Hello, World!” program in MicroPython to test the setup:

  • Open Thonny, and make sure the interpreter is set to “MicroPython (Raspberry Pi Pico)”.
  • In the main editor area, type the following code:
    print("This is Pico talking from RaspberryTips.com")
  • Click Run and save the program to your Pico.
    You should see “This is Pico talking from RaspberryTips.com” displayed in the console.

This program is one of the simplest you will ever write in Python. It is actually called the “Hello World” program but in our case, we needed to be fancier.

Here’s what each part does:

  • print: This is a built-in command in Python that tells the program to display information on the screen. Whenever you want to show some text, numbers, or other information to the user, you can use print.
  • (“This is Pico talking….!”): The text inside the parentheses (round brackets) is what we want to show. Here, “This is Pico talking…” is a string in Python that is simply a piece of text. In Python, we put text inside quotes (either single or double quotes) to tell the program it’s a string and not code.

Light the Pico’s onboard LED

The above program was only for testing that the MicroPython interpreter is working. Now let’s write a more advanced program to light the Pico’s onboard LED.

On your Thonny editor, copy and paste this code.

from machine import Pin
from time import sleep_ms

led = Pin(25, Pin.OUT)

while True:
    led.toggle()
    sleep_ms(500)

When you run the code above, your Raspberry Pi Pico will start blinking as shown in the video below.

Now let’s look at the above code in detail.

This code is written to make the LED on your Raspberry Pi Pico blink on and off in a loop. Let’s go through it step by step:

from machine import Pin
from time import sleep_ms

led = Pin(25, Pin.OUT)
  • from machine import Pin: This line imports the Pin class from the machine module. The machine module allows us to work directly with the hardware on the Pico, like its pins (the little metal connectors).
  • from time import sleep_ms: This line imports the sleep_ms function from the time module. The sleep_ms function pauses the program for a specified number of milliseconds, which we’ll use to control how often the LED blinks.
  • led = Pin(25, Pin.OUT): This line sets up the LED on the Pico so that we can turn it on and off.

    Pin(25, Pin.OUT) tells the Pico that we’re using Pin 25 (the built-in LED pin) and setting it to output mode (Pin.OUT), meaning it can send power to the LED.

    The led variable now represents the LED on Pin 25, so we can control it with this code.
while True:
led.toggle()
sleep_ms(500)
  • while True – A loop that will run forever, repeating the code inside. True means it’s always active, so the loop will go until you stop the program.
  • led.toggle() – This line changes the state of the LED. If the LED is on, toggle() will turn it off. If it’s off, toggle() will turn it on. This gives us the blinking effect.
  • sleep_ms(500) – This pauses the program for 0.5 seconds after each toggle. So the LED stays on for 0.5 seconds, then off for 0.5 seconds, creating a regular blink pattern.

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Stuck on this project? Ask me or other Pi users in the RaspberryTips Community. We help each other out and you'll get answers quick. Join and fix it together.

Going Further

In this tutorial, I have just shown you how to write a simple program to light up the LED on your Raspberry Pi Pico. However, there’s so much more you can do!

The Pico can control external components, read sensors, and communicate with other devices (even with your PC). Ready to dive deeper? Check out our dedicated article on best Raspberry Pi Pico projects for more ideas and inspiration!

Not getting the same result?

Even when you follow every step, small differences in OS version, hardware or config can change the outcome. Instead of wasting time guessing, get help from people who have already fixed the same kind of issue.

Ask your question now
🔒 No risk. Cancel anytime.
  • Get help on your exact issue
  • Access step-by-step videos for tricky setups
  • Browse the website without ads

Similar Posts

Leave a Reply

Community members only
Comments are reserved for RaspberryTips Community members. Join the community to ask questions, get help, and interact with other Raspberry Pi users.

Join the community  or  log in