CHAPTER 4: EXTERNAL LED BLINK

Now that you are familiar with how to run a basic sketch on an Arduino, lets take it up a notch. We will learn to connect an external LED to Arduino and control it via a sketch.

Things required for this chapter

  • Arduino Uno/Uno (Arduino compatible board)

  • USB Cable (Type A/B Standard USB 2.0 cable)

  • Bread board

  • 1 x LED

  • 1 x 220Ω Resistor

  • 2 x Jumper wires

Like in the previous example, we will have to setup two parts.

Hardware setup:

Wiring LED's are the most common thing you would do in your projects. However, it has to be noted that LED's are polarized, which means if you connect +ve end of the LED to -ve end of the circuit, there is a high chance that you might burn the LED. So, how do you differ the +ve end from the -ve end?

From the image below, we can see two differentiating features which helps us to identify the +ve and the -ve terminal.

  1. The main feature you notice is from the front view which is the difference in the length of the terminals. +ve terminal is longer then the -ve terminal.

  2. From the Top view, we can see a flat side in the circular ring of the LED. This indicates the Cathode (-ve terminal).

Figure: Schematics of LED

Image via - Society of Robots

Next, we should connect the LED to the Arduino. Seems straight forward right? Its not. The connection is done according to the figure below.

Figure: Circuit connection for blinking an external LED

We connect a wire (Red) from Digital pin 7 of the UNO to the breadboard and connect a 220Ω resistor in series with the +ve end if the Red LED. The reason is simply to limit the current flow across it since the LED is a diode which takes in certain amount of current. The value of resistance to be used is based on the Ohm's law. Then we connect another wire (Black) from the -ve end of the LED to the ground of Arduino which is denoted as GND.

NOTE: Different color LED's have a different forward voltage. In our case, Red LED has a forward voltage of 2.0V and forward current of 20mA. To know more click here

Since the resistance value is 150Ω, we can connect a resistor of 150Ω or above. However, it has its own limitations on how large resistor you can connect. The reason I connected 220Ω resistor is because that was the closest available resistor with me since I didn't have a 150Ω resistor.

Sketch setup:

The sketch is similar to the previous sketch. Instead of lighting the internal LED, we control the external LED.

Figure: LED blink sketch

The main difference is the pin number. We are using pin 7. So we initialize pin 7 in our sketch.

Final Outcome

Here is a representation of what the Arduino will output after running the sketch on it.

Up next,​ Chapter 4: Controlling the brightness of an LED

At any point of time, if you feel that learning through this blog is not your thing, please feel free to explore other mediums like Books, YouTube videos, Arduino Forums or other Blog posts.

If you want to add something interesting or want to point out any errors on this article, please feel free to comment below.

The Arduino Community logo is used under the Creative Commons license CC-SA-BY-NC 3.0

Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square