What an LED Is and How It Differs from a Regular Bulb
An LED — Light Emitting Diode — produces light through a fundamentally different process than an incandescent bulb. A traditional bulb works by passing current through a thin tungsten filament until it gets hot enough to glow. This is spectacularly inefficient: most of the energy becomes heat, not light, and the filament eventually burns through.
An LED works through electroluminescence. When current flows across the junction between two semiconductor materials (typically gallium-based compounds), electrons release energy directly as photons of light. There is no filament, no heat-driven glow, and no warm-up time. The light is produced almost instantly, the process is far more efficient, and the device can last tens of thousands of hours under normal operating conditions.
The word “diode” is the key to understanding how LEDs behave electrically. A diode is a one-way valve for current — it allows current to flow in one direction (forward biased) and blocks it in the other (reverse biased). This means polarity matters. Connect an LED backwards and it won’t light up; no current flows, so no light is produced. Fortunately, LEDs have a built-in indicator: the longer leg (anode) is positive, the shorter leg (cathode) is negative. The flat edge on the base of the LED body also marks the cathode side.
The other critical difference from a bulb is that LEDs have no inherent resistance. A bulb’s filament has resistance that naturally limits how much current flows through it. An LED, once forward biased past its threshold voltage, will draw as much current as the source can supply — and destroy itself in the process. This is why a resistor is not optional. It is a fundamental requirement of any LED circuit, and understanding why leads directly into the two numbers that define every LED’s behaviour.
Forward Voltage and Forward Current — The Two Numbers That Matter
Every LED is characterised by two key electrical parameters: its forward voltage (Vf) and its forward current (If).
Forward Voltage
Forward voltage is the voltage drop that appears across the LED when it is conducting. It is not the supply voltage — it is the voltage the LED itself consumes. Think of it as the LED’s “price of admission” for current to flow. Below this threshold, essentially no current flows and the LED stays off. Above it, current flows and light is produced.
Forward voltage varies by colour, because different colours require different semiconductor materials, which have different energy gaps:
| LED Colour | Typical Forward Voltage (Vf) | Typical Forward Current (If) |
|---|---|---|
| Infrared | 1.2 V | 20 mA |
| Red | 1.8 – 2.2 V | 20 mA |
| Orange | 2.0 – 2.2 V | 20 mA |
| Yellow | 2.0 – 2.4 V | 20 mA |
| Green | 2.0 – 3.5 V | 20 mA |
| Blue | 3.0 – 3.5 V | 20 mA |
| White | 3.0 – 3.5 V | 20 mA |
These are typical values — always check the datasheet for the specific LED you’re using, as values vary between manufacturers. If you don’t have a datasheet, use the middle of the typical range as your working estimate.
Forward Current
Forward current is the amount of current the LED is designed to operate at. For standard 5 mm through-hole LEDs — the kind in a typical LED assortment — this is almost universally 20 mA (0.02 A). This is the current at which the LED produces its rated brightness without overheating.
Many Arduino circuits actually run LEDs at 10 mA to extend their lifespan and reduce load on the microcontroller’s output pin, which is rated at a maximum of 40 mA. At 10 mA, brightness is noticeably reduced but still perfectly adequate for indicators and basic projects. The critical thing is never to exceed the maximum rated current — even briefly — as this can degrade the junction and permanently reduce brightness or destroy the LED outright.
Calculating the Current-Limiting Resistor
The resistor’s job is to absorb the difference between your supply voltage and the LED’s forward voltage, dropping whatever is left over and limiting current to the safe operating value. The formula comes directly from Ohm’s Law:
R = (Vsupply − Vf) / If
Where R is resistance in ohms, Vsupply is your supply voltage, Vf is the LED’s forward voltage, and If is the desired forward current in amperes.
Worked Example 1: Red LED on 5 V Arduino
Supply voltage: 5 V. Red LED forward voltage: 2.0 V. Desired current: 20 mA (0.02 A).
R = (5 − 2.0) / 0.02 = 3.0 / 0.02 = 150 Ω
150 Ω is a standard value. Use it directly.
Worked Example 2: Blue LED on 5 V Arduino
Supply voltage: 5 V. Blue LED forward voltage: 3.2 V. Desired current: 20 mA.
R = (5 − 3.2) / 0.02 = 1.8 / 0.02 = 90 Ω
90 Ω is not a standard value. Round up to 100 Ω. Rounding up means slightly less current than designed for — the LED will be very slightly dimmer but fully protected. Never round down significantly, as this increases current above the rated value.
Worked Example 3: White LED on 3.3 V (ESP32 or 3.3 V Arduino)
Supply voltage: 3.3 V. White LED forward voltage: 3.0 V. Desired current: 10 mA (0.01 A) — conservatively derated.
R = (3.3 − 3.0) / 0.01 = 0.3 / 0.01 = 30 Ω
Use 33 Ω, the nearest standard value. Notice how little headroom there is between a white LED’s forward voltage and a 3.3 V supply — this is why white and blue LEDs can be problematic at 3.3 V. If Vsupply is lower than or equal to Vf, the LED simply won’t conduct and no current flows regardless of the resistor value.
Worked Example 4: Red LED on 12 V Power Supply
Supply voltage: 12 V. Red LED forward voltage: 2.0 V. Desired current: 20 mA.
R = (12 − 2.0) / 0.02 = 10 / 0.02 = 500 Ω
Use 510 Ω. Also check the power dissipation: P = I² × R = (0.02)² × 510 = 0.204 W. A standard 1/4 W resistor is marginal here — use a 1/2 W resistor. This is a commonly overlooked step: at higher supply voltages, the resistor dissipates more power and needs to be rated accordingly.
Having a well-stocked resistor kit means you’ll always have the nearest standard value to hand, without needing to order specific values for every project.
Wiring an LED to Arduino
The physical connection is simple. On a solderless breadboard, the circuit goes:
- Arduino digital output pin → resistor → LED anode (long leg) → LED cathode (short leg) → Arduino GND
The resistor can go on either side of the LED — before the anode or after the cathode — and it works identically either way. Convention places it before the anode (between the supply pin and the LED), but this is purely stylistic.
For initial testing, use pin 13 on the Arduino Uno — it has a built-in LED already connected to it on the board, so you can verify your code is running before worrying about external wiring. Once you’re confident in the code, move to any other digital pin (2 through 13 on the Uno) for external LEDs.
Double-check polarity before powering on. A reversed LED won’t be damaged at 5 V — it simply won’t light up — but it’s good practice to verify orientation before every power-on.
Basic Blink Code
The blink sketch is the “hello world” of Arduino programming. It turns an LED on, waits, turns it off, and repeats:
const int LED_PIN = 9; // Change to your chosen pin
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, HIGH); // LED on
delay(1000); // Wait 1 second
digitalWrite(LED_PIN, LOW); // LED off
delay(1000); // Wait 1 second
}pinMode(LED_PIN, OUTPUT) configures the pin to drive voltage rather than read it. digitalWrite(HIGH) sets the pin to approximately 5 V; digitalWrite(LOW) brings it to 0 V. With the LED and resistor in series between the pin and GND, HIGH turns it on and LOW turns it off.
Change the delay() values to control the blink rate. Use 500 for a faster 0.5 second blink, or 100 for a rapid strobe effect. Try different values to get a feel for how delay() works — it pauses the entire sketch for the specified number of milliseconds.
PWM Dimming with analogWrite()
Digital pins can only be fully on or fully off. To dim an LED, you need a way to deliver something in between — and Arduino achieves this with PWM (Pulse Width Modulation).
PWM works by switching the pin on and off very rapidly — faster than the eye can follow — and varying the ratio of on-time to off-time. This ratio is called the duty cycle. A 50% duty cycle means the pin is on half the time and off half the time; to the eye, the LED appears at roughly half brightness. A 10% duty cycle produces a dim glow; 90% produces near-full brightness.
On the Arduino Uno, pins 3, 5, 6, 9, 10, and 11 are PWM-capable, marked with a tilde (~) on the board. The analogWrite() function controls them:
const int LED_PIN = 9; // Must be a PWM pin (~)
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// Fade in
for (int brightness = 0; brightness <= 255; brightness++) {
analogWrite(LED_PIN, brightness);
delay(10);
}
// Fade out
for (int brightness = 255; brightness >= 0; brightness--) {
analogWrite(LED_PIN, brightness);
delay(10);
}
}analogWrite() accepts a value from 0 (fully off) to 255 (fully on). It does not output an analogue voltage — it outputs a PWM signal. The LED responds to the average power delivered and appears to dim smoothly. The PWM frequency on the Arduino Uno is approximately 490 Hz on most pins (980 Hz on pins 5 and 6), which is fast enough that the human eye perceives a steady, dimmed light rather than a flicker.
Note on Non-PWM Pins
Calling analogWrite() on a non-PWM pin has no effect on some Arduino versions and unpredictable results on others. Always verify that your chosen pin has the tilde (~) marking before using analogWrite().
Multiple LEDs — Series vs Parallel
As soon as you work with more than one LED, you have a choice: wire them in series or in parallel.
LEDs in Series
In a series configuration, the LEDs are chained end to end — the cathode of the first connects to the anode of the second, and so on. The same current flows through all of them, and the forward voltages add up.
For two red LEDs in series on a 5 V supply: Vf total = 2.0 + 2.0 = 4.0 V. R = (5 − 4.0) / 0.02 = 50 Ω. Use 56 Ω or 68 Ω.
The advantage of series wiring is that all LEDs share one resistor, so brightness is inherently matched — the same current flows through every LED. The disadvantage is that the forward voltages accumulate, which limits how many LEDs you can chain before you run out of headroom. Three red LEDs in series need at least 6 V; at 5 V, they won’t conduct at all.
LEDs in Parallel
In a parallel configuration, all anodes connect together and all cathodes connect together. Each LED has its own individual resistor — never share a single resistor across parallel LEDs.
The reason is that LEDs are not perfectly matched in their forward voltage. Even two LEDs from the same batch may differ by 0.1–0.2 V. With a shared resistor, the LED with the slightly lower Vf draws more current, runs hotter, its resistance drops further, it draws even more current — and it either dominates the others or burns out. Individual resistors eliminate this problem entirely by giving each LED its own current limit.
Parallel wiring is the standard approach for driving multiple LEDs from a single pin. Each LED + resistor branch is independent, and failure of one doesn’t affect the others.
Diffused vs Clear LEDs
LEDs come in two main optical styles, and the difference matters more than most beginners expect.
Clear (Water Clear) LEDs
Clear LEDs have a transparent epoxy lens. Almost all the light they emit comes out in a very narrow beam — typically 15° to 30° viewing angle. They appear intensely bright when you look directly into them, but from the side they look almost off. They are suited to applications where you need to project light in a specific direction: indicators visible from across a room, optical sensors, fibre optic illuminators, and panel-mount indicators viewed straight-on.
Diffused LEDs
Diffused LEDs have a frosted or milky epoxy lens that scatters the light across a wide angle — typically 60° to 120°. They appear less blinding when viewed directly but are visible from a much wider range of angles. They look like a glowing object rather than a point source, which makes them more natural-looking for decorative lighting, status indicators that need to be seen from multiple angles, and any application where the LED itself is meant to be aesthetically visible.
For most beginner projects — indicator LEDs on a breadboard, traffic light models, dice projects, status displays — diffused LEDs are the better choice. They’re easier to work with visually and more forgiving of alignment. A mixed LED assortment typically includes both types across multiple colours, which is ideal for experimenting and finding what suits each application.
Common Mistakes
The same errors appear repeatedly in beginner LED circuits. Knowing them in advance saves a lot of burnt components and frustrating debugging sessions.
No Resistor, or Wrong Resistor Value
Connecting an LED directly between an Arduino pin and GND — without a resistor — will work briefly, then destroy either the LED, the pin driver, or both. The LED appears to light up normally for a few seconds before failing. Always calculate the resistor value before powering on. If you can’t calculate it and need to test quickly, a 470 Ω resistor is a safe conservative choice for any standard LED on a 5 V supply — the LED will be dimmer than optimal but fully protected.
Reversed Polarity
An LED inserted backwards will not light up and will not be damaged at 5 V (the reverse breakdown voltage of a typical LED is around 5 V, so it’s very marginal — don’t rely on this at higher voltages). If an LED refuses to light up despite correct code, check orientation first.
Using analogWrite() on a Non-PWM Pin
If your fade sketch doesn’t fade — it just turns the LED on at full brightness — you’re almost certainly using a non-PWM pin. Check for the tilde (~) marking on the board or in the pinout diagram.
Sharing One Resistor Across Parallel LEDs
Covered above, but worth repeating: one resistor per LED, always, in parallel configurations. This is the cause of uneven brightness and premature LED failure in many beginner multi-LED projects.
Exceeding the Arduino Pin Current Limit
Each Arduino Uno digital output pin is rated for a maximum of 40 mA. The entire chip has a combined maximum of 200 mA across all pins simultaneously. If you’re driving many LEDs, each drawing 20 mA, you will exceed the chip limit quickly — driving 10 LEDs at 20 mA each is 200 mA total, which is already at the absolute maximum with no margin. For projects with many LEDs, use a transistor or dedicated LED driver IC to switch the current externally, using the Arduino pin only as a low-power control signal.
Ignoring Resistor Power Rating
At 5 V this is rarely an issue, but at 12 V or higher supply voltages, the resistor may dissipate enough power to overheat. Calculate P = I² × R or P = V² / R and ensure the resistor’s wattage rating exceeds the calculated value with margin. Standard 1/4 W resistors are adequate for 5 V single-LED circuits; use 1/2 W or 1 W at higher voltages or currents.
Putting It All Together
LEDs are simple components, but they teach some of the most important concepts in electronics: diode behaviour, Ohm’s Law in practice, the difference between voltage and current, PWM as a dimming technique, and the realities of driving multiple loads from a microcontroller. Getting them right — not just making them light up, but understanding why each part of the circuit is there — builds the foundation for every more complex project that follows.
To get started, you’ll need an LED assortment covering multiple colours and types, a resistor kit with the full range of standard values, a solderless breadboard to prototype without soldering, and an Arduino Uno to bring it all to life. With those four things, you can work through every example in this guide and have the building blocks for hundreds of projects beyond it.
