Overview

This tutorial will cover those wonderful blinky things, LEDs. We're going to cover how to calculate the current going through an LED and in the mean time introduce two important laws of electronics, Kirchhoff's Voltage Law and Ohm's Law. We'll begin by performing experiments that will demonstrate how voltage and resistance affects current and then prove those results with a little math.

There's no coding involved in this exercise, and although we use an Arduino in the images, you don't need one to follow along. We do suggest some other kind of power supply so you can try out the experiments, but you can use even batteries in a battery holder!

What is an LED?

Who doesn't love LEDs? They are bright and blinky, or soft and elegant. They're festive! They're colorful! They're everywhere and they're a lot of fun. We love LEDs when we write tutorials because most of electronics hackery is hidden in chips, or goes very fast and we can't see or sense it without expensive equipment. But LEDs are easy to see for everyone - this way we can visually identify what is going on inside our microcontroller.

Lets begin with an anatomy lesson…The Parts of an LED!

LEDs are so common, they come in dozens of different shapes and sizes. The LEDs you are most likely to use are the through hole LEDs with two legs. There are lots of LEDs that are small and hard to solder but these are easy to use with a breadboard because they have long wires we can stick in. The clear or clear-ish bulb is what protects the light emitter (thats where the magic happens). In fact, the first two letters of LED stand for Light Emitting.

A really nice thing about LEDs is that they are very simple. Unlike some chips that have dozens of pins with names and special uses, LEDs have only two wires. One wire is the anode (positive) and another is the cathode (negative). The two wires have different names because LEDs only work in one direction and we need to keep track of which pin is which. One goes to the positive voltage and the other goes to the negative voltage. Electronic parts that only work in 'one direction' like this are called Diodes, thats what the last letter of LED stands for.

  • The longer lead goes to the more-positive voltage
  • Current goes in one direction, from the anode (positive) to the cathode (negative)
  • LEDs that are 'backwards' won't work - but they won't break either

It's all a little confusing - we often have to think about which is which. So to make it easy, there's only one thing you need to remember and that's the LED wont light up if you put it in backwards. If you're ever having LED problems where they are not lighting, just flip it around. Its very hard to damage an LED by putting it in backwards so don't be scared if you do

If it helps, refer back to these photos and diagrams or print them out for your reference

All the different sizes and colors

5mm LEDs! Green, Red, Blue (in a clear case) and InfraRed (in a bluish case)

One of the best things about modern LEDs is all the colors they come in. It used to be that LEDs were only red or maybe yellow and orange, which is why early electronics from the 70s and 80s only had red LEDs. The color emitted from an LED has to do with what type of material they are made of. So red, for example, is made with Gallium Arsenide. Since then, scientists have experimented with many other materials and figured out how to make other colors such as green and blue, as well as violet and white. (You can see a massive table of all the different materials used to make LEDs in the wikipedia page )

When we first started making electronics in the late 90's, we bought some 5mm blue LEDs and they were $3 each. Now you can get easily a dozen LEDs for that price. Life is good!

LEDs come in all sorts of sizes as well. Here is a photo showing a 3mm, 5mm and 10mm LED. the "millimeter" size refers to the diameter of the LED. For example, if you need to drill a hole in a box for your 5mm blinky LED, the hole size should be 5mm, and you'd need a 5mm drill bit to make it. 5mm are the most common size you'll see, and they can be extremely bright!

Green 3mm, Red 5mm and White 10mm LEDs

  • 5mm LEDs can be so bright, they are often used as illumination (lighting something up, like a flashlight, we'll talk about this next).
  • 3mm LEDs are not as bright but are smaller, and are good for indication (like an LED that tells you something is on). They're not as good for illumination because they have a smaller area that is lit.
  • 10mm LEDs are a little more rare, they are huge and chunky but are usually just 5mm LEDs with a bigger case so they aren't any brighter. They can be good indicators but we rarely see them as illuminators.

What are LEDs used for?

LEDs are mostly used for two things: illumination and indication. These are technical words but are good to understand because if you want an LED for one thing and you buy the wrong thing you'll be pretty bummed.

Headlights should be bright!

Illumination means to "shine light onto something" - like a flashlight or headlights. You want your headlights to be bright as heck.

Brake lights should be bright enough to see, but don't need to light up the road!

Indication mean to "point something out" - like a turn signal or brake lights on a car. You don't want your car's turn signal to blind people!

If you get the wrong type you could end up with a DIY flashlight that is dim, or a control panel that burns people's eyes!

Diffused LEDs are really good at indication, they look soft and uniform and you can see them well from any angle.

Clear LEDs are really good at illumination, the light is direct and powerful - but you can't see them well from an angle because the light is only going forward.

Let's verify this. On this breadboard I've connected two LEDs, one Red Diffused and one Clear Bright Blue LED. Both have the same resistor (which means they're basically using the same amount of power). You should follow along, wiring up one of each. Use a 1.0K or so resistor from the cathode (shorter pin) to Ground and connect the anode (longer pin) to +5V.

When lit, you will see the the diffused LED is softly lit, but the blue LED is harsh and ultra bright.
If you look from the side, you'll see the diffused LED looks pretty much the same. The blue LED however is not nearly as bright from the side, if you look carefully you can sort of see how there is a thin 'cone' of bright light from the cup that holds the piece of silicon off the lens.
One way to tell how bright your LED is before you buy it is to look for the milli-candela rating, sometimes shortened to mcd. Its a little tough to explain how bright something is with text or even photos (since in person it looks different). What we're going to do is instead give you some rough numbers for how bright LEDs will seem to be for most people.
MilliCandela Brightness 10 "Dim" indicator, about the brightness of a tiny diffused indicator on a cheap electronic toy.

Probably not visible in daylight.  200 "Somewhat dim" indicator, about the brightness of the red diffused LED in the example above. Not visible in bright daylight.

You can easily look at these 500 "Kinda bright". About the brightness of the red diffused LED if you powered it up all the way (we'll do that later).

You can look at these if you're more than a few inches away, otherwise you'll see spots. 1,000 "Fairly bright", about the brightness of the clear LED in the previous example, maybe about the brightness of those cheap LED keychain flashlights.

You can look at these if you're more than a few inches away, otherwise you'll see spots. 5,000 "Bright!" - these are as bright as ultra-bright 5mm LEDs get. If you powered the clear LED all the way (we'll do that later). Expensive 5mm LED flashlights, when new, are about this bright.

Looking directly at this is not pleasant. 20,000 "Really Bright" - 5mm LEDs cant get this bright, but if you get the "1 Watt" LEDs, they'll easily give you 20 candela of light. These are good for bicycle headlamps, big bright flashlights, and such.

Don't look straight at these, it'll hurt your eyes.
So a ultra-bright LED may advertise itself as "5000 millicandela!") - that's the maximum brightness you'll get out of it. In general, the brighter the LED the more expensive it is.

Changing the brightness with resistors

OK so now that we know about clear and diffused LEDs and a little about brightness. Now is a good time to let you know that if you bought an Arduino Starter Pack or ARDX from us, the diffused green or red LEDs are about 500mcd and the bright clear LEDs are about 5000mcd. That's a little approximate, since we sometimes get LEDs from different factories.

Lets go back to our basic LED setup: one LED and one resistor connected from 5V to ground. This time we will duplicate it so that we have three LEDs except that each resistor is going to be different. LED #1 will have a 100 ohm resistor (Brown Black Brown), LED #2 will have 1.0K (Brown Black Red) and LED #3 will use a 10K (Brown Black Orange).

Power up the Arduino and examine how each LED is lit differently. Time for a quick quiz!

Which LED is brightest (what is the resistor)?

The one with the 100 ohm resistor.

Which LED is dimmest (what is the resistor)?

The one with the 10K resistor.

If we had an LED with a resistor that was 5K ohms, which LED would it be brighter than? Which LED would it be dimmer than?

With a 5K resistor, it would be brighter than the 10K resistor-LED, but dimmer than the 1K resistor-LED.
As you have seen with this experiment, the resistor we use with the LED makes a difference in how bright it is. The larger the resistor (more resistance) the dimmer the LED. A small resistor (less resistance) makes for a brighter LED.

Changing the brightness with voltage

Having learned a little about how to use resistors to change the brightness of an LED, we will now try experiment #2. This time we will use only 1.0K resistors but connect the anodes to different voltages. One LED anode will go to 3.3 volts another will go to 5.0 volts and the third will go to Vin (which, if you have one of our starter packs, goes to a 9V wall adapter, so its 9.0 volts
Power up the Arduino and examine how each LED is lit differently. Time for a quick quiz!

Which LED is brightest (what is the voltage)?

The one connected to Vin (9 volts).

Which LED is dimmest (what is the voltage)?

The one connected to 3.3v.

If we had an LED with a 1.0K resistor connected to a 4.2v supply, which LED would it be brighter than? Which LED would it be dimmer than?

Connected to 4v, it would be brighter than the 3.3v LED and dimmer than 5v.
As you have seen with this experiment, the voltage we use to connect to the LED makes a difference in how bright it is. The higher the voltage the brighter the LED. A lower voltage will lead to dimmer LEDs.

Max brightness!?

Lets do another quick experiement. Lets say we had a magical resistor with a knob, that we could change the resistance of from 0 resistance (like a piece of wire) to infinite resistance (something that does not conduct, like rubber).

We connect our LED to the resistor, as we turn it from infinite to to zero, what happens?

As the resistor gets smaller, from infinity to zero, the LED will get brighter and brighter.
Likewise, lets say we have a machine that can change the output voltage, from 0 volts to infinite volts.

We connect our LED through a 1K resistor, as we adjust the voltage from 0 volts to infinite volts, what happens?

As the voltages goes higher and higher, the LED will get brighter.

It would seem, then, that if we want a really really bright LED, we should just use a zero ohm resistor and connect to the highest voltage we can, right? And who wouldn't want an LED thats as bright as possible?

Lets build an LED circuit with a zero ohm resistor (also known as a wire) to Vin so be sure to plug in the Arduino into the wall with a plug-pack/wall-wart. (For somewhat detailed reasons we'll cover in another tutorial, using the 3.3V or 5V power pins won't do what we want, we need to use Vin).

Warning! Spoiler! This following experiment will probably destroy your LED, so don't use one of the nice clear LEDs. If you happen to have an LED sitting around that's not being used this is a good time to use it. If you aren't ready to sacrifice an LED, just watch the video!
Plug the LED into the arduino so that the long pin goes toVin and the short pin goes to ground.
LED kpow!

What happened?

The LED blinked for a split second and then went dark.
The LED is now permanently damaged. The lesson? There are limits to how much voltage and resistance, if we go over the limits, the LED will die!

The LED datasheet

Now that we know that even the mighty LED has its limits, we need to make sure we stay below those limits. Being kind to your LEDs will let them last longer and keep them shiny & bright!

Lets examine the specification sheet for a 5mm LED, specification sheets are also called datasheets. Datasheets are immensly useful, they have all the information you need for an electronic component. You can download the datasheet we'll be referring to here.

The first useful thing you'll find is the dimensional 'package' information. The 'package' here is the LED itself.

As you can see, the main diameter of the LED is 5mm (its a '5mm LED') and there's a lip that makes it around 6mm. The lip can make it handy if you're gluing the LED into a drilled hole, so it doesnt fall through. The datasheet also tells you which pin is the cathode and other lengths and sizes. Note that the figures are in mm with the inches in ()'s afterwards.

Keep scrolling down. Next you'll find this small table. This section tells you how bright the LED is in mcd. Since these are general purpose LEDs, the brightness can vary a bit, these LEDs average around 250 mcd, but the manufacturer may sell you LEDs that are as dim as 180mcd. This variation is pretty standard.

Later on the same page, is the electrical characteristics table.

The first two rows talk about the 'wavelength' - this is a specific way of indicating the color. After all, 'super bright red' is a very subjective description. With the wavelength, we can know exactly what color is emitted.
The third row is basically saying 'how much does the color vary from the wavelength'
The forth row isnt so important, we'll skip that

The fifth row, however, is what we're looking for…

Forward Voltage and KVL

For every LED, in order to use it properly, we need to know the Forward Voltage. What is this forward voltage? Lets explain it in a photo:
In our three-piece circuit, we have the battery (which generates voltage) and the resistor+LED (which uses up the voltage). I will now tell you a very key 'law' of electronics:

In any 'loop' of a circuit, the voltages must balance: the amount generated = the amount used

This "Voltage Loop" law was discovered by a fellow named Kirchhoff (thus it is called Kirchhoff's Voltage Law = KVL). And we can see the loop above, where one part is made of the +9V battery. The other half must use up the +9v (making it -9V so that both halves of the loop equal out).

So what does this have to do with the Forward Voltage of an LED? Well, the Forward Voltage is the 'negative voltage', used by the LED when it's on. Kinda like a 'negative battery'! So lets modify our diagram slightly.

Whenever the LED is on, the voltage it uses it up is somewhere between 1.85V and 2.5V. We'll say 2.2V for average - that's a good assumption for most red, yellow, orange and light-green LEDs. If we subtract that from 9V we get about 6.8V left. This is the voltage that must be 'absorbed' by the resistor.

Quick Quiz!

Let's say we have the same circuit above, except this time its a 5V battery and an LED with a forward voltage of 2.5V, how much voltage must be 'absorbed' by the resistor?

Voltages Generate = Voltages used, so 5V = 2.5V + ResistorVoltage. The voltage across the resistor is 2.5V.

Let's say we have the same circuit above, except this time its a 5V battery and an LED with a forward voltage of 3.4V, how much voltage must be 'absorbed' by the resistor?

Voltages Generate = Voltages used, so 5V = 3.4V + ResistorVoltage. The voltage across the resistor is 1.6V.

Ohm's Law

What is interesting about the law we just learned (KVL) is that in no place do we use the resistance of the resistor. It never shows up in the equation. Yet from our previous experiements we know for a fact that changing the resistance affects how bright the LED is. There must be something else going on, lets keep working on understanding the details….

Next we're going to throw in another important law. This one is called Ohm's Law- and it describes how resistors work.

Voltage across a resistor (volts) = Current through the resistor (amperes)* The Resistance of the resistor (ohms)

There's a more common shorthand notation which you'll see very often:

V = I * R

Or the two other ways of writing to solve for current or resistance:

I = V / R

R = V / I

The V is for voltage, the R is for resistance and the I, confusingly, is for current. Yeah, that I is a little annoying isn't it, since theres not even a single I in the word current? Unfortunately, there are 100 years working against us here, so just bear with us on that one.

Quick Quiz!

If I have a 3 ohm resistor (R) with a current of 0.5 Amperes (I) going through it. What is the voltage (V) across the resistor?

We'll use the V = I * R form of Ohm's Law. V = 0.5 A * 3 ohm = 1.5 Volts.

Now I have a 1000 ohm resistor (R), and a voltage across it of 6.8V (V), what is the current (I) going through the resistor?

We will use the I = V / R form of Ohm's Law. Current = 6.8 V / 1000 = 6.8 milliAmps.
Ohm's law is very important and its worth drilling a bit to become familiar with it. We suggest coming up with other mix+match numbers of resistances, currents and voltages and using them to solve for the unknown value. If you're working with a friend, quiz each other and check your answers! There are also 'calculators' online you can check yourself against.

Solving for the current

We'll now combine both KVL and Ohm's Law with our diagram. Our LED is connected to a 1000 ohm resistor (you should verify this by checking the resistor color stripes!), and the voltage across that resistormust be 6.8V (the law of KVL) so the current through that resistor must be 6.8V / 1000ohm = 6.8 mA (Ohm's law).
Our diagram is getting a little dense, but we're pretty much done. The resistor current is 6.8mA and that current is also going through the LED, so the LED current is 6.8mA. "Big whoop," you may be saying. "What do I care about the LED current?" The reason you should care is that:

The amount of current (I) going through an LED is directly proportional to how bright it appears.

Aha! Finally, the last piece of the puzzle. If we increase the current, the LED will be brighter. Likewise, if you decrease the current, the LED will be dimmer. By picking the correct resistor, you have full control over how the LED appears.
Whenever using an LED, make sure to always have a resistor! The resistor limits the current, which will keep the LED from burning out!

Most of the time, you'll want to have a really bright LED so you'll be calculating the smallest resistor you can get away with and not damage the LED. But note that the more current used by the LED, the quicker you'll drain the battery. So there are good reasons for wanting to control the brightness if say you have a small battery and you want the lights to last a long time.

Since as we have seen, too much current will make the LED go poof, what is the best amount of current we should use? For some very big 'power LEDs', the current can be as high as 1 or 2 Amperes, but for pretty much every 3mm, 5mm or 10mm LED, the amount of current you're expected to use is 20mA. You can see this in the datasheet we talked about earlier. See the right-most column? IF is the Forward Current (I) and they use 20mA.

For 99% of LEDs you will encounter, the optimal current is 20 milliAmperes (0.02 A) but don't be too scared to push it up to 30mA if you need a litle more brightness.

Revisiting Resistors

Let's go back and remember our younger days, when we were just connecting up different resistors to the LEDs willy-nilly. You may recall this breadboard, where we used three red LEDs and a 100 ohm, 1000 ohm and 10,000 ohm resistor to set the brightness.
Since its so important for you to have practice using those laws you just learned, we're going to have another quiz. Please try to solve the problems using the diagrams above. Yes there are calculators online that will do this for you but part of learning electronics is being able to do the calculations even if on a desert island.

Quick Quiz!

In the above breadboard, the voltage generator here is +5V, the forward voltage of the LEDs are 2.2V. What is the voltage across the 10,000 ohm resistor?

This is a KVL question. 5V = 2.2V + Vresistor so Vresistor = 2.8V.

Now that you know the voltage, how much current (I) is going through the 10,000 ohm resistor (R)?

We determined the voltage (V) is 2.8V, we use Ohm's Law I = V/R = 2.8/10000 = 0.00028 Amps = 0.28 milliAmps.

In the same breadboard, the voltage generator is +5V, the forward voltage is 2.2V, what is the voltage across the 1000 ohm resistor?

You didn't get fooled by this one right? The voltage is exactly the same, the resistance does not matter for KVL, it is still 2.8V.

Now that you know the voltage, how much current (I) is going through the 1,000 ohm resistor (R)?

We determined the voltage (V) is 2.8V, we use Ohm's Law I = V/R = 2.8/1000 = 0.0028 Amps = 2.8 milliAmps.

How much current (I) is going through the 100 ohm resistor (R)?

We determined the voltage (V) is 2.8V, we use Ohm's Law I = V/R = 2.8/100 = 0.028 Amps = 28 milliAmps.
Now you can see how changing the resistor effects the brightness and why a smaller resistor means a brighter LED.

Revisiting Volts

Now we'll re-visit another of our earlier experiments, this time we'll look again at the three-voltage LED board. This breadboard used 3 different voltages (3.3V, 5.0V and 9.0V) and the same resistor. As you recall, the higher the voltage, the brighter the LED, even with the same resistor.
I bet you know what's coming next!

Quick Quiz!

Lets start with the 9V-powered LED. The forward voltage of the LED is 2.2V, what is the voltage across the resistor?

This is a KVL question. 9V = 2.2V + Vresistor so Vresistor = 6.8V

Now that you know the voltage, how much current (I) is going through the 1,000 ohm resistor (R)?

We determined the voltage (V) is 6.8V, we use Ohm's Law I = V/R = 6.8/1000 = 0.0068 Amps = 6.8 milliAmps.

Next, we will examine the 5V-powered LED. The forward voltage is 2.2V, what is the voltage across the resistor?

Another KVL! 5V = 2.2V + Vresistor. Vresistor = 2.8V

Now that you know the voltage, how much current (I) is going through the 1,000 ohm resistor (R)?

We determined the voltage (V) is 2.8V, we use Ohm's Law I = V/R = 2.8/1000 = 0.0028 Amps = 2.8 milliAmps.

Finally, we will examine the 3.3V-powered LED. The forward voltage is 2.2V, what is the voltage across the resistor?

Another KVL! 3.3V = 2.2V + Vresistor. Vresistor = 1.1V

Now that you know the voltage, how much current (I) is going through the 1,000 ohm resistor (R)?

We determined the voltage (V) is 1.1V, we use Ohm's Law I = V/R = 1.1/1000 = 0.0011 Amps = 1.1 milliAmps.
As you have seen with the calculations, increasing the voltage powering both resistor and LED increases the voltage across the resistor which causes more current to flow.

Which to Adjust?

Given that you have two ways to adjust the brightness of an LED, resistor and voltage, which should you use? That is, should you increase voltage (by adding batteries) or decrease resistance, to get a brighter LED? The answer is in how power is used:

The battery (or power supply) generates power, the LED and resistor both use power, but they do so in different ways. The LED uses the power to make light (more power, more light). The resistor does not make light, it makes heat (more power, more heat). And as you know from the last quiz, any voltage left over from the LED is used by the resistor. That voltage & current in the resistor is lost forever as heat and doesn't do anything useful in our circuit. Since it's inefficient to just pump all our battery power into the air as heat, we should make the power used by the resistor as small as possible, and the best way to do that is to keep the voltage low.

The upshot? If you need to make an LED brighter, adding batteries is wasteful: you're better off using a smaller resistor! If you are making up a power supply, by adding up AA's in a pack, try to have about half or one volt minimum 'headroom' above the highest forward voltage, so that you can have a small resistor, around 100 or 200 ohms. Going lower than that isn't suggested because the forward voltage can vary, and resistors can vary, and the battery can vary and all these little variances of 0.2 Volts or so add up and you won't get the brightness you want.

Adjusting Brightness

We'll finish up by introducing another part that's in your kit bag. This is the potentiometer (sometimes also called a pot because the word potentiometer is just terribly long)

Recall oh so many hours ago, when we talked about having a magic resistor that we could change from 0 ohms to infinite ohms and used that to think of how resistance changed LED brightness? Well, that isn't such an imaginary thing after all, in fact they are quite common. Potentiometers are resistor that are adjustable with a knob. We will talk about potentiometers more in detail in a future tutorial so consider this a light introduction!

Potentiometers, like resistors, have an Ohm value. For example, this potetiometer is a 2Kohm (its printed up top). Potentiometers have three pins, two 'outer' and one 'middle' pin. The middle pin is sometimes called the wiper.
You can see why its called the wiper by opening up the pot, its literally like a windshield wiper! The black-brown stuff that goes 3/4 around the circle is the resistor material, the resistance from one end to the other is say 2Kohm for this guy. As the wiper (the triple-fingered thing) moves from one end to another, the resistance between that pin and the right or left pin changes, the closer the wiper is to the side pin, the smaller the resistance. When the pot is turned all the way to the left the resistance between the left pin and middle pin is zero ohms and the resistance between the middle pin and the right pin is 2Kohms (or whatever the maximum is of that potentiometer. When the pot is turned all the way to the right, its the opposite.

The resistance between the two outer pins is always the same. The resistance between the middle pin and the left or right pin changes!

Quick Quiz!

For the 2Kohm potentiometer here, if the knob is right in the middle, what is the resistance between the middle pin and the left pin?

In the middle, it will be 1/2 of the maximum, 1Kohm

What is the resistance between the middle pin and the right pin?

Also 1Kohm
The schematic symbol for a potentiometer looks like this, its kinda like there is a resistor, and then the arrow pointing in the middle is the wiper. The little arrow on the left indicates which way the wiper moves when potentiometer turns clockwise (its not terribly important, if you get it wrong on a breadboard just turn the pot around.
Of course, we've just learned so much about using resistors to adjust the current going through an LED, we can use the knob of the potentiometer as a physical way to control the LED.
Use a 10K potentiometer for this excersise, find one that has 103 printed on it (this is the same as 10 (first two digits) with 3 zeros afterwards = 10,000).

Note that we are connecting to the wiper and one end, not to both ends. Also, we have a 100 ohm resistor between the potentiometer and the LED.

Please try to build this circuit, verify that the LED dims and brightens when the potentiometer is turned.

The 100 ohms gets added to the resistance of the potentiometer!

Quick Quiz!

If connecting the 100 ohm resistor like in the diagram means the resistances are added, what is the total resistance when the 10K potentiometer is turned all the way 'down'?

When 'turned down' the potentiometer resistance between the middle pin and the left pin is zero ohms. 0 + 100 = 100 ohms total.

What is the total resistance when the 10K potentiometer is turned all the way 'up'?

When the potentiometer is turned all the way up, the resistance is 10Kohms = 10,000 ohms. adding 100 ohms makes it 10,100 ohms.

And if its in the middle?

1/2 or 10K is 5K, so 5,000 ohms + 100 ohms = 5100 ohms.
Why do we even have that 100 ohms? Can't we just adjust the potentiometer to get whatever resistance we want? Yes, but think about what would happen if we didn't have the 100 ohm resistor and we turned the potentiometer down…the resistance would be zero! Zero resistance is the same as no resistance, and we know that having no resistance is very bad for an LED because there is nothing to limit the current flowing through the LED. For that reason we have the additional 100 ohm resistor. This keeps the resistance from ever going under 100 ohms.

Last Quick Quiz!

How much current is flowing through the LED if when the pot is turned down? The forward voltage of the LEDs are 2.2V.

(5 - 2.2V) / 100 ohm = 28 milliamps.

What about when the potentiometer is turned all the way 'up'?

(5V - 2.2V) / 10100 ohm = 0.28 milliamps.
Whew, that was a long and very math-intensive lesson. We'll get back to doing more with software and fun blinky in future tutorials, but we hope that this tutorial helped you understand some of the details of how to wisely use LEDs!
This guide was first published on Feb 11, 2013. It was last updated on Feb 11, 2013.