Learn

Wiring a Diode to a Raspberry Pi 4B — Blocking Current in One Direction

Wire a 1N4148 or 1N4007 diode in series with an LED and see it block current when reversed — the one real behavior a diode exists to demonstrate, no code required.

Note: the Diode is a Premium-tier component in the simulator — you’ll need a Premium or VIP plan to use it there.

Try this directly in the free Raspberry Pi 4B simulator — no hardware or signup required. New to the GPIO header? Start with the interactive pinout guide.

What you’ll need

  • Raspberry Pi 4B
  • Diode (1N4148 or 1N4007)
  • Resistor (~220Ω)
  • LED

Step by step

  1. Drag Raspberry Pi 4B, a Diode, a Resistor, and an LED onto the Canvas.
  2. Hover over the Diode's two pins to confirm the labels: Anode and Cathode. The darker banded end is always the cathode — current only flows anode → cathode, never the other way.
  3. Wire the forward direction first: Pi's 3.3V pin → Diode's Anode. Diode's Cathode → the Resistor → the LED's anode (+). LED's cathode (−) → a Pi GND pin.
  4. Click Start.
  5. You should see the LED light up immediately — the diode is forward-biased (current flowing anode → cathode), so it conducts and the resistor lets the LED light normally.
  6. Now reverse the diode without touching anything else: move the wire that was on the Anode over to the Cathode, and the wire that was on the Cathode over to the Anode — so the Pi's 3.3V pin now reaches the Cathode first.
  7. Click Start again.

How to test it with the Digital Multimeter. This works even while the simulation is stopped.

  1. Drag a Digital Multimeter onto the Canvas. Click it and set its Mode to Continuity/Resistance.
  2. Wire the meter across the diode: Probe (+) → the diode's Anode. Probe (− / COM) → the diode's Cathode. In this mode the probes do not change the circuit.
  3. With the diode wired the correct way (Pi 3.3V → Anode), read the meter. Then reverse the diode as in the steps above and read it again.

What “working correctly” looks like

  • How to test it: the meter reads 0.0 Ω when the diode is wired the correct way, because the diode conducts. It reads OPEN when the diode is reversed, because the diode blocks. The simulator treats a forward diode as a plain conductor, so it does not show the small voltage drop a real diode has.
  • Wired the correct way (Pi power → Anode → Cathode → resistor → LED), the LED lights the instant Start is clicked, with no code at all.
  • Wired backward (Pi power → Cathode → Anode → resistor → LED), the LED stays off — the diode is now reverse-biased and blocks current, exactly like a real diode would.

If something’s wrong

  • LED never lights in either orientation → double-check the LED's own anode/cathode aren't swapped too; two reversed parts in the same circuit can cancel each other out and hide whether the diode itself is working.
  • LED lights in BOTH orientations → confirm you actually moved both wire ends when reversing the diode, not just one — the Cathode and Anode need to fully swap positions, not just one wire moving.