The direct answer: to get started with Raspberry Pi Pico, buy the Raspberry Pi Pico W (approx. $6), flash the latest MicroPython UF2 firmware using the Thonny IDE, and wire an external 5mm LED to GPIO 15. While the original Pico and the newer Pico 2 exist, the Pico W remains the undisputed default for beginners because it includes Wi-Fi and Bluetooth without sacrificing the core RP2040 learning experience.
This guide skips the abstract theory and gives you the exact parts, pinouts, and compilable code to build your first network-connected circuit, along with the specific error strings you will inevitably encounter and how to fix them.
Which Raspberry Pi Pico Board Should You Actually Buy?
Raspberry Pi currently ships three main microcontroller variants. Choosing the wrong one will either leave you without wireless capabilities or force you to learn a newer architecture before the community documentation has fully matured. Use this decision matrix to pick your board.
| Your Primary Use Case | Required Feature | Board Pick | Approx. Price |
|---|---|---|---|
| Basic logic, motor control, offline sensors | Low cost, standard GPIO | Raspberry Pi Pico (RP2040) | $4.00 |
| IoT dashboards, MQTT, web servers, BLE | Wi-Fi / Bluetooth LE | Raspberry Pi Pico W (RP2040) | $6.00 |
| High-speed signal processing, dual-core RISC-V | More SRAM, advanced PIO | Raspberry Pi Pico 2 (RP2350) | $5.00 |
Hardware Spec Sheet & Parts List
Do not buy a Pico W without pre-soldered headers unless you own a soldering station and are comfortable with 0.1-inch header pins. The castellated pads are unforgiving for beginners.
Exact Parts List
- MCU: Raspberry Pi Pico W with pre-soldered headers (Part # SC0918 or equivalent vendor SKU).
- Prototyping: Half-size 400-point solderless breadboard.
- LED: Standard 5mm through-hole LED (any color).
- Resistor: 220Ω or 330Ω 1/4W through-hole resistor (to limit current to ~15mA).
- Wiring: Male-to-Male jumper wires.
- Cable: Micro-USB data cable. (Warning: 80% of 'first boot' failures are caused by using a charge-only cable scavenged from an old vape or cheap gadget).
Pico W vs Base Pico Spec Comparison
| Specification | Pico (Base) | Pico W |
|---|---|---|
| Microcontroller | RP2040 (Dual Cortex-M0+ @ 133MHz) | RP2040 (Dual Cortex-M0+ @ 133MHz) |
| SRAM / Flash | 264KB / 2MB | 264KB / 2MB |
| Wireless | None | 802.11n Wi-Fi (2.4GHz) + BT 5.2 |
| Usable GPIO Pins | 26 multifunction | 26 multifunction (GP23-GP25 repurposed) |
Flashing MicroPython and Wiring Your First Circuit
We are using MicroPython, not C/C++. MicroPython allows you to write Python scripts that execute directly on the bare metal, making iteration instantaneous.
Step-by-Step Flashing
- Download Firmware: Go to the official MicroPython Pico W download page and grab the latest stable
.uf2file. - Enter BOOTSEL: Press and hold the white BOOTSEL button on the Pico W, then plug the Micro-USB cable into your PC. Release the button. The board will mount as a USB mass storage drive named
RPI-RP2. - Flash: Drag and drop the
.uf2file onto theRPI-RP2drive. The drive will instantly disconnect, and the Pico W will reboot into MicroPython. - IDE Setup: Open Thonny IDE. In the bottom-right corner, change the interpreter from 'Python 3' to 'MicroPython (Raspberry Pi Pico)'. You should see a
>>>REPL prompt in the shell.
Pin Mapping & Wiring
CYW43 driver for your very first hardware lesson, we are wiring an external LED to GP15 to learn standard hardware pin manipulation.
| Pico W Pin | Component | Notes |
|---|---|---|
| GP15 (Pin 20) | 220Ω Resistor (Leg 1) | Resistor protects LED from overcurrent. |
| N/A | 220Ω Resistor (Leg 2) | Connects to LED Anode (long leg). |
| N/A | LED Cathode (short leg) | Flat side of LED bulb. |
| GND (Pin 18) | LED Cathode | Completes the circuit to RP2040 ground. |
The Code: Wi-Fi Connected Blinky with Error Handling
Target Board: Raspberry Pi Pico W (RP2040) running MicroPython v1.23+.
Difficulty Rating: Beginner (15 minutes).
This script connects to your 2.4GHz Wi-Fi network, prints the assigned IP address, and then blinks the external LED on GP15. It includes a try/except block to handle connection timeouts gracefully, preventing the board from hanging in a boot loop if the router is unreachable.
import network
import machine
import time
import sys
# --- PIN & CONFIG DEFINITIONS ---
LED_PIN = 15 # External LED on GP15
WIFI_SSID = 'Your_2.4GHz_Network_Name'
WIFI_PASS = 'Your_WiFi_Password'
MAX_RETRIES = 20
# Initialize hardware
led = machine.Pin(LED_PIN, machine.Pin.OUT)
wlan = network.WLAN(network.STA_IF)
print(f'Booting Pico W... Target LED on GP{LED_PIN}')
def connect_wifi():
wlan.active(True)
# Optional: Disable Wi-Fi power saving to prevent latency spikes
# wlan.config(pm = 0xa11140)
if not wlan.isconnected():
print(f'Connecting to {WIFI_SSID}...')
wlan.connect(WIFI_SSID, WIFI_PASS)
retries = 0
while not wlan.isconnected() and retries < MAX_RETRIES:
time.sleep(0.5)
led.toggle() # Fast blink while connecting
retries += 1
if wlan.isconnected():
ip = wlan.ifconfig()[0]
print(f'Success! IP Address: {ip}')
return True
else:
print('Error: Wi-Fi connection timed out.')
return False
# --- MAIN EXECUTION LOOP ---
try:
if connect_wifi():
# Solid ON for 2 seconds to indicate successful connection
led.on()
time.sleep(2)
# Main application loop
while True:
led.toggle()
time.sleep(1) # 1Hz blink rate
else:
# Error indication: 3 rapid flashes, then halt
for _ in range(3):
led.on()
time.sleep(0.1)
led.off()
time.sleep(0.1)
sys.exit('Halting due to network failure.')
except KeyboardInterrupt:
print('\nProgram interrupted by user.')
led.off()
except Exception as e:
print(f'Unexpected runtime error: {e}')
led.off()
Save this file to the Pico W as main.py via Thonny. It will execute automatically every time the board receives power.
Troubleshooting: Exact Errors and the First Three Checks
When your Pico W fails to run, do not start rewriting code. Run through this physical and environmental checklist first.
The First Three Things to Check
- The Cable: Swap your Micro-USB cable. If Thonny says 'Device not found' or 'No serial port', you are using a charge-only cable.
- The Wi-Fi Band: The Pico W's CYW43439 chip is strictly 2.4GHz. If your router uses a unified SSID for 2.4GHz and 5GHz, or you are trying to connect to a 5GHz-only network, the connection will silently fail or time out.
- The Firmware Variant: Ensure you flashed the
RPI_PICO_WUF2, not the standardRPI_PICOUF2. The hardware is identical, but the firmware bindings for the wireless chip are missing on the base version.
Common Error Strings & Fixes
| Exact Error String | Ranked Cause | Fix |
|---|---|---|
ImportError: no module named 'network' |
1. Flashed base Pico firmware on a Pico W. | Hold BOOTSEL, re-flash using the specific Pico W MicroPython UF2 file. |
OSError: [Errno 2] ENOENT |
1. Trying to import a custom module that wasn't saved to the Pico's internal flash. 2. Typo in filename. |
In Thonny, ensure you clicked 'Save As' and selected Raspberry Pi Pico as the destination, not your local PC. |
ValueError: Pin(25) doesn't exist |
1. Copied legacy code meant for the original Pico. | Change pin definition to 15 for an external LED, or use machine.Pin('LED') for the Pico W onboard LED. |
How to Extend or Simplify This Build
Once the LED is blinking and you have verified your IP address via the Thonny serial console, you have two clear paths forward depending on your project goals.
Path A: Simplify (Offline Data Logging)
If you realize your project doesn't actually need Wi-Fi (e.g., a battery-powered temperature logger in a shed), drop the network stack. Remove the import network lines, switch to the $4 base Pico to save money, and utilize the RP2040's deep sleep modes. The machine.lightsleep() command will drop power consumption from ~50mA (Wi-Fi active) down to roughly 1.3mA, extending a 2000mAh 18650 cell from 2 days to over 2 months.
Path B: Extend (IoT Sensor Dashboard)
To turn this into a real IoT node, add a BME280 I2C environmental sensor ($4).
Wire the BME280 VCC to 3V3 (Pin 36), GND to GND (Pin 38), SDA to GP4 (Pin 6), and SCL to GP5 (Pin 7).
Install the bme280 library via Thonny's package manager, read the temperature, and use MicroPython's built-in umqtt.simple library to publish the JSON payload to a local Mosquitto broker or Home Assistant MQTT integration. This transforms your breadboard from a blinking toy into a functional smart-home edge node.






