Volume 04 Beginner 5 sub-modules ~15 min read

Diodes and LEDs

A diode lets current through one way only, and that one trick does a surprising amount of work. This volume shows why a silicon diode takes about 0.7 V, how to choose the resistor every LED needs, how one diode guards a circuit against a reversed battery, how four diodes and a capacitor turn alternating current into steady direct current, and how a Zener diode holds a voltage.

You will learn
  • How a diode conducts one way and blocks the other, and why this course calls its drop 0.7 V
  • How to choose the series resistor for one LED or several
  • How a series diode protects a circuit from a reversed battery, and what it costs
  • How half-wave and bridge rectifiers work, and how a smoothing capacitor reduces the ripple
  • How a Zener diode holds a steady voltage, and where its limits are
You need
  • Volume 03: capacitors and the RC time constant.

4.1 The diode: a one-way valve

A diode lets current flow one way only. Forwards, it conducts and takes about 0.7 V; backwards, it blocks. It is a one-way valve for current.

The one-way valve

A diode has two leads. Current flows in at the anode and out at the cathode. The symbol is an arrow pointing the way current can flow, with a bar across its tip. The bar matches the stripe painted round one end of a real diode: that end is the cathode.

Two lamps, each behind a diode, one diode each way round + B1 9 V D1 L1 83 Ω D2 L2 83 Ω
Figure 4.1 - D1 points the way conventional current wants to flow, so L1 lights. D2 is the other way round, so it blocks, and L2 stays dark.

circuit one-way: L1 carries 100 mA and lights; L2 carries 0 A
(9 V - 0.7 V) / 83 Ω = 100 mA

L1's diode is forwards, so it conducts. It takes 0.7 V, and the other 8.3 V drives the current through L1. L2's diode is backwards, so no current flows through it at all.

Why 0.7 V?

A real silicon diode does not switch on sharply. Below about 0.6 V, hardly any current flows. Above it, the current climbs very steeply:

Current against voltage for a small silicon diode 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0 10 20 30 40 voltage across the diode (V) current (mA)
Figure 4.2 - Almost nothing flows below 0.6 V. Then the current shoots up: from 1 mA to 40 mA, the voltage only rises from about 0.65 V to 0.75 V.

1 mA flows at 0.655 V
10 mA flows at 0.714 V
40 mA flows at 0.750 V

Over the currents that circuits use, the voltage hardly moves. So this course treats a conducting silicon diode as a fixed forward voltage of 0.7 V, and a diode that is not conducting as an open gap.

Remember

The stripe on a diode marks the cathode. Current flows into the anode and out of the cathode - the way the symbol's arrow points.

Quick check

A diode's anode is at 5 V and its cathode at 9 V. Does it conduct?

Show the answer

Answer: A. Current can only flow from anode to cathode, which needs the anode about 0.7 V higher than the cathode. Here the cathode is 4 V higher, so the diode is backwards and no current flows.

4.2 LEDs and their series resistor

An LED is a diode that gives out light. Once it conducts, its voltage barely changes, so it cannot limit its own current. A resistor in series sets the current.

A diode that shines

LED stands for light-emitting diode. It works one way only, like any diode, but its forward voltage is higher, and depends on its colour:

Colour Forward voltage, roughly
Red 2 V
Yellow 2.1 V
Green 2.2 V, or 3 V for bright green
Blue 3 V
White 3 V

The longer lead is the anode, and the flat edge on the rim marks the cathode. Most small LEDs want about 10 mA to 20 mA.

The series resistor

A red LED with a 150 ohm series resistor on 5 V + B1 5 V R1 150 Ω D1
Figure 4.3 - R1 sets the current. The LED takes its forward voltage of about 2 V, and the other 3 V is across R1.

circuit led: 20 mA flows; the LED drops 2 V and R1 has 3 V across it
the LED uses 40 mW and R1 turns 60 mW into heat

The LED takes its 2 V, and R1 takes the rest. Ohm's law on R1 then sets the current. Turned round, it gives the resistor for any LED:


R = (supply voltage - LED voltage) / current

5 V, a blue LED (3 V) at 10 mA: R = 200 Ω; the E12 value above is 220 Ω, giving 9.09 mA
3.3 V, a red LED (2 V) at 10 mA: R = 130 Ω; the E12 value above is 150 Ω, giving 8.67 mA
12 V, three red LEDs (2 V each) in series at 20 mA: R = 300 Ω; the E12 value above is 330 Ω, giving 18.2 mA

Round up to the next E12 value, so the current comes out slightly below the target, never above. LEDs in series share one current and one resistor, and their voltages add.

Why the resistor is not optional

Without a resistor, nothing but the battery's own internal resistance limits the current:


an LED straight across a 5 V battery with 1 Ω inside: 3 A - the LED burns out at once
Common mistake

Connecting an LED straight to a supply, or to a microcontroller pin, with no resistor. Its voltage stays near its forward voltage whatever the current, so the current rises until something burns out. Always put a resistor in series.

Quick check

A green LED of 2.2 V runs from 5 V at 14 mA. Which resistor sets that current?

Show the answer

Answer: C. R = (5 V - 2.2 V) / 14 mA = 2.8 V / 14 mA = 200 Ω.

4.3 Protecting against a reversed battery

A battery fitted backwards can destroy a circuit in a moment. One diode in series stops that: it conducts when the battery is the right way round, and blocks when it is reversed.

One diode in series

A diode protecting a circuit from a reversed battery + B1 9 V D1 R1 100 Ω
Figure 4.4 - The circuit being protected is shown as R1. With the battery the right way round, D1 conducts and the circuit gets the battery's voltage less 0.7 V. Reversed, D1 blocks.

circuit protect: battery the right way: the circuit gets 8.3 V and 83 mA; reversed: 0 V and 0 A

Reversed, the diode blocks, and nothing flows. Nothing is damaged, and the circuit works again as soon as the battery is turned round.

The price

The protection costs the diode's 0.7 V, all the time, and the power that goes with it:


the diode wastes 0.7 V x 83 mA = 58.1 mW

A Schottky diode drops only about 0.3 V, so it wastes less:


with a Schottky diode dropping 0.3 V: the circuit gets 8.7 V

For bigger currents, designers use a transistor wired to act like a diode with almost no drop. Volume 05 introduces the transistors that make that possible.

Quick check

A 5 V supply feeds a circuit through a protection diode that drops 0.7 V. What does the circuit get?

Show the answer

Answer: B. The diode takes its 0.7 V, leaving 5 V - 0.7 V = 4.3 V for the circuit.

4.4 Rectifiers: AC to DC

A rectifier turns alternating current into direct current by letting it through one way only. A bridge rectifier uses both halves of the wave, and a smoothing capacitor fills in the gaps.

Half-wave: one diode

Every plug-in power adapter starts with alternating current, which swings positive and negative. Here the input is a 10 V peak at 50 Hz:

A half-wave rectifier V1 D1 RL 1 kΩ Vout
Figure 4.5 - The signal source V1 swings positive and negative. D1 lets current through to the load RL only while V1 is positive.
A half-wave rectifier: the input and the output 0 5 10 15 20 25 30 35 40 -10 -5 0 5 10 time (ms) voltage (V) input output
Figure 4.6 - The output follows the positive half of each wave, less the diode's 0.7 V, and is zero for the whole negative half.

circuit half-wave: solved at every 0.5 ms for 40 ms; the output peaks at 9.3 V

The output is always positive, but it spends half its time at zero. That is direct current of a sort, but a very lumpy one.

The bridge: four diodes

A bridge rectifier uses four diodes to catch both halves. When the input's left side is positive, D1 and D4 conduct. When its right side is positive, D2 and D3 do. Either way, the current flows down through the load, from its top to its bottom:

A bridge rectifier with a smoothing capacitor D1 D3 D2 D4 V1 C1 100 µF RL 1 kΩ Vout
Figure 4.7 - The alternating input V1 sits between the two middle points of the bridge. Whichever way round V1 is, two of the four diodes steer the current down through the load RL and back, so Vout is always positive. C1 fills in the gaps.
A bridge rectifier: the input, the output, and the output with C1 0 5 10 15 20 25 30 35 40 -10 -5 0 5 10 time (ms) voltage (V) input without C1 with C1
Figure 4.8 - Without C1 the output is a string of humps, one for each half-wave. Each hump is 1.4 V lower than the input, because two diodes are in the path. With C1, the output only dips a little between the humps.

circuit bridge: solved at every 0.5 ms for 40 ms, without C1; the output peaks at 8.6 V

Smoothing

A capacitor across the output charges up at each peak, then feeds the load while the input falls away. It only tops up near the peaks. What is left is a small ripple:


with C1 the output ripples between 7.88 V and 8.60 V: a ripple of 0.72 V
rule of thumb: ripple = load current / (2 x frequency x C) = 8.6 mA / (2 x 50 Hz x 100 µF) = 0.86 V
the same C1 on the half-wave rectifier ripples by 1.54 V

The rule of thumb gives a little more ripple than the real circuit, which is the safe side to be wrong on. A bigger capacitor, or a smaller load current, means less ripple. The half-wave rectifier ripples twice as much, because it tops up only once a cycle.

How the rectifier numbers were worked out

Without C1, the solver worked out the whole circuit afresh every 0.5 ms, with the input at that moment's voltage, choosing for itself which diodes conduct. With C1, the rule is simple: while the rectified input is above the capacitor's voltage, the diodes conduct and the capacitor follows the input. Otherwise they block, and the capacitor empties into RL along its RC curve. That was stepped every 0.01 ms.

Quick check

Why is a bridge rectifier's output 1.4 V below the input's peak, not 0.7 V?

Show the answer

Answer: D. In a bridge, the current always goes through one diode on the way to the load and another on the way back. Two diodes take 0.7 V each: 1.4 V in all.

4.5 Zener diodes

A Zener diode is made to conduct backwards at a chosen voltage. Fitted backwards with a resistor, it holds its voltage steady, even when the supply changes.

Conducting backwards on purpose

An ordinary diode blocks backwards until the voltage is so high that it breaks down. A Zener diode is made to break down at a low, exact voltage, such as 3.3 V or 5.1 V, and it takes no harm from it. Forwards, it behaves like any diode.

A Zener diode holding a load at 5.1 V + B1 12 V R1 470 Ω D1 5.1 V RL 1 kΩ Vout
Figure 4.9 - R1 drops whatever voltage the Zener does not need. The Zener D1 is fitted backwards, and conducts just enough to hold its own voltage at 5.1 V. The load RL shares the 5.1 V.

circuit zener: Vout = 5.1 V; R1 carries 14.7 mA, RL takes 5.1 mA and the Zener takes 9.58 mA

R1 carries a current from the supply, and the load takes what it needs. The Zener soaks up the rest, and while it conducts, its voltage stays at 5.1 V.

A steady output from a changing supply

Supply Vout Zener current
10 V 5.1 V 5.33 mA
12 V 5.1 V 9.58 mA
14 V 5.1 V 13.8 mA

The supply changes by 4 V, but the output does not move. Only the Zener's share of the current changes.

The limit

The Zener can only hold its voltage while there is current left over for it. A load that wants more than R1 can supply takes it all, and then the Zener switches off:


with a 200 Ω load instead: the Zener turns off and Vout falls to 3.58 V

A Zener also wastes power, most of all with no load at all:


the Zener turns 74.9 mW into heat with no load

So Zeners suit small, light jobs, such as a reference voltage. To power a real circuit, Volume 07's voltage regulators do the job far better.

Quick check

In the Zener circuit, the supply rises from 12 V to 14 V. What happens?

Show the answer

Answer: C. While the Zener conducts, it holds 5.1 V. The extra current from R1 goes through the Zener, which rises from 9.58 mA to 13.8 mA, and the load does not notice.

What you learned

Key words from this volume

Every word below has a plain-English entry in the glossary.

Practice

Practice 1

A red LED on 9 V

A red LED (2 V) should run at 15 mA from a 9 V battery. Which resistor, and what current does it give?

Show the solution

9 V, a red LED (2 V) at 15 mA: R = 467 Ω; the E12 value above is 470 Ω, giving 14.9 mA
Practice 2

Two white LEDs

Two white LEDs (3 V each) run in series from 9 V at 20 mA. Which resistor do they need?

Show the solution

9 V, two white LEDs (3 V each) at 20 mA: R = 150 Ω; the E12 value is 150 Ω, giving 20 mA

150 Ω is itself an E12 value, so the current comes out exactly on target.

Practice 3

A 3.3 V Zener

A 3.3 V Zener and a 330 Ω resistor run from 9 V, with a 1 kΩ load. Find the output and the currents.

Show the solution

9 V, 330 Ω and a 3.3 V Zener with a 1 kΩ load: Vout = 3.3 V; R1 17.3 mA, load 3.3 mA, Zener 14 mA
Practice 4

A bigger bridge

A bridge rectifier is fed with an alternating input of 12 V peak. What is the output's peak?

Show the solution

a bridge fed with a 12 V peak gives a 10.6 V peak

Two diodes are always in the path, so the output peak is 12 V - 1.4 V.

Interview corner

Interview question 1

Why an LED needs a resistor

"Why does an LED need a series resistor, when a lamp doesn't?"

Show the solution

"A lamp's filament is a resistor, so it limits its own current. An LED is a diode: once it conducts, its voltage stays almost fixed at its forward voltage, however much current flows. So nothing in the LED limits the current, and a supply only slightly above the forward voltage drives far too much. A series resistor takes up the difference between the supply and the forward voltage, and Ohm's law on that resistor sets the current."

Volume 05 meets the transistor, which lets a small current switch a large one on and off.