How to Set Up Raspberry Pi Pico: Step-by-Step Guide
To set up a
Raspberry Pi Pico, connect it to your computer using a micro USB cable while holding the BOOTSEL button to enter USB mass storage mode. Then, copy the MicroPython firmware file onto the Pico and use an IDE like Thonny to write and run your first program.Syntax
Setting up Raspberry Pi Pico involves these key steps:
- BOOTSEL button: Hold this button while plugging in the Pico to enter programming mode.
- USB connection: Use a micro USB cable to connect the Pico to your computer.
- Firmware file: A
.uf2file that contains MicroPython or other firmware to run on the Pico. - IDE: Software like Thonny to write and upload code to the Pico.
none
1. Hold BOOTSEL button on Pico 2. Connect Pico to PC via micro USB 3. Copy MicroPython .uf2 file to Pico drive 4. Open Thonny IDE 5. Select Raspberry Pi Pico as interpreter 6. Write and run Python code
Example
This example shows how to run a simple MicroPython program that blinks the onboard LED on the Raspberry Pi Pico.
python
import machine import time led = machine.Pin(25, machine.Pin.OUT) while True: led.toggle() time.sleep(0.5)
Output
The onboard LED blinks on and off every 0.5 seconds.
Common Pitfalls
Common mistakes when setting up Raspberry Pi Pico include:
- Not holding the BOOTSEL button while plugging in, so the Pico doesn't enter programming mode.
- Using a charge-only USB cable that doesn't support data transfer.
- Copying the wrong firmware file or corrupt file to the Pico.
- Not selecting the correct interpreter or port in the IDE.
none
Wrong way:
# Plug in Pico without BOOTSEL button pressed
# Pico won't appear as a USB drive
Right way:
# Hold BOOTSEL button while plugging in
# Pico appears as USB drive to copy .uf2 fileQuick Reference
| Step | Action |
|---|---|
| 1 | Hold BOOTSEL button and connect Pico via USB |
| 2 | Copy MicroPython .uf2 firmware to Pico drive |
| 3 | Open Thonny IDE and select Raspberry Pi Pico interpreter |
| 4 | Write and run MicroPython code |
| 5 | Reset Pico to run code normally |
Key Takeaways
Always hold the BOOTSEL button when connecting Pico to enter programming mode.
Use a data-capable micro USB cable to connect the Pico to your computer.
Copy the correct MicroPython .uf2 firmware file to the Pico's USB drive.
Use an IDE like Thonny to write and upload code to the Pico easily.
Check IDE settings to select Raspberry Pi Pico as the interpreter before running code.