You are on page 1of 6

Turn on LED with 5V

The circuit that turns on an


LED involves two
components: a resistor and
an LED. The schematic
representation of the circuit
is shown in the picture.

So why do we need the


resistor in this circuit? This
resistor is called a current
limiting resistor, this means
the resistor limits the amount
of electrical current that
flows through the LED.
Every LED is rated for a certain amount of current, if you go over that amount you will
probably damage the LED. Using Ohms Law, we can calculate the value of the current
limiting resistor we should use with our LED.

Ohms Law is very simple, it says that there is a linear relationship between current and
voltage in a resistor: increasing the voltage across a resistor will increase the current that
flows through it. Specifically it says:

V=I*R

Where

V = voltage across the resistor

I = current through the resistor

R = resistance - this is what we want to calculate

so if we know the values of V and I, we can calculate the correct R for our circuit.

First we need to calculate the voltage across the resistor. In the circuit shown in the image, a
total of 5V is applied to the circuit. Most of the 3mm or 5mm LEDs you will use require 3V
to light up, so the remaining 2V (5V - 3V = 2V) is applied across the resistor.

Next we calculate the current going through the resistor. Most 3mm or 5mm LEDs run at
full brightness at about 20mA of current; going over this could damage the LED, and going
under this will make the LED glow dimmer (but does no harm). Assuming we want to run

Doctor Areilza, 32. 48010 Bilbao Tel. 944 271 818 Fax 944 396 098 E-mail: colegio@indautxujesuitak.org 1
our LED at 20mA, we know that the same amount of current must run through the resistor
since the components are wired together in series. This leaves us with:

2V = 20mA * R

2V = 0.02A * R

R = 100 Ohms

So 100 Ohms is the absolute minimum resistance we need to make sure that we do not
damage the LED. To be safe, it's a good idea to use something a little higher, just in case
your LED has slightly different ratings that what I've used here.

Note NEVER use a value of resistor that is LOWER than needed. You will put too much
current through the LED and damage it permanently. You could also damage other parts of
your circuit.

Recommendation for resistors at different LEDs (while connecting to the

5V pins on the microcontroller boards):

LED White Red Yellow Green Blue IR


RESISTO 100 Ohm 200 Ohm 200 Ohm 100 Ohm 100 Ohm 100 Ohm
R

This is an explanation of the color code you will find in the resistor:

Doctor Areilza, 32. 48010 Bilbao Tel. 944 271 818 Fax 944 396 098 E-mail: colegio@indautxujesuitak.org 2
Next we'll wire up the LED on the breadboard. Plug the resistor and the LED into the
central part of the breadboard so that the longer lead of the LED is electrically connected to
one of the resistor's leads.

Then connect the remaining end of the resistor to 5V and the remaining end of the LED to
ground. You should see the LED light up.

Doctor Areilza, 32. 48010 Bilbao Tel. 944 271 818 Fax 944 396 098 E-mail: colegio@indautxujesuitak.org 3
Notice how the LED's leads are not the same length, this is because LEDs need to be in a
circuit in a specific orientation in a circuit. Current always flows through LEDS from the
long lead to the short lead (in the schematic representation, current flows in the same
direction that the triangle points. Try flipping the orientation of your LED - you should find
that the LED will not light if it is placed in the circuit backwards.

Resistors, on the other hand, do not have an orientation, you'll notice that their leads are the
same length (their schematic representation shows this symmetry as well). Flipping the
orientation of a resistor in a circuit will have no effect on the circuit - try it.

Now try swapping the position of the LED and the resistor in the circuit.

You should find that this also does not affect the circuit. It does not matter if the current
limiting resistor is on one side of the LED or the other, it will still be effective in protecting
the LED against excess current.

Software

The software that is used to program the microcontroller, is open-source-software and can
be downloaded for free on https://www.arduino.cc/en/Main/Software

With this “Arduino software” you can write little programs which the microcontroller
should perform. This programs are called “Sketch”.

In the end the sketches are transferred to the microcontroller by USB cable.

Install it on the computer (the microcontroller NOT connected to the PC). After that you
open the software file and start the program named arduino.exe.

Two set ups on the program are important and should be considered:

a) The board that you want to connect, has to be selected on the arduino software.

It is here shown as “Arduino / Genuino Uno”.

Doctor Areilza, 32. 48010 Bilbao Tel. 944 271 818 Fax 944 396 098 E-mail: colegio@indautxujesuitak.org 4
b) You have to choose the right “Serial-Port”, to let the Computer know to which
port the board has been connected. That is only possible if the USB driver has been
installed correctly. It can be checked this way:

At the moment the Arduino isn't connected to the PC. If you now choose “Port”, under the
field “Tool”, you will already see one or more ports here (COM1/ COM2/ COM3…).

The quantity of the shown ports doesn't depend on the quantity of the USB ports on the
computer. When the board gets connected to the computer, YOU WILL FIND ONE MORE
PORT.

Installation of the USB driver

Doctor Areilza, 32. 48010 Bilbao Tel. 944 271 818 Fax 944 396 098 E-mail: colegio@indautxujesuitak.org 5
How it should be:

1. You connect the board to the computer.


2. The Computer recognizes the board and suggests to install a driver automatically.

ATTENTION:

Wait a second! Most of the time the computer can't find the driver automatically to
install it. You might choose the driver by your own to install it. It can be found in the
Arduino file under “Drivers”.

Control: at the control panel of the Computer you can find the “Device manager”. If
the board has been installed successfully, it should appear here. When the installation
has failed, there is either nothing special to find or you will find an unknown USB
device with a yellow exclamation mark. In this case: Click on the unknown device
and choose “update USB driver”. Now you can start over with the manual
installation.

Doctor Areilza, 32. 48010 Bilbao Tel. 944 271 818 Fax 944 396 098 E-mail: colegio@indautxujesuitak.org 6

You might also like