Source: https://mokxi.com/parts/led
Updated: 2026-09-27

Part

# LED

Lights when current flows. Five colors, and the brightness is what your eye would see.

or see every part

- 2 pins
- 1 property

Drawn live by the editor's own code, at the size you see it.

Reference

## Every one of its 2 pins

Pin

What it does

A

Anode. Current goes in here.

C

Cathode, the shorter leg on a real part. Current comes out here.

This part

## What it does

An LED is a diode, not a resistor. Below about 1.5 volts a red one barely conducts; past that its current climbs exponentially with the voltage across it, so it takes whatever the rest of the loop can push through it while its own drop hardly moves. That is why an LED always needs a series resistor to set its current, never a bare wire to the supply: the resistor is what actually does the limiting. Mokxi models the Shockley equation itself rather than a fixed drop, so the anode net sits where the curve puts it (1.72 V for a red LED at 14.9 mA, and lower at lower currents) at whatever value the circuit’s resistor sets. What you see is not the instantaneous state either. The probe is a short-lived average of the LED’s brightness, with a time constant close to 8 milliseconds, the same range the eye’s own response takes, which is why a fast-blinking or PWM-dimmed LED here looks the way it would on a real bench rather than flickering once per switch.

Reference

## The one property you can set

Property

Default

What it means

color

red (or green, blue, yellow, white)

red, green, blue, yellow or white. It changes the picture and the die:
each color is specified by its drop at 20 mA, which is how a datasheet
specifies one. Red 1.8 V, yellow 2.0 V, green 3.0 V, blue 3.0 V, white 3.1 V.

How it is modeled

## What is true about the LED, here

### What is modeled

The LED is a diode and the diode is the Shockley equation,
I = Is (exp(Vj / (N Vt)) - 1), with N = 2 and 12 ohm of bulk resistance, and
the color's drop at 20 mA is what sets Is. So the drop is not a number the
part carries around: it is whatever the curve gives at the current the circuit
is passing. A 5 V rail through 220 ohm lights a red LED at 14.9 mA with
1.72 V across it, and the same LED on 3.3 V through 220 ohm passes 7.7 mA
at 1.60 V. The drop falls with the current, which is what a real LED does and
what a fixed drop could never show.

Blue and white changed on September 17, 2026. They were 2.2 V while the model
was a fixed drop and they are 3.0 V and 3.1 V now, because that is what a real
blue die does, so a blue LED on 5 V through 220 ohm passes 9.8 mA where it used
to pass 11.9 mA: about a fifth less light, and correct. On a 3.3 V rail the
difference is much larger: 2.8 mA against the 7 mA the old model claimed, which
is the real reason a blue LED looks dim on a 3.3 V board.

The LED loads the net it is on, the way a real diode does, and below about a
nanoamp of forward current it lets go of both nets entirely: no leakage, no
reverse current. The probe is not the instantaneous brightness either: it is an
8 ms rolling average of it, the same time constant your own retina uses, so a
PWM-dimmed LED reads as dimmed rather than as a random flicker.

### Not modeled

One curve per color, and no spread. Real LEDs of the same color vary by a
couple of hundred millivolts from part to part; every red LED here is the same
red LED. The bulk resistance is 12 ohm and the emission coefficient 2 for every
color, which is the middle of the range indicator LEDs sit in rather than a
measurement of any one part.

No junction capacitance and no temperature. The junction is at 27 C and
stays there, where a real LED's drop moves about 2 mV a degree, and it switches
in nothing flat. There is no reverse breakdown either: reverse biased it passes
its saturation current, which is femtoamps, however much you put across it.

Full brightness is 20 mA and the probe stops there. Brightness is the forward
current divided by 20 mA and clamped at 1, so 20 mA and 200 mA look identical on the
canvas even though the probe reports the current honestly.

No maximum current and no burnout. Wire an LED straight across a 5 V rail with nothing
in series and it lights at whatever current the diode drop allows, and the probe will
tell you that current honestly. A real LED would not survive it. There is no smoke
here on purpose: a mistake you can read off the probe teaches more than a part that
silently vanishes.

### LEDs, seven-segment dies and RGB LEDs (`led`)

model | what sets it

the same equation, with N = 2 and 12 ohm of bulk | the color's drop at 20 mA: red 1.8 V, yellow 2.0, green 3.0, blue 3.0, white 3.1

From LED, in full.

Projects

## See the LED in a project

Shown here on: ESP32-C3-DevKitM-1, Arduino Uno R3, Raspberry Pi Pico, STM32F411 Black Pill, ATtiny85, Arduino Nano, Arduino Leonardo, ESP32 DevKit V1, ESP8266 NodeMCU V1.0, Raspberry Pi Pico W, STM32 Blue Pill (F103), Arduino Uno R4 Minima, BBC micro:bit V2, Arduino Pro Mini, Arduino Micro, SparkFun Pro Micro, Wemos D1 mini, ESP-01S, Seeed XIAO ESP32-C3, ESP32-C3 SuperMini

Learn

## Where it turns up in a lesson

### In the twelve week course

- Week 1: Current, voltage and the breadboard
- Week 2: Blink: the first program
- Week 3: Buttons, pull-ups and contact bounce
- Week 4: Timing without a processor: the 555
- Week 5: Logic gates, as real chips
- Week 6: Arithmetic from gates: the full adder
- Week 7: Memory: flip-flops and counters
- Week 8: More outputs than pins: the shift register
- Week 9: Pulse width modulation and the eye
- Week 11: Interrupts: events instead of polling
- Week 12: Project week: two boards, one wire

### In a learn article

- Connect a Board to WiFi and Serve a Page
- How to Use a Breadboard: Your First Circuit
- Ohm's Law, in a Circuit You Can Run
- Picking a Resistor for an LED
- Pull-Up Resistors and the Floating Input They Fix
- Debouncing a Button: Why It Fires More Than Once
- PWM: Faking an Analog Voltage on a Digital Pin
- Logic Gates, and the Truth Table You Can Press
- Shifting a Byte In, One Edge at a Time
- Blink an LED with Arduino: Wiring and the Resistor
- Arduino Blink Without Delay: Two LEDs, Two Rates
- Arduino PWM Fade: analogWrite, Pins and the Curve
- Blink an LED on the ESP32-C3, Step by Step
- Blink an LED with a 555 Timer, No Microcontroller
- Arduino Simulators Compared: An Honest Roundup
- How to Simulate an Arduino Project Without Hardware
- Arduino Traffic Light with a Crossing Button
- Arduino Ultrasonic Sensor (HC-SR04) Tutorial
- Arduino 4x4 Keypad Code Lock with a Relay
- Arduino MPU6050: Accelerometer and Tilt
- Arduino Potentiometer: analogRead and a Dimmer
- Arduino LDR Night Light (Photoresistor)
- Arduino IR Remote: Decode NEC, Switch Lamps
- Arduino Joystick Module: Wiring, Code, Live Demo
- Arduino Buzzer and Piezo: Beeps, Notes, Metronome
- PIR Motion Sensor: How It Works, With an Arduino
- Series vs Parallel Circuits, Seen With LEDs
- The 555 Monostable: One Press, One Timed Pulse
- An Op-Amp as a Comparator, With Hysteresis
- Arduino State Machine: A Four-State Reaction Game
- ESP32 analogRead: 12 Bits, Attenuation and ADC2
- Raspberry Pi Pico PWM: Slices, Channels and 1 kHz
- STM32 Blue Pill Blink with Registers, Not pinMode
- Arduino Uno vs ESP32 vs Pico: Which to Learn First?
- Multisim Live Is Gone: A Chromebook Alternative
- Digital Electronics on Chromebooks: Labs by Unit
- Half Adder and Full Adder: Truth Table to Breadboard
- Flip-Flops Explained: SR Latch, D and JK Flip-Flops
- How to Use a Multimeter: Practice on a Virtual One
- Arduino Science Fair Projects With a Real Hypothesis
- Reaction Time Science Fair Project With an Arduino
- Engineering Science Fair Project: How to Write It Up
- 555 Timer Projects for a Science Fair (No Coding)
- Circuit Lab Division B: Middle School Starter Guide
- TSA Electrical Applications: Practice Circuits
- Arduino Simulator for Chromebook, Free in Chrome
- Arduino Projects for Beginners, Each One Running
- Arduino LED Not Lighting Up or Dim: What to Check
- Arduino Compile Errors Explained, With the Fixes
- How to Debug Arduino Code: Prints to Breakpoints
- Arduino Relay Module: Active LOW and Startup Clicks

More parts

## The rest of the bench

Every one of these is drawn and simulated the same way.

Full-size breadboard

A real 0.1 inch grid with the rails and the center channel, 63 columns wide.

Jumper wires

Drag from any pin or hole to any other. Corners snap, and you can drag them.

Power

A supply rail at the voltage you choose.

Ground

The other end of every circuit.

Resistor

Any value you like, with the color bands drawn to match.

ESP32-C3-DevKitM-1

A RISC-V board that runs your firmware at 160 MHz on the real memory map.

Pushbutton

A 12 mm tactile switch. Hold it while the simulation runs.

Raspberry Pi Pico

The RP2040 board on our own Cortex-M0+ core. Pick a program and press Run.

Raspberry Pi Pico W

Raspberry Pi Pico W (RP2040). The same board and the same pinout as a Pico, with the CYW43439 on it. The WiFi is simulated (no radio, no real internet), and the on-board LED, which hangs off that chip rather than off GP25, is driven through the same path. Everything else is the Pico.

STM32F411 Black Pill

The Black Pill on our own Cortex-M4 core. Pick a program and press Run.

BBC micro:bit V2

The nRF52833 board with its 5x5 LED matrix, buttons A and B and a speaker. Wire the rings to a breadboard.

STM32 Blue Pill (F103)

The Blue Pill on our own Cortex-M3 core, with an ADC. Pick a program and press Run.

See every part

## Wire up the LED

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.

Start building Open the editor
