How to Simulate LED Blinking with Raspberry Pi Pico in Wokwi: Step-by-Step Tutorial

How to Simulate LED Blinking with Raspberry Pi Pico on Wokwi | MakeMindz
🔗 Free Series: 20 Raspberry Pi Pico Projects on Wokwi — View all projects →
Electronics & IoT

How to Simulate LED Blinking with Raspberry Pi Pico on Wokwi

✅ Beginner Friendly 📅 February 2026 ⏱ 10 min read 🛠 No hardware needed

Learn how to blink an LED using a Raspberry Pi Pico — entirely in your browser. This tutorial walks through Wokwi setup, wiring, MicroPython code, and the complete diagram.json — no hardware required.

What is Wokwi?

Wokwi is a free, browser-based electronics simulator that lets you build and test embedded systems projects without any physical components. It's ideal for students, hobbyists, and educators.

🍓 Raspberry Pi Pico ⚡ Arduino Uno 📡 ESP32 DevKit V1 🌐 NodeMCU
📚

Learning Electronics

Safe environment to experiment
🔬

Testing Circuits

Validate designs instantly
🐛

Debugging Code

Serial monitor & live feedback
🌐

IoT Prototyping

WiFi, sensors, and more

Step-by-Step: LED Blinking on Wokwi

  1. 1

    Open Wokwi and Create a New Project

    Open your browser and go to wokwi.com. Click "New Project" and select Raspberry Pi Pico as your board. Wokwi will generate a blank project with the Pico already placed on the canvas.

    💡

    No account needed to run simulations — but signing up (free) lets you save and share your projects.

  2. 2

    Add Components

    Click the blue "+" button in the top-right of the canvas to open the component picker. Add the following:

    • LED — choose Red or any color you like
    • Resistor — set value to 220Ω or 330Ω
  3. 3

    Position Components

    Drag the LED to the left of the Pico. Place the resistor between the Pico's GP5 pin and the LED's anode (+). Neat placement makes wiring easier — think of it as a real breadboard layout.

  4. 4

    Wire the Circuit

    Click on a pin to start a wire, then click another to connect. Follow this wiring table:

    From To Wire Color
    GP5 (Pin 7) Resistor leg 1 Green
    Resistor leg 2 LED Anode (+) Green
    LED Cathode (–) GND (Pin 3) Black
    ⚠️

    Always use a resistor in series with an LED. Without it, excess current will burn out the LED (and potentially the GPIO pin).

  5. 5

    Write the MicroPython Code

    Click on the code editor tab (left panel) and paste the following MicroPython program:

    MicroPython — main.py
    from machine import Pin
    from utime import sleep
    
    sleep(0.01)  # Wait for USB to initialise
    print("Hello, Pi Pico!")
    
    led = Pin(5, Pin.OUT)  # GP5 = physical pin 7
    
    while True:
        led.toggle()    # Flip LED state
        sleep(0.5)      # 500ms on / 500ms off

    How it works: Pin(5, Pin.OUT) sets GP5 as an output. led.toggle() flips its state every 0.5 seconds, creating the blink effect.

  6. 6

    Run the Simulation

    Click the green ▶ Play button at the top of Wokwi. You should see the red LED blinking on and off every half second. The serial monitor will also print "Hello, Pi Pico!" on startup.

diagram.json — Complete Circuit Definition

Wokwi stores circuits as a diagram.json file. Copy the code below and paste it into the diagram.json tab in your Wokwi project to instantly recreate this circuit.

JSON — diagram.json
{
  "version": 1,
  "author": "MakeMindz",
  "editor": "wokwi",
  "parts": [
    {
      "type": "wokwi-pi-pico",
      "id":   "pico",
      "top":  0,
      "left": 0,
      "rotate": 0,
      "hide": false,
      "attrs": {}
    },
    {
      "type": "wokwi-led",
      "id":   "led1",
      "top":  -2.67,
      "left": -65.33,
      "rotate": 0,
      "hide": false,
      "attrs": { "color": "red" }
    }
  ],
  "connections": [
    [ "pico:GP5",   "led1:A", "green", [ "h0" ] ],
    [ "pico:GND.2", "led1:C", "black", [ "h0" ] ]
  ]
}
📌

Note: This simplified diagram connects GP5 directly to the LED anode without an explicit resistor part, as Wokwi's LED model includes internal current limiting. For real-world hardware, always add a 220Ω–330Ω resistor.

All 20 Raspberry Pi Pico Projects

This tutorial is part of a complete series. Work through them in order to build your skills progressively.

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course