We often use Light Emitting Diode (LED) in project as display, indicator or light source. I personally think that LED provides a great visual effect to your project, isn’t it? Today I am going to share some of the tips on using LED that might be useful to your LED project.


Since LED is actually a diode, it allows current to flow in one direction and emits light. When current flow in the reverse direction, the LED will not lights up. How to identify the polarity of LED?

(1) The longer lead of LED usually is the Anode (+) while the shorter lead is the Cathode (-).

(2) The Cathode side has flat spot on one side as shown figure above.

(3) Identify the “flag” inside the LED, that gives us the Cathode lead.

Single Color LED
R: Red
G: Green
B: Blue
7 Segment Display

When connecting LED, remember to include a current limiting resistor series to the LED. The purpose of adding current limiting resistor is to prevent too much of current passing through the LED. Too much of current on LED will result in damaging the LED forever. So what value of resistor you should use? You can calculate the value using the knowledge you learnt during your Physics class, Ohm’s Law.

Ohm law
Ohm’s Law

First, there are a few things you need to determine in your circuit, the maximum current allowed, Imax and forward voltage, Vf of your LED. The maximum current is the current that you should not exceed while the forward voltage is the minimum voltage required to turn on the LED. Then determine the supply voltage, Vs that you are going to use.

The value of resistor is given by the formula below:

ohm law 1

For example, the Imax and Vf for an LED is given by 20mA and 2V, and we are using 5V supply. So we should use at least 150 ohm resistor on it.

Another point you should take note is pin 13 on Arduino does not has current limiting resistor. So NEVER connect your LED directly from Arduino if you don’t want to fry them.

When connecting LED in parallel, it is advisable to use separate current limiting resistor for each LED. This will limits the current across each LED and ensure equal brightness of the same LED. This is applicable when using 7 segment display. Use current limiting resistor on each segment instead of the common pin to avoid unequal brightness.

parallel led
Parallel LED with individual current limiting resistor

Never connect LEDs in parallel especially those are of different forward voltage. For example, three LED given figure below, LED 9, LED 10, LED 11. Forward voltage for 9 and 10 are of the same (eg. 2V), but the forward voltage for 11 is lower than 9 and 10, (eg. 1.6V). When you connect them in parallel, only LED 11 will lights up while the other two remain off. If you measure the voltage across the parallel LED, it will be the lower forward voltage of LED. Thus the other two LED’s forward voltage requirement is not met, which result in only LED 11 turned on.

no led
Parallel different forward voltage LED with one common current limiting resistor

There are methods to control LED from a microcontroller such as Arduino. One of the methods is using transistor as sink or source. The reason why to use a transistor instead of directly control the LED is because there is a maximum current source and sink allowed for a chip specified in the datasheet. So we want to prevent from exceeding the specified limit, therefore transistor provide an alternative for this problem.

What does the sink actually meant? The emitter of transistor, 2N3904 is connected to ground and the load is between the supply voltage and collector. When transistor is turned on, the current flowing into the collector of transistor. This provide a path for current back to ground, thus sinking the current.

sink LED
Sink LED

An example of how I usually use transistor to sink current for LED is to control common cathode seven segment display. By connecting the seven segment’s common to a transistor as below, you can control which display to turn on and off.

Transistor as current sink to drive Common Cathode 7 Segment
Transistor as current sink to drive Common Cathode 7 Segment

How about source? The collector of transistor is connected to the supply voltage and the load is between the emitter of transistor and ground. When the transistor is turned on, the current will flow out of emitter of transistor. The transistor provide a path of current source to the LED, so it is sourcing the LED.

source led
Source LED

Both sinking and sourcing LED, it is useful when you need to control LED which uses a higher separate supply voltage than the microcontroller supply voltage. The transistor can be used to isolate between these two voltages.

Another practical example of using transistor to source LED is to drive common anode seven segment display. You can switch on and off the seven segment display using microcontroller pins. I have been using this method to control seven segment displays in my digital clock using 7 segment display.

Transistor as current source to drive Common Anode 7 Segment
Transistor as current source to drive Common Anode 7 Segment

Besides that there are times where you need to control more than one LED at once from microcontroller. If you control directly from microcontroller pin, you will not have enough voltage turn on the LED since the total forward voltage is higher than what you supplied. The solution for this problem is to use transistor as source or sink, and connect the LED to higher voltage supply.

more led
Control more LED from microcontroller

I guess that’s all for the tips on using LED, I will update if I can think of any again. I hope that the tips shared above helps you in your projects and have lots of fun with LEDs!!

LED Matrix Display