# What is LED (Light Emitting Diode) – Working, Interfacing & Uses | Electronics for Beginners

Hello everyone! In this video, we are going to learn all about LEDs: how they work, how to interface them with prototyping boards like evive and Arduino, and how to program them in Pictoblox. Finally, we’ll take a see what wonders
we can create using them! Let’s begin! Light emitting diodes, aka LEDs, are tiny light-bulb-like devices that glow when current passes through them. There are two important things you need to
keep in mind while working with the LEDs. The first is their polarity. Just like batteries, LEDs also have a positive
and negative terminal. The longer leg is the +ve terminal and the
shorter one is the negative terminal. They allow the current to pass ONLY in one direction, i.e. from the positive terminal to the negative terminal. To make LED work perfectly, connect the +ve
terminal of the LED to a higher potential than the -ve one. The second is their current rating. Their current rating is the maximum value
of the current they can withstand; if you pass a current greater than that value,
they may blow up! The safe value of current for LEDs is usually
around 20 milliamperes. To limit the value of current we use resistors,
the value of which is calculated using Ohm’s law. Now that we have a basic understanding of LEDs, let’s have a look at how to interface one with evive and see it in action. evive already has an LED connected to Digital Pin 13. Thus, we will focus on writing scripts to control it here. If you want to connect an external LED, you
can make a circuit like this on evive’s breadboard and connect the +ve terminal of the LED to a digital pin through which you want to control the LED. Now, let’s program the pin 13 LED in PictoBlox. It is a graphical programming software based on Scratch blocks. You can download it from the link given in
the description box below. Open PictoBlox. Then, click on the board button and select
evive from the drop-down. Now, from the dialogue box that appears, choose
the appropriate serial port. Before writing the script, make sure that
the firmware is uploaded. If not, upload it using the Upload firmware button. We will write a script to make the LED blink every second. To turn the LED ON/OFF, we will use the set
digital pin block from the evive palette. First, select the digital pin to which it is connected. The default pin is 13, to which our LED is already connected. Now, to turn the LED on, select HIGH from
the second dropdown menu. Next, add a wait of 1 second. Duplicate the script and place it below the wait block. Now, to turn the LED OFF, choose LOW from the dropdown. Finally, to run the script continuously, add a forever block. Now, we’ll place a when flag clicked hat
block above the forever block. It will ensure that the script runs when the green flag is clicked. Now, we’ll check whether the LED is blinking
or not by running the script. Since everything is perfectly fine, let’s make another script to control the brightness of the LED in real-time. To control the brightness we will use Pulse Width Modulation. It is a technique to reduce the average voltage at a digital pin by controlling the width
of the digital pulse at that pin. Let’s make a variable to control the brightness. to place it in the blank space of the set PWM block. We will use the set PWM pin block from the evive palette. Add a waiting time of 0.1 seconds. Next, add a forever block to run the script continuously. Now, we’ll place a when flag clicked hat
block above the forever block. Now, let’s have a look at the output by running the script. Now, let’s write the script to make the
LED blink in Upload mode so that we can work with evive without it being connected to the computer. This script will be similar to the first one,
the only difference is the hat block. As we are going to upload the script to evive,
we will use the when evive starts up hat block above the entire script to execute the program. Now, upload the code using the upload button. Now that you know how to work with LEDs, there are a number of projects you can make using them like an LED cube, smart LED Street Light, Smartphone Controlled LED Lamp, persistence of vision, and much more. If you liked this video, give it
a thumbs up and share it with your friends! For more such educational videos, subscribe to STEMpedia and follow us on Facebook, Instagram, and Twitter. Bubye!

## One comment on “What is LED (Light Emitting Diode) – Working, Interfacing & Uses | Electronics for Beginners”

1. Science Lab says:

Awesome explanation of led