What is a LED?
- A LED is a semiconductor device that emits light when an electric current flows through it.
- Unlike traditional incandescent bulbs, LEDs don’t have a filament. Instead, they rely on the movement of electrons within the semiconductor material.
LED Structure:
A LED consists of several layers:
- N-Type Semiconductor Layer: This layer has an excess of electrons.
- P-Type Semiconductor Layer: This layer has an excess of “holes” (electron vacancies).
- Active Layer (Quantum Well): Located between the N-type and P-type layers, this thin layer is where light emission occurs.
- Metal Contacts: These allow current flow into and out of the LED.
How Does It Emit Light?
- When a voltage is applied across the LED (usually around 1.5 to 3.3 volts, depending on the LED type):
- Electrons from the N-type layer move into the active layer.
- Holes from the P-type layer move into the active layer.
- Electrons recombine with holes in the active layer.
- During recombination, energy is released in the form of photons (light).
- The color of the emitted light depends on the semiconductor material used (e.g., red, green, blue, etc.).
Polarity and Pins:
LEDs have two pins:
- Cathode (-): Connect this pin to the ground (GND) or negative terminal.
- Anode (+): Connect this pin to the positive voltage (VCC).
Reverse polarity (swapping the pins) won’t damage the LED but will prevent it from lighting up.
Forward Voltage and Current:
- Each LED has a specific forward voltage (Vf) requirement (e.g., 2.0V for a red LED, 3.3V for a blue LED).
- To prevent burning out the LED, use a current-limiting resistor (e.g., 220 ohms) in series with it.
Controlling Brightness:
- To control brightness, use Pulse Width Modulation (PWM):
- Rapidly turning the LED on and off at varying duty cycles.
- Higher duty cycle = brighter light.
Components
Arduino Uno
Breadboard
Led
Cables
Connection diagram
The code!
int led = 13; // the pin the LED is connected to void setup() { pinMode(led, OUTPUT); // Declare the LED as an output } void loop() { digitalWrite(led, HIGH); // Turn the LED on }