Let current flow one way with a diode

A diode is a one-way street for electric current. Build a circuit with two buttons, three LEDs and two diodes, then flip a diode and swap the diodes for wires to see what happens when current can flow backwards. No...
  • Level:Beginner
  • Duration: 40 min
  • Ages 8+
  • Platform: Arduino

What you'll need

Tools for this lesson

Helpful for this build. Open a tool to see tips and more projects that use it.

Let current flow one way with a diode – EEMENTOR STEM™ lesson

Have you ever put batteries into a torch the wrong way round? In many gadgets nothing breaks: a small part called a diode simply stops the current. A diode lets electricity flow in one direction only, like a one-way street or the valve in a bicycle tyre. In this lesson you build a little circuit with two buttons, three LEDs and two diodes. Each button lights its own LED, and both can light a shared yellow LED. Then you turn a diode round and replace the diodes with plain wires, and find out why so many circuits need these small black parts. Like every lesson in this path, there is no program to write: the UNO is only the power supply.

What you'll learn

  • What a diode does, and how to find its two ends from the stripe
  • Why a diode only lets current through one way round
  • How two diodes let two buttons share one LED without mixing up their own LEDs
  • Why an LED is a diode too, and why it only lights one way round
  • What forward voltage means, and why the light through a diode is a little dimmer

What you need

  • UNO R3 board and USB cable (UNO R3 Starter Kit)
  • 2 rectifier diodes 1N4007 (UNO R3 Starter Kit)
  • 2 push buttons (UNO R3 Starter Kit)
  • 3 LEDs: red, yellow and green (UNO R3 Starter Kit)
  • 3 resistors, 220 Ω (red, red, brown) (UNO R3 Starter Kit)
  • Breadboard and jumper wires (UNO R3 Starter Kit)

What is a diode?

A diode is made of two layers of silicon that are prepared in different ways. Where they touch, a thin border forms that charge can only cross in one direction. Push current the right way and the border opens: the diode conducts. Push it the other way and the border gets wider: almost no current gets through. The right way is called forward, the wrong way reverse.

The diodes in the kit are 1N4007 rectifier diodes: small black cylinders with a wire at each end and a grey or silver stripe near one end. The striped end is the cathode (−), the other end the anode (+). Current flows from the anode to the cathode, so in your circuit the stripe always points the way the current should go. The symbol on circuit diagrams shows the same thing: a triangle (an arrow) pointing at a bar, and the bar is the stripe.

You already know another diode: the LED, a light-emitting diode. That is why an LED only lights one way round, with its long leg towards +. In this path the UNO is only a power supply: plug its USB cable into a computer or a USB phone charger and use its 5V and GND pins. Whatever program is on the board doesn't matter.

Wiring

Breadboard wiring diagram: Let current flow one way with a diode
Breadboard view. Check each connection against the wiring table below.

Build it step by step

Plug in all the parts first, then add the wires in this order. In each picture the new wires are bright and the ones from earlier steps are faded. Click a picture to see it larger.

Step 1 of 5: Power rails: 5V and GND from the UNO
Step 1. Power rails: 5V and GND from the UNO
Step 2 of 5: Button A: + rail to column 30
Step 2. Button A: + rail to column 30
Step 3 of 5: Red and yellow LEDs: short legs to the − rail
Step 3. Red and yellow LEDs: short legs to the − rail
Step 4 of 5: Button B: + rail to column 52
Step 4. Button B: + rail to column 52
Step 5 of 5: Green LED: short leg to the − rail
Step 5. Green LED: short leg to the − rail
From To
UNO 5V Bottom + rail (red wire)
UNO GND Bottom − rail (black wire)
Button A Across the middle gap, legs in columns 30 and 32 (rows e and f)
+ rail Column 30, row j
Resistor 220 Ω Column 32, row i to column 36, row i
Red LED long leg (+) and short leg (−) Column 36, row f and column 37, row f
Column 37, row j − rail
Diode A: plain end and striped end Column 32, row g and column 42, row g (stripe at column 42)
Resistor 220 Ω Column 42, row i to column 46, row i
Yellow LED long leg and short leg Column 46, row f and column 47, row f
Column 47, row j − rail
Button B Across the middle gap, legs in columns 52 and 54 (rows e and f)
+ rail Column 52, row j
Resistor 220 Ω Column 54, row i to column 58, row i
Green LED long leg and short leg Column 58, row f and column 59, row f
Column 59, row j − rail
Diode B: plain end and striped end Column 54, row h and column 42, row h (stripe at column 42)

Bend the diode wires so the diodes lie flat on the breadboard. Diode B is long: let it lie across the holes between columns 42 and 54. Both stripes point to column 42, the column with the yellow LED's resistor. Check the stripes and the LED legs before you plug in the USB cable.

FREE

Build this circuit in EEMENTOR Lab

Wire it yourself in your browser before you touch a real wire. No sign-up, nothing to install.

The UNO and the parts for this lesson laid out in EEMENTOR Lab, ready to wireBuild it yourself
  1. The UNO and this lesson’s parts are already placed. Wire them using the wiring table above. Pins with no wire show red.
  2. Missing a part? Add it from the parts list on the left.
  3. Press Run, then try the inputs: click, hold or slide them under Selected.

EEMENTOR Lab is free and in beta. Results are a guide; a real build can differ slightly. About the Lab

Try it

Experiment 1: two buttons, one shared light

  1. Plug the UNO's USB cable into a computer or a phone charger. All LEDs stay off.
  2. Press button A: the red LED and the yellow LED light up.
  3. Press button B: the green LED and the yellow LED light up.
  4. Press both: all three light. The yellow LED means "A or B is pressed". Engineers call this an OR circuit.
  5. Look closely: the yellow LED is a little dimmer than the red and green ones. Each diode "uses up" about 0.7 V of the 5 V before the current reaches the yellow LED.

Experiment 2: turn a diode round

  1. Unplug the USB cable. Pull out diode A, turn it round so its stripe is at column 32, and plug it back in. Plug the USB cable in again.
  2. Press button A: only the red LED lights. The yellow one stays dark, because diode A now blocks the current from button A.
  3. Press button B: green and yellow light, and the red LED lights too, a little dimmer. The current now flows from column 42 forwards through the turned diode A to the red LED. A diode always blocks one way only, whichever way you put it in.
  4. Unplug the USB cable and turn diode A back, stripe at column 42.

Experiment 3: replace the diodes with wires

  1. Unplug the USB cable. Take out both diodes and put a jumper wire in each place instead: column 32 row g to column 42 row g, and column 54 row h to column 42 row h. Plug the USB cable in again.
  2. Press button A. Surprise: red, yellow and green light up, although you didn't touch button B.
  3. Press button B: all three light again.
  4. Why? Without diodes, column 32, column 42 and column 54 are simply joined. Current from button A flows to the yellow LED, but also backwards through the second wire to the green LED. The two buttons can no longer be told apart. Put the diodes back (stripes at column 42) and each button has its own LED again.

What you should see

Which of the red, yellow and green LEDs light when you press button A, B or both: with the diodes right, with diode A turned round, and with wires instead of diodes.

How it works

A 1N4007 diode with its anode and striped cathode, its symbol, forward and reverse current, and the circuit diagram of experiment 1 with the current path when button A is pressed.

Follow the current from button A. When you press it, 5 V reaches column 32. From there one path goes through a resistor and the red LED to GND. A second path goes through diode A, in the forward direction, to column 42 and through the yellow LED to GND. But could the current go on from column 42 through diode B to the green LED? No: for diode B that would be the reverse direction, from stripe to plain end, and it blocks. So button A lights red and yellow, never green. Button B works the same way in mirror image.

Every diode needs a small push before it conducts: its forward voltage. For a silicon diode like the 1N4007 it is about 0.7 V. That is why the yellow LED gets a little less than the others. An LED is a diode with a bigger forward voltage, about 2 V for red, yellow and green, and it turns part of the energy into light. In the reverse direction a 1N4007 can block up to 1000 V, far more than you will ever use with the UNO.

Diodes are everywhere. Mains chargers use four diodes to turn the back-and-forth current from the wall into one-way current for your phone: that is called rectifying, and it is why the 1N4007 is called a rectifier diode. Battery gadgets use a diode to protect themselves when the batteries go in backwards. And motors and relays need a diode across them, because when they switch off they make a short, high voltage spike, and the diode gives that current a safe loop, as you will see in the motor speed lesson. Inside every computer chip, billions of diode borders steer the current.

Try this next

  • Add a third button and a third diode to the yellow LED: now any of three buttons lights it. This is how a car's door light comes on when any door opens.
  • Build a battery reverse-protection circuit: 5V → diode → resistor → LED → GND. Then turn only the diode round. The LED goes off instead of being damaged by a wrongly connected supply.
  • Put two diodes in a row (in series) in front of the yellow LED. It gets dimmer still: two forward voltages of 0.7 V each.
  • Draw the circuit diagram of experiment 1 with the diode symbols, as in reading circuit diagrams.

Troubleshooting

  • No LED lights at all: check the 5V and GND wires to the rails, and that each button sits across the middle gap. A button in only one half of the breadboard is always "pressed" or never.
  • An LED stays dark when its button is pressed: turn that LED round (long leg to the resistor), and check its resistor is in the right row.
  • The yellow LED doesn't light from button A (or B): that button's diode is the wrong way round. Both stripes must be at column 42.
  • An LED is on all the time: a button is turned the wrong way, so its two legs are always connected. Turn it by a quarter turn.
  • Pressing A also lights green (with the diodes in): diode B is the wrong way round, or one of its wires is in the wrong column.