Use LED in Robot Projects

by Oscar

In this article I will show you what is LED, how to use LED in Robot projects without breaking them, especially when using multiple of them connected in series or parallel.

Some of the links on this page are affiliate links. I receive a commission (at no extra cost to you) if you make a purchase after clicking on one of these affiliate links. This helps support the free content for the community on this website. Please read our Affiliate Link Policy for more information.

What is LED

LEDs come in a wide range of colour, brightness and power ratings. Some of the latest high power LEDs even require heat sinking  No matter what LED you want to use, they all have some basic properties in common that you need to know before using them in a circuit.

First of all, LEDs are a polarized electronic component. This means that power must be connected the right way or else damage will occur. For this reason there is always some indication on the casing as to which lead is positive and which is negative.

This is a photo of a typical LED with it’s parts labeled from Wikipedia.

LED part labeled - use LED in robot

Notice the cathode (negative) has a flat on it’s side. The anode usually has a longer lead. If the LED does not have a flat side and the leads are the same length or have been trimmed then notice in this photo that the cathode has the reflector attached.

If you have an unusual LED and cannot determine the + and – leads then check it’s datasheet.

Notice on this 1W LED that positive and negative are etched on the connections. LEDs like this are mounted on large bases because they need a heat sink. With Aluminium torches, the body acts as a heat sink.


Separate Lens can be bought for these type of LEDs to change the output to a narrow beam if required.

How to Avoid Destroying LEDs

Once you’ve determined the right way to connect the LED you need to consider current limiting. This is usually done with a resistor in series with the LED. A LED without sufficient series resistance (leads to high current) will have a extremely bright but short existence before going up in a puff of magic blue smoke :-)

To calculate the correct resistor value you need to know a few things about your LED.

  1. what is it’s forward voltage drop?
  2. what is it’s maximum continuous forward voltage.

This information should be supplied with you LEDs or can be found in the datasheet. You don’t need to understand everything in them but you should be able to find basic information such as absolute maximum ratings and electrical characteristics. The second attachment covers a wide range of components but in the section on LEDs it gives you details on various LEDs such as forward voltage and max continuous current. It demonstrates that both values can vary widely depending on the LED.

Once you know the forward voltage drop and maximum current you can work out your circuit design and resistor values.

This is a basic power indication LED circuit. The formula for calculating the series resistor is:


R ohms = (Vsupply - VLED) / I where "I" is current in amps. For the circuit on the right, assume the supply voltage is 7.2V, the forward voltage of the diode is 2.1V and it's maximum forward current is 15mA. R ohms = (7.2V - 2.1V) / 0.015A R ohms = 5.1V / 0.015A R ohms = 340 ohms

Since you can’t get a 340 ohm resistor I would use a 390 ohm. The current would be less giving you a safety margin.

If you are driving a LED from a processor output as an indicator light then the same formula works except that your supply voltage is that of the processor (usually 5V) and your processor is limited on it maximum current output. Pic processors have a maximum limit of 25mA which is enough for most LEDs. Note that the forward voltage of the LED must be less than the supply voltage or else it wont light up.

How about Multiple LEDs in Series or Parallel?

If you want to turn on more than one LED at once then you need to look at the best way to wire them up. Since most robots run on batteries, efficiency is a consideration. A series resistor does waste some power so the fewer resistors the better. Having your LEDs wired in series means one resistor can limit the current for many LEDs but there are limits.

In the sample circuit on the right I’m using an IR spotlight consisting of 8 IR LEDs. These LEDs have a forward voltage drop of 1.2V and a maximum continuous current of 50mA. When you connect LEDs in series then their forward voltage drops must be added together.

If I wired all eight LEDs in series then the combined forward voltage drop would be 8 x 1.2V = 9.6V. Since the supply is only 6.6V (a 7.2V battery pack minus 0.6V of a polarity protection diode) the LEDs will not light up. In this case I’ve created two equal strings of 4 LEDs with each string having a voltage drop of 4 x 1.2V = 4.8V. The resistor value is then (6.6V-4.8V)/0.05A = 36 ohms.

By rights the circuit should show 39 ohm resistors as the 33 ohm resistors will allow 54mA to flow. The reason I can get away with this is because these LEDs are only turned on for a few milliseconds at a time in this application and the 50mA limit was a continuous rating. If your design requires the LEDs being on for an extended period of time then you should use a higher resistor value rather than a lower one. By wiring the LEDs in series strings like this, the power wasted by the resistors is the voltage across the resistor multiplied by the current. The voltage across the resistor is the supply voltage minus the forward voltage drop of the LEDs.

P = (6.6V - 4.8V) x 0.05A P = 1.8V x 0.05A = 0.09W

So with the two resistors in this circuit the total wasted power is only 0.18W. Since each string of LEDs draws 50mA the total current drawn is 100mA. Since this is more than the processor can drive directly I’ve shown a N channel FET driven by the processor. A NPN transistor could also be used as long as it can handle the 100mA load. There will be a small voltage drop (usually about 0.4V) across the collector – emitter junction of a bipolar transistor. This may need to be taken into account if your LED forward voltage is close to the supply voltage.

If we had wired the LEDs in parallel with each LED having a series resistor then the power wasted across one resistor would be (6.6V – 1.2V) x 0.05A = 0.27W. Multiply that by eight resistors and that is 2.16W of wasted power. Since they are wired in parallel and each LED wants 50mA, a total current of 400mA will be drawn.


By connecting them in parallel with a single resistor the math changes a bit. The forward voltage drop across each LED is the same so it is still 1.2V no matter how many LEDs you wire in parallel but now the current required is 8 x 50mA. So now your resistor is:

R = (6.6V - 1.2V) / 0.4A R = 5.4V / 0.4A R = 13.5 ohms

And the power wasted is:

5.4V x 0.4A =2.16W, which is exactly the same as before except your single resistor will need to be rated at more than 2.16W.

So as long as the overall forward voltage drop does not exceed the supply voltage then where ever possible it is more energy efficient to connect your LEDs in series.

Reading a LED datasheet:

Below is an extract from the TSAL5100 data sheet with forward voltage drop and continuous current highlighted in blue. Click on the images for a larger picture.



This is the most important information to look for when using any LED. The information in red is usually only supplied for special purpose LEDs such as the TSAL5100. Because this LED is used in IR remote controls where range is important it can be pulsed at higher currents than normal under certain conditions.

Remember that the continuous current for this LED is 100mA. More than this and it will overheat. In fact there is a graph showing how high temperatures can affect the over all power dissipation and continuous current.

The 100mA rating does not apply over 25 degrees Celsius.

Another good reason to use a slightly higher value series resistor if you live in a hot climate. You don’t want your robot to die because the air conditioner stopped working :) According to this graph I should limit the current to about 80mA as it can reach 40 degrees Celsius here and I don’t have air conditioning.


Pulsing a LED at full power:

Now for some fun, if your circuit or program is not right then your LED could have a very short life expectancy. The data I’ve marked in red is for pulsing power. It shows a pulse time tp of 100uS. That’s 1/10,000th of a second. depending on your room temperature you can have a single surge of up to 1.5A or with a 50% duty cycle you can pulse continuously at 200mA. The 50% duty cycle comes from tp/T=0.5 this means that the pulse time/total time is 1/2. Considering the pulse current is twice the normal forward current this makes sense as the over all power (heat) generated is the same.

What all that boils down to is simply, you can pump twice the normal amount of power through it for 100uS but then you have to turn it off for at least 100uS to let it cool a bit. If you have it on for 100uS and off for 100uS then you get a frequency of 5KHz. So as long as you use a frequency of 5KHz or higher and have a duty cycle of no more than 50% then allowing for ambiant temperature you can pulse that LED all day at twice it’s normal current.

You can also send a surge of up to 1.5A through it for 100uS only once and then it must cool down completely before you can do that again. It will depend on the ambient temperature as to how long it will take to cool so they don’t specify it in the data sheet.

Use LED in Robot

Example of using the LED pulsing technique would be an IR detector, see:

Leave a Comment

By using this form, you agree with the storage and handling of your data by this website. Note that all comments are held for moderation before appearing.

1 comment

opik 24th May 2016 - 10:41 am

Thank’s gan,