Wiring guide

How to wire an LED to a Raspberry Pi Pico

To wire an LED to a Raspberry Pi Pico, connect A to GP15 (physical pin 20) and C to GND. The Raspberry Pi Pico’s pin is 3.3 V and a 220 ohm resistor in series limits the current through the LED to about 6 mA, so nothing else is needed. The sketch below uses no library beyond what the board includes. It blinks the LED, half a second on and half a second off, printing LED on and LED off.

  • 3.3 V logic
  • Library: none
  • 2 wires, 1 helper parts
Raspberry Pi Pico · LEDlive0.000 s 0.00x
Click to open it in the editor
The circuit itself, running on the simulator with the sketch below. Press what can be pressed; click anything else to open it in the editor.
Pin to pin

LED to Raspberry Pi Pico wiring table

Every wire in the circuit above, with the part’s pin names and the board’s own labels. The wire colors are the ones the circuit uses; on a real bench any colors work.

LED pinRaspberry Pi Pico pinWire colorWhy
A (anode)GP15 (physical pin 20), through R1 (220 Ω)amberThe long leg. Current flows in here, so it takes the signal, with the resistor in the way.
C (cathode)GNDblueThe short leg, on the flat side of the lens, goes to ground.
220 ohm resistorIn series with the anoden/aLimits the current. Without it the LED, the pin or both burn out.

Helper parts

The extra parts in the circuit above, and where their wires go:

FromToWire color
R1 (220 Ω) pin 1GP15green
Voltage

Power and logic levels for LED and Raspberry Pi Pico

Logic level

The Raspberry Pi Pico’s GPIO pins are 3.3 V logic and are not 5 V tolerant. Nothing wired to a pin may go above 3.3 V.

This pair

A red LED drops about 2 V, so with 220 ohm in series a 3.3 V pin pushes about 6 mA through it: bright enough to see and gentle on the pin. The resistor can sit on either side of the LED; what matters is that it is in the loop.

Pins to leave alone

The numbers in the code are GP numbers, not the physical pin numbers printed beside the header: GP15 is pin 20. GP23 to GP25 are used on the board itself, and GP25 is the LED.

The sketch

The working code for the Raspberry Pi Pico

Library: none, the sketch drives the pin with digitalWrite(). This is the sketch the circuit above runs.

Blinking an LED on Raspberry Pi Pico GP15 (physical pin 20)
const int LED_PIN = 15;   // GP15 (physical pin 20), through a 220 ohm resistor to the LED

void setup() {
  Serial.begin(115200);
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_PIN, HIGH);
  Serial.println("LED on");
  delay(500);
  digitalWrite(LED_PIN, LOW);
  Serial.println("LED off");
  delay(500);
}
Output

What you should see

The LED lights for half a second and goes dark for half a second. The serial monitor, at 115200 baud, prints LED on and LED off as the pin changes.

An LED that never lights is usually in backwards: the long leg, the anode, faces the resistor and the pin.

The serial monitor prints this, recorded from the circuit above running for two and a half seconds:

LED on
LED off
LED on
LED off
LED on
Pitfalls

Common mistakes wiring an LED to a Raspberry Pi Pico

Putting the LED in backwards

An LED passes current one way only. Backwards it stays dark and nothing is damaged. If it never lights, swap its two legs: the long leg, the anode, faces the signal.

Leaving out the resistor

An LED has almost no resistance once it conducts, so the only limit on the current is the pin. At 3.3 V that is far more than the LED’s 20 mA rating. The simulator burns the LED out and shows it dark for good, as a real one goes.

Counting physical pins instead of GP numbers

The sketch says 15, which means GP15, and that is physical pin 20 on the header. Counting 15 pins down the side lands on a different GPIO, and the part never answers.

Build your own LED project

Open this circuit in the editor, change the wiring or the code, and keep your version in a free account.