EngineeringMaker Lab

Build guide

Featured project

Blink an LED with Raspberry Pi Pico

Build a small light that switches on and off automatically. In about 20–30 minutes, you will connect an LED safely to a Raspberry Pi Pico and control it with your first MicroPython program.

Last updated

Build Time
20–30 minutes
Estimated Cost
Included in the recommended starter kit
Skill Level
Beginner
Raspberry Pi PicoFirst StepsRaspberry Pi PicoLEDGPIOMicroPython

Project overview

What You Will Build

An LED, or light-emitting diode, produces light when current flows through it in the correct direction. Blinking one is the traditional first electronics project because a simple circuit and a short program produce an immediate result you can see.

You will build a breadboard circuit in which Raspberry Pi Pico GPIO 15 controls an external LED. A 220 ohm resistor keeps the current at a safe level, while a MicroPython loop turns the light on and off every second.

Skills

What You Will Learn

  • Learn what a GPIO pin is
  • Understand LED polarity
  • Learn why resistors are necessary
  • Upload and run your first MicroPython program
  • Build confidence using a breadboard

Preparation

Parts Used

Gather these components before starting the build.

  • Qty: 1Raspberry Pi PicoWith header pins installed
  • Qty: 1BreadboardSolderless breadboard
  • Qty: 1LEDA standard through-hole LED
  • Qty: 1220 ohm resistorLimits current through the LED
  • Qty: 2Jumper wiresMale-to-male
  • Qty: 1USB cableData-capable cable for programming the Pico

Engineering insight

Engineering Teacher Tip

An LED needs correct polarity, and a resistor limits current to protect both the LED and the Pico GPIO output. The long LED leg is normally the anode, but beginners should verify the component's markings and documentation instead of relying only on leg length.

Verified resource

Complete Official Build Guide

Hello, Breadboard!

Already have the recommended equipment? The verified SunFounder lesson provides the exact wiring, schematic, code, and step-by-step build instructions.

The verified Thales MicroPython lesson provides the exact external LED wiring, schematic, code, and step-by-step build instructions.

Original preparation

Original Code and Preparation Notes

This independently written example summarizes the programming concept used by the project. Compare wiring and pin choices with the verified official guide, when available, before running main.py.

main.pypython
from machine import Pin
from time import sleep

led = Pin(15, Pin.OUT)

while True:
    led.on()
    sleep(1)
    led.off()
    sleep(1)

Understand it

How the Code Works

  1. Pin identifies GP15 and configures it as an output that the Pico can switch.
  2. The while True loop repeats forever while the program is running.
  3. Calling led.on() turns the LED on; calling led.off() turns it off.
  4. Each sleep call pauses for one second, creating a steady blink.

Problem solving

Common Beginner Mistakes

The LED does not light

Confirm the Pico has power and test each connection from GP15 through the resistor and LED to GND.

The LED is installed backward

Disconnect USB power and rotate the LED so its longer anode leg faces the resistor and its shorter cathode leg faces GND.

A lead is in the wrong breadboard row

Check the top-down wiring visual. Parts connect only when their leads share the correct internally connected row.

The circuit has no shared ground

Connect the LED cathode row back to a GND pin on the same Pico controlling GP15.

The code uses the wrong GPIO pin

This project uses GP15. Confirm the program says Pin(15

The resistor or jumper is misplaced

Trace the path in order—GP15

The code is not running on the Pico

Select the MicroPython Raspberry Pi Pico interpreter

Common questions

Frequently Asked Questions

Which LED leg is positive?

The longer leg is usually the positive anode. The shorter leg and flat edge of the LED body identify the negative cathode.

Why is a resistor required?

It limits current to a safe level

Can I use a resistor other than 220 ohms?

A nearby value such as 330 ohms is generally suitable and may make the LED slightly dimmer. Avoid very low resistance values.

Will connecting the LED backward damage it?

At the Pico voltage it normally will not light and is unlikely to be damaged briefly. Disconnect power and correct its orientation rather than leaving it reversed.

Can I use the Pico onboard LED instead?

Yes

Project complete

Ready for Read a Push Button with Raspberry Pi Pico?

Read a push button with Raspberry Pi Pico and use a digital input on GP14 to control an LED on GP15 with beginner-friendly MicroPython.