How to determine the right resister for led in Arduino projects

It is critically important to know the correct resistor color value and its watts while designing an electrical circuit for Arduino projects

Here is why

Because if you apply high voltage to led it will burn out similarly, while designing an electrical circuit, if the resistor values are incorrect then, in that case, the resistor will also burn out

For example, if you apply a 5mm led to a 9V battery then, at that instant, it can instantly burn out the led

Basics of leds

Led is a light-emitting diode that usually, comes with different colors and features such as 5mm LEDs, 10mm LEDs, and 3mm LEDs

Rendered by

You can easily figure out the polarity of a led by seeing  its  pin size, normally, a led will have two pins in which the larger pin is called the anode(+) and the smaller pin is called the cathode(-)

Important led factors

During the circuit design, it is crucial to know three factors of led and you can find this information in the datasheet of the led or the website where you have purchased it

  1. Polarity
  2. Forward voltage(Vf)
  3. Max current (IF)

5mm led forward voltage and current

Rendered by

Identify the right resistor for the circuit

Rendered by

Suppose we are having an Arduino due that has an output voltage of 5V and we have a 5mm red led which have a forward voltage(Vf) as 0.2v and current(IF) as 20MA from its datasheet

We can figure out the right resistor for the above circuit

Current= 20MA= 0.02A

Voltage drop= 5v-2v=3v

Required resistance R= V/I=3/0.02=150 \Omega

Watt= amp x volt =IXV=0.02X3=0.06W


Watt(p)=V^2/R = 3^2/150=0.06w

So, you can use a resistor of 150\Omega with 0.06w(approximately 1/8w)

Test your circuit

void setup() {
  pinMode(2, OUTPUT);    // sets the digital pin 2 as output
void loop() {
  digitalWrite(2, HIGH); // digital pin 2 is on
  delay(1000);            // waits for a second
  digitalWrite(2, LOW);  //  digital pin 2 is off
  delay(1000);            // waits for a second

Mohammed Anees

Hey there, welcome to aneescraftsmanship I am Mohammed Anees an independent developer/blogger. I like to share and discuss the craft with others plus the things which I have learned because I believe that through discussion and sharing a new world opens up

Leave a Reply

Your email address will not be published.