Of all of the components — in my mind at least — diodes sound the most futuristic. Even the parts of the diode — cathode and anode — sound like they have come directly out of a science fiction novel. However, you don't need a time machine to experience the full glory of diodes. Like all of the other components we have visited so far, diodes are everywhere. Except, unlike most of them, you actually see diodes all of the time. If you did not already know, LED stands for light emitting diode. Any time you see an LED display, you are looking at a diode in action. Although, not every diode lights up, they all do work roughly the same way. Let's take a moment and learn about what diodes actually are.


What Is a Diode?

A diode is an electronic component that allows electricity to flow through in one direction, and all but stops it from flowing the opposite way.

Unlike other electrical components we have looked at thus far, whose primary role is to influence the voltage or current within the circuit, the diode's primary role is to route electricity. This is extremely useful for preventing an electrical signal from taking unwanted or unexpected routes within the circuit.

Like an electrolytic capacitor, all diodes are polarized. This means they have an anode (positive side) and cathode (negative side). You can tell the difference because the cathode has a little line painted around it.

In a schematic, diodes look like arrows pointing at a wall. A good way to think of this is that a positive voltage can flow in the direction of the arrow, but the wall stops it from flowing back the other way.

How Diodes Work

A diode consists of a PN junction made of P-type silicon and N-type silicon separated by a depletion region. The depletion region acts like an insulator. Put simply, the P-region is connected to the anode, and the N-region is connected to the cathode. The depletion region sits between the two.

When the P-region is connected to ground and the N-region is connected to a positive voltage, the depletion region actually grows in size instead of shrinking. This ensures little to no electricity is able to flow through the diode between power and ground. In this configuration the diode is called reverse biased.

When a positive voltage is applied to the P-region and the N-region is connected to ground, the depletion region all but disappears and allows electricity to flow. In this state the diode is called forward biased.

In order to overcome the depletion region, a little bit of voltage must be sacrificed. This is called the voltage drop. In a standard silicon diode this is typically 0.7V. In other words, if you have a 5V signal and it passes through a diode with a 0.7V drop, the voltage that comes out the other end will be 4.3V. It can fluctuate above or below this value depending on the type of diode.

If you have three diodes in series, you will lose 0.7V through each diode and the voltage at the far end of this chain will be 2.9V. This adds up to a significant loss, and is the reason diodes should be used sparingly.

While diodes charge a toll to cross the depletion region in the form of voltage, they offer no real resistance. If you put only diodes in a circuit without a load to use up the electricity, it will virtually look like a short circuit and draw as much current as the power supply is able to provide. Since that is likely higher than the diode's maximum current rating, it will release the diode's magic smoke.

Deciphering Diodes

There isn't too much to know about reading diodes. Typically, the name of the diode is printed right on it. The name is its part number, and has nothing to do with the actual value of the component.

Sometimes the name is printed horizontally across the body which makes it very easy to read.

Sometimes it is printed around the circumference which makes it extremely annoying to read, especially since they tend to be small-ish.

Special Diodes

While diodes by and large all do the same thing, there are certain diodes that perform specialized functions.

Schottky diodes are very similar to standard signal diodes, but have a very low forward voltage - as little as 0.2V - and a really fast switching action. They are good in applications in which the diode needs to work very rapidly, and/or a minimal amount of voltage loss is required.

Zener diodes work like normal diodes. However, when a really large voltage is applied to a reverse-biased zener diode, the aptly named Zener Effect kicks in and allows a fixed amount of electricity to flow the 'wrong way' through the diode. This makes this diode useful as a crude voltage regulator in low-current applications.

Lastly, the one diode that really shines above the others is the LED.


LED is an abbreviation for light emitting diode. Of all of the electronic components we are going to encounter in this course, the LED gets the most fanfare. It is the superstar of electronic components. You could say it shines brighter than the rest.

An LED is a diode that emits photons when it is forward biased and there is electricity flowing through it. The photons are simply light particles and what makes it glow.

If you look very carefully inside of an LED you will see a thin wire attached to the center of a small bowl. The wire bridges the anode and cathode to a semiconductor die located at the bottom of the reflective bowl. When current flows from the anode to the cathode, the semiconductor material emits photons, reflects off the bowl, and is further amplified by the plastic material of the cap.

There are typically three ways to tell a standard 5mm LED's anode from its cathode.

1) The leg connected to the anode is typically longer than the one connected to the cathode.
2) The body of the LED typically has a flat spot on the cathode side.
3) If you look inside the LED, the little metal bit connected to the anode lead is much smaller than the cathode.

Current Limiting Resistors

Since an LED offers no resistance in a circuit, it typically requires a current limiting resistor in series with it.

This prevents the LED from being shorted and - given enough current - literally exploding.

As a general rule of thumb, a 470 ohm resistor should be more than enough to protect just about any low power LED.

However, should you want to calculate the proper resistor for maximizing brightness, you can calculate this by using this equation. Even more simply, you can search online for "LED resistor calculator."

For instance, given this LED with a 3v forward voltage, 20mA operating current, and a 9V source, we can calculate that the proper resistance is 300 ohms. However, that is the absolute minimum resistor, and since resistors tend to have a tolerance range, it is best to increase the value a little to be on the safe side. It is safe to say then that a 330 ohm resistor should do the job. However, you don't want to increase it too much because the more resistance there is, the dimmer the LED becomes.

LED Bonanza

There are so many different types and form factors of LEDs at this point, it is hard to keep up.

LEDs come in different shapes and sizes. The 5mm domed is the most common, but you are likely to also find them in 3mm domed, 10mm domed, rectangle, oval, and square (to name a few).

LEDs also come in many different colors. Often the plastic is tinted to indicate what color they are. However, clear LEDs are deceptive in that you might assume they glow white, but can actually glow a host of different colors.

LEDs have different levels of brightness that are typically measured in MCD (millicandella). One thousand millicandella is equivalent to the brightness of one candle. So, an LED like the one pictured above with an intensity of 6,000mcd is equal to the brightness of 6 candles. It is not uncommon to also see extremely bright high-power LEDs to be measured in Lumens - another unit of light measurement - or Watts.

LEDs have different viewing angles, or beam widths. What this means is that the visible brightness of the LED seems to decrease when you are looking at the LED from and a spot outside of its ideal viewing angle. This angle also determines the size of the spotlight created by the LED. Viewing angles on LEDs can vary widely.

LEDs also draw different amounts of power. In fact, some high power LEDs draw so much power that they are mounted on metal heatsinks to dissipate heat. While LEDs such as these tend to be very bright, they sometimes require special circuitry to drive them.

LEDs can come grouped together into display modules. With these LED dot, bar, and 7-segment numerical displays, each individual light-up segment is a discrete LED. For instance, the 8X8 matrix on the left actually has 64 separate LEDs inside of it.

LEDs also come packaged in flexible strips. These strips are manufactured in white, solid colors, and multi-color, which can produce any color in the visible spectrum. Additionally, the multi-color strips either come in solid colors, or in programmable arrays where each LED can be a different color. Learning how to control programmable LED strips is beyond the scope of this class, but something you can do if you ever decide to learn how to use a microcontroller such as an Arduino.

In short, there are a lot of ways you may encounter LEDs. Learning about all of the LEDs could be a class unto itself!

Hand Crank Flashlight

This hand crank flashlight charges a supercapacitor to power an LED when you turn the crank. In fact, the hand crank system provides enough power that you can also power the LED directly if the capacitor has run out of charge. This flashlight uses no batteries and converts your own energy into light. It could hypothetically run for decades and is great in an emergency situation.

Generating Electricity

The secret sauce to this project is a stepper motor. A stepper motor is a special type of motor that has two power coils. By powering the coils one after another, and then alternating the polarity and powering them again, the motor is able to move. Don't worry too much if this doesn't make too much sense right now. The key word here is "alternating." If you consider that a motor is actually a transducer and can both be powered by electricity, and generate electricity when manually powered, a stepper motor actually has two coils producing alternating current when you turn the motor shaft. Since stepper motors tend to have large magnets and multiple coils, this makes them highly efficient at generating electricity.

All we need to do is crank to the motor shaft. To test this out, add an LED to each pair of motor coils and observe what happens.

Of course, it is not quite that easy. There is one problem to this approach. We are getting alternating current out of the motor, but we are trying to power a DC circuit. This is where diodes start to come in.

Bridge Rectifier

By arranging diodes into a bridge rectifier we are able to convert AC electricity to DC. In this arrangement, regardless of where the AC waveform is in its cycle, electricity is always flowing between power and ground in a uniform direction, and you end up with a DC waveform output.

The reason for this is that as the alternating current fluctuates between positive and negative, two diodes are always forward biased and two are reversed biased. Through this clever arrangement, there is always a pathway for electricity to flow only between power and ground.

Since our flashlight has two coils that each generate an AC signal, we need two bridge rectifiers. To get them to work together, we simply wire them in parallel: positive to positive, and ground to ground. We're also going to add a small capacitor to help smooth out the voltage and fill in any dips in voltage created as we cycle between the power created by the two coils.

Zener Power Regulation

Once we have a nice clean DC signal coming out of the rectifiers, we will then need to charge a supercapacitor. However, before we do that, we need to make sure that the voltage from the rectifiers will never exceed the voltage of the supercapacitor.

While the voltage coming out of the motor is probably fairly small, to be on the safe side we can use a zener diode to ensure it never exceeds the capacitors 5.6V operating voltage.

By connecting a 5.1V zener diode in series with a 100 ohm resistor in a reverse bias position between power and ground, we can ensure the voltage to the capacitor never exceeds 5.1V.

If the voltage exceeds 5.1V, then the zener effect kicks in limiting the voltage across the diode to 5.1V, and dropping any additional current across the current limiting resistor. For instance, if the motor produces 9V, then 5.1V will flow across the diode and 3.9V will fall across the resistor. Any component connected in parallel to the diode will receive at most 5.1V.

This is not the best means of voltage regulation since it can potentially generate a lot of heat, but since the current we are working with is relatively small, it should be fine.


After the power is generated and regulated, it is then stored in a supercapacitor like we used in the vibrobot project. The capacitor is simply in parallel with the zener diode.

The LED and Switch

The LED and its current limiting resistor are wired in parallel to the zener diode and supercapacitor.

A switch is then connected in series with the resistor in order to toggle on and off its connection to the supercapacitor power supply.

When the supercapacitor runs out of power, the LED can be powered directly by the hand crank to long as the switch is toggled on. If the switch is toggled off, the capacitor gets charged instead.

Attach the Template

To begin with, cut out and attach the drilling template for the stepper motor. It should be taped to the lid of the enclosure on center about 1" from one of its shorter edges.

Drill the Template

Drill the outer mounting holes with a 1/8" drill bit and the center hole for the shift with a 3/8" drill bit.

Attach the Motor

Fasten the motor to the lid using M3 x 12mm bolts.

Widen the Crank Hole

Widen the hole at the end of the crank arm to be 1/4" wide to receive the bolt for the crank knob.

Attach the Crank Knob

Insert thread-locking fluid into knob's threading to prevent the bolt from later loosening while you crank the flashlight.

Loosely fasten the knob to the crank arm using an M6 x 20mm bolt. It should be attached loosely enough that the knob will be able to spin in place.

Attaching the Coupling

Attach the shaft coupling to the crank arm using four 6-32 bolts.

Attach the Motor Crank

Fasten the crank arm to the motor shaft using the shaft coupling's set screw.

This completes the motor's crank arm assembly.

Trim the Wires

Trim the wires coming out of the stepper motor to be about 4" - 6" long.

This will make it easier to work with later and fit in the case.

Reflector Hole

Drill a hole on center on one of the smallest faces of the enclosure for the flashlight's reflector cone using a 1-1/16" hole saw.

The easiest way to find center of any rectangular surface is to draw an X from corner to corner.

Power Switch Hole

Drill a 1/8" pilot hole in the side of the enclosure near the hole for the reflector, and then widen it to 3/8". This is for mounting the switch.

Wire the Circuit

Now is time to build the circuit on the PCB as pictured in the schematic.

To begin, I wired the two bridge rectifiers in place.

I then connected the zener diode voltage regulator.

After that, I wired in both capacitors.

Lastly, I added the resistor for the LED. The remaining components will be mounted off the board and connected later.

Wire the LED

Connect a red wire to the LED's anode and a black wire to its cathode. Insulate the solder joints with shrink tubing to protect them and prevent potential shorts.

Mount the LED

Apply contact cement to the reflector and the lip around the edge of the LED.

Wait for both to dry until they are tacky to the touch and then firmly press them together to make a firm bond.

Attach the Lens

Attach the lens to the reflector by applying contact cement around the front inner lip of the reflector and the outer edge of the lens.

Again, wait for both to dry until they are tacky to the touch and press them together firmly.


Pass the switch up through the hole in the enclosure and fasten it in place with its mounting hardware.

Mount the Reflector

Apply contact cement on the enclosure around the outer edge of the reflector mounting hole, and the edge of the reflector.

Press the two firmly together once the contact cement is dry enough.

Attach the Motor

Solder the motor's wires to the appropriate rectifiers on the circuit board. If you have forgotten where this is, reference the schematic.

Also, make sure you get the wire pairs correct. In my case red and blue were attached to one coil, and black and green were attached to the other coil. If you mix it up and take one wire from each coil - let's say, black and red - then not much will happen.

Solder the LED

Solder the LED in series with the resistor on the circuit, and the switch in series with the power supply.

Solder the Switch and LED

Solder the switch and LED together to complete the circuit. Now, when the switch is pressed the LED is either connected or disconnected from the supercapacitor, enabling you to turn it on and off.

Apply Velcro

Cut two small adhesive-back velcro tabs and mount the circuit board neatly on the inside of the enclosure in a spot that will be out of the way of the servo motor.

Case Closed

Put the lid back on the case, and fasten it shut with the enclosure's mounting screws.

Attach the Rubber Cover (optional)

Attach the rubber lens cover gasket with contact cement over the edge of the lens to seal it up.

Crank It Up

Give your flashlight a couple minutes of solid cranking, and enjoy no longer being in the dark.


Share a photo of your finished project with the class!

Nice work! You've completed the class project