blog

Light of the World: Light-Emitting Diode

LED 2

what is led?

The composition of LED

What is LED?

The full form of LED is Light Emitting Diode.

LED meaning refers to a semiconductor device. It is a solid-state light source that achieves efficient conversion from electrical energy to light energy through a semiconductor PN junction, with its core working mechanism relying on the key physical phenomenon of Electroluminescence.

led working principie

LED Working Principle

Specifically, when a forward voltage is applied across semiconductor materials (common ones such as compound semiconductors like Gallium Arsenide (GaAs) and Indium Gallium Nitride (InGaN)), the external electric field drives electrons in the semiconductor to move from the N-type region to the P-type region, while holes migrate from the P-type region to the N-type region.

During this process, electrons and holes recombine within the active layer near the PN junction, and this recombination process releases energy, a portion of which is emitted in the form of photons, thereby generating light radiation.

The working principle of LED

LED Material Properties and Advantages

Due to differences in the bandgap width of different semiconductor materials, the energy of the emitted photons varies, which directly determines the color of light emitted by the LED — for example, gallium nitride-based materials are commonly used to generate blue and green light, while gallium arsenide-based materials are more often used for producing red light and infrared light.

This solid-state semiconductor-based light-emitting method gives LEDs significant advantages over traditional light sources: it does not rely on filament heating or gas discharge, thus achieving higher energy conversion efficiency, less heat generation, and a longer service life.

LED optical and electrical properties

led

LED Colors and Material Composition

Light-emitting diodes (LEDs) showcase an impressive range of available colors, with the most commonly used ones spanning vivid red, fresh green, warm yellow, crisp blue, vibrant orange, pure white, and even infrared light—a type invisible to the human eye.

What distinguishes LEDs from ordinary diodes (typically made from germanium or silicon) is their unique material composition. LEDs are engineered using specialized elements such as gallium, arsenic, and phosphorus. By precisely adjusting the proportions of these elements during the manufacturing process, producers can fine-tune the semiconductor properties, thereby creating LEDs that emit distinct colors as illustrated in the table below.

Color Wavelength (nm) Forward Voltage (V) Material
Ultraviolet <400 3.1-4.4 Aluminium nitride (AlN)
Aluminium gallium nitride (InxGa1-xN)
Violet 400-450 2.8-4.0 Indium gallium nitride (InxGa1-xN)
Blue 450-500 2.5-3.7 Indium gallium nitride (InGaN)
Silicon carbide (SiC)
Green 500-570 1.9-4.0 Gallium phosphide (GaP)
Aluminium gallium phosphide (AlGaP)
Yellow 570-590 2.1-2.2 Gallium arsenide phosphide (GaAsP)
Gallium phosphide (GaP)
Orange 590-610 2.0-2.1 Gallium arsenide phosphide (GaAsP)
Gallium phosphide (GaP)
Red 610-760 1.6-2.0 Aluminium gallium arsenide (AlGaAs)
Gallium arsenide phosphide (GaAsP)
Gallium phosphide (GaP)
Infrared >760 >1.9 Gallium arsenide (GaAs)
Aluminium gallium arsenide (AlGaAs)

LED Color: Wavelength and Casing

The true color of an LED is defined by the wavelength of light it emits, a characteristic directly determined by the specific semiconductor materials used in its construction.

Crucially, this means the color of the light produced by an LED has no connection to the color of its external casing. The casing’s hue serves only two secondary purposes:

  • It helps optimize light output by enhancing transmission
  • It acts as a visual indicator of the LED’s intended color when the device is not illuminated
The Volt-Ampere Characteristic Curves of LEDs with Different Colors

The electrical properties of LEDs

LED Electrical Characteristics

A key electrical characteristic of LEDs is unidirectional conductivity. Simply put, current will only flow through the LED (and make it light up) when a positive voltage is applied to its anode and a negative voltage to its cathode, and that voltage has to cross a "threshold" (known as the forward voltage). If you reverse the voltage, almost no current flows—unless the voltage gets too high and damages the LED.

The relationship between voltage and current in an LED isn’t proportional either: at low voltages, the current is extremely small, and the LED barely lights up. But once the voltage is high enough (above the forward voltage), even a tiny increase in voltage can cause the current to jump dramatically. This "threshold voltage" varies with the LED’s color:

  • Red LEDs: around 1.8 to 2.5 volts
  • Green LEDs: about 2.0 to 3.0 volts
  • Blue or white LEDs: typically need 3.0 to 3.5 volts

What’s more, LEDs are super sensitive to voltage changes. A small shift in voltage can lead to a big difference in current, which might burn out the LED from too much current. So in real-world use, you either add a resistor in series to limit the current or use a dedicated constant-current circuit to power it. Also, LEDs can’t handle much reverse voltage—usually only 5 to 50 volts. If the reverse voltage exceeds that range, the current will spike suddenly, and the LED will likely get ruined for good.

led 1
The circuit of LED

RGB LED LIGHTS

KY 016 RGB LED module 1

Three-color LEDs (RGB LED LIGHTS)

Three-color LEDs (RGB LED LIGHTS) stand as a core technology in modern display and lighting fields. By independently controlling the brightness of the three primary colors—red, green, and blue—they can mix to produce over 16 million colors, with an NTSC color gamut coverage of more than 72%.

In professional display applications, three-color laser light sources achieve a color accuracy of ΔE < 1.5 (meeting the standard of professional monitors) and can render approximately 1.07 billion colors, far surpassing the 40% saturation performance of single-color light sources.

With the advancement of technology, the traditional RGB arrangement has been transformed into an RGBG (Red-Green-Blue-Green) four-chip structure. By adding an extra green LED chip, optimizing the spatial layout based on human visual characteristics, and integrating sub-pixel reuse and sub-pixel sampling technologies, pixel-level display effects are achieved.

Parameter IndexTri-color LEDFluorescent LampIncandescent Lamp
Luminous Efficacy (lm/W)50 - 10060 - 8010 - 15
Average Lifespan (hours)50, 0008, 0001, 000
Start-up TimeNanosecond level0.5 - 2 secondsInstantaneous
Shock ResistanceExcellentAveragePoor
Environmental FriendlinessMercury-freeContains mercuryMercury-free
Operating Temperature Range-40℃ - 85℃0℃ - 50℃-20℃ - 40℃

The working principle of RGB LED lights

KY-016 RGB LED Module

Take KY_016 as an example. This device adopts a common cathode configuration and encapsulates three independent light-emitting chips inside:

  • Red (wavelength 620-625nm)
  • Green (520-525nm)
  • Blue (465-470nm)

It features a shared cathode grounded. Each anode is connected to the driver circuit through a current-limiting resistor, forming three independent control channels.

This design enables a single LED to achieve full-color display, which is convenient to use and widely applied.

Internal circuit diagram of RGB LED lights

KY-016 Specifications

Parameter Value
Operating Voltage 5V
LED Drive Mode Common cathode drive
LED Diameter 5mm
Board Size 15mm x 19mm [0.59in x 0.75in]
RGB LED LIGHTS Specifications

RGB_LED_ARDUINO

RGB 3 Color LED Module KY 016 in Arduino

KY-016

Arduino

R

Pin 11

B

Pin 10

G

Pin 9

GND

KY 016 ARDUINO

KY-016 Arduino Code uses Arduino to control the RGB_LED to achieve a cool and dazzling light show effect.

				
					#include <math.h>

// Define RGB pins
const int redPin = 9;    // Red pin connected to PWM9
const int greenPin = 10; // Green pin connected to PWM10
const int bluePin = 11;  // Blue pin connected to PWM11

// Light effect parameters
const int baseSpeed = 20;      // Base animation speed
const int maxBrightness = 255; // Maximum brightness (0-255)
const int minBrightness = 20;  // Minimum brightness
const int beatDuration = 300;  // Beat duration in milliseconds (controls overall speed)

// Current color state
float currentHue = 0.0;        // Current hue in HSV color space (0.0-1.0)
int currentR = 0;              // Current red value
int currentG = 0;              // Current green value
int currentB = 0;              // Current blue value

// Rhythm pattern configuration
const int patternCount = 8;    // Number of light effect patterns
const int patterns[patternCount][4] = {
  // Rainbow, Strobe, Brightness, Speed factor
  {1, 0, 255, 1},   // Rainbow gradient
  {0, 1, 255, 1},   // White strobe
  {1, 0, 180, 1},   // Medium brightness rainbow
  {0, 1, 255, 1},   // Random color strobe
  {1, 0, 220, 2},   // Slow rainbow
  {0, 1, 255, 1},   // Triple strobe
  {1, 0, 150, 1},   // Deep color rainbow
  {0, 1, 255, 0}    // Climax strobe
};

unsigned long lastBeat = 0;    // Timestamp of last beat
int patternIndex = 0;          // Current pattern index

void setup() {
  // Set RGB pins as outputs
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  
  // Initialize random number generator
  randomSeed(analogRead(0));
  
  // Start with LEDs off
  setColor(0, 0, 0);
  
  // Initialize timer
  lastBeat = millis();
  
  // Smooth startup sequence
  fadeIn();
}

void loop() {
  unsigned long currentTime = millis();
  
  // Check if it's time to switch to next pattern
  if (currentTime - lastBeat >= beatDuration) {
    lastBeat = currentTime;
    
    // Execute the current pattern
    executePattern();
    
    // Move to next pattern (loop back to start)
    patternIndex = (patternIndex + 1) % patternCount;
  }
  
  // Continuously update color in rainbow mode
  if (patterns[patternIndex][0] == 1) {
    updateRainbow(patterns[patternIndex][3]);
  }
  
  // Add random micro-flashes for dynamic effect
  if (random(100) < 5) {
    microFlash();
  }
}

// Smooth fade-in startup sequence
void fadeIn() {
  // Fade in red
  for (int i = 0; i <= 255; i += 5) {
    setColor(i, 0, 0);
    delay(30);
  }
  
  // Fade in green
  for (int i = 0; i <= 255; i += 5) {
    setColor(255, i, 0);
    delay(30);
  }
  
  // Fade in blue
  for (int i = 0; i <= 255; i += 5) {
    setColor(255, 255, i);
    delay(30);
  }
  
  // Turn off and pause before main sequence
  setColor(0, 0, 0);
  delay(200);
}

// Execute the current pattern effect
void executePattern() {
  int patternType = patterns[patternIndex][0];
  int flashType = patterns[patternIndex][1];
  int brightness = patterns[patternIndex][2];
  
  if (patternType == 1) { 
    // Rainbow mode - handled in main loop
  } 
  else if (flashType == 1) { 
    // Strobe mode - execute specific strobe effect
    switch (patternIndex) {
      case 1: // White strobe
        whiteFlash(2, 80); 
        break;
      case 3: // Random color strobe
        randomColorFlash(4, 60); 
        break;
      case 5: // Triple strobe
        tripleFlash();
        break;
      case 7: // Climax strobe
        climaxFlash();
        break;
    }
  }
}

// Update rainbow color progression
void updateRainbow(int speedFactor) {
  // Increment hue value (controls color change speed)
  currentHue += 0.003 * speedFactor;
  if (currentHue >= 1.0) currentHue = 0.0;
  
  // Convert HSV to RGB
  hsvToRgb(currentHue, 1.0, patterns[patternIndex][2]/255.0);
  
  // Apply new color
  setColor(currentR, currentG, currentB);
}

// Convert HSV color space to RGB
void hsvToRgb(float h, float s, float v) {
  int i = int(h * 6);
  float f = h * 6 - i;
  float p = v * (1 - s);
  float q = v * (1 - f * s);
  float t = v * (1 - (1 - f) * s);
  
  switch (i % 6) {
    case 0: 
      currentR = v * 255; 
      currentG = t * 255; 
      currentB = p * 255; 
      break;
    case 1: 
      currentR = q * 255; 
      currentG = v * 255; 
      currentB = p * 255; 
      break;
    case 2: 
      currentR = p * 255; 
      currentG = v * 255; 
      currentB = t * 255; 
      break;
    case 3: 
      currentR = p * 255; 
      currentG = q * 255; 
      currentB = v * 255; 
      break;
    case 4: 
      currentR = t * 255; 
      currentG = p * 255; 
      currentB = v * 255; 
      break;
    case 5: 
      currentR = v * 255; 
      currentG = p * 255; 
      currentB = q * 255; 
      break;
  }
}

// Set LED color using PWM values
void setColor(int r, int g, int b) {
  analogWrite(redPin, r);
  analogWrite(greenPin, g);
  analogWrite(bluePin, b);
}

// White strobe effect
void whiteFlash(int count, int delayTime) {
  for (int i = 0; i < count; i++) {
    setColor(255, 255, 255);  // White
    delay(delayTime);
    setColor(0, 0, 0);        // Off
    delay(delayTime/2);
    
    // Restore current rainbow color
    setColor(currentR, currentG, currentB);
    delay(delayTime/2);
  }
}

// Random color strobe effect
void randomColorFlash(int count, int delayTime) {
  for (int i = 0; i < count; i++) {
    // Generate random bright color
    int r = random(50, 255);
    int g = random(50, 255);
    int b = random(50, 255);
    
    setColor(r, g, b);
    delay(delayTime);
    setColor(0, 0, 0);
    delay(delayTime/2);
  }
  
  // Restore current rainbow color
  setColor(currentR, currentG, currentB);
}

// Triple color strobe effect
void tripleFlash() {
  for (int i = 0; i < 3; i++) {
    // Red flash
    setColor(255, 0, 0);
    delay(50);
    setColor(0, 0, 0);
    delay(30);
    
    // Green flash
    setColor(0, 255, 0);
    delay(50);
    setColor(0, 0, 0);
    delay(30);
    
    // Blue flash
    setColor(0, 0, 255);
    delay(50);
    setColor(0, 0, 0);
    delay(50);
  }
  
  // Restore current rainbow color
  setColor(currentR, currentG, currentB);
}

// Climax strobe sequence
void climaxFlash() {
  // Fast color sequence through rainbow colors
  int colors[][3] = {
    {255, 0, 0},    // Red
    {255, 255, 0},  // Yellow
    {0, 255, 0},    // Green
    {0, 255, 255},  // Cyan
    {0, 0, 255},    // Blue
    {255, 0, 255},  // Magenta
    {255, 255, 255} // White
  };
  
  // Flash through all colors
  for (int i = 0; i < 7; i++) {
    setColor(colors[i][0], colors[i][1], colors[i][2]);
    delay(50);
    setColor(0, 0, 0);
    delay(30);
  }
  
  // Final triple white flash
  for (int i = 0; i < 3; i++) {
    setColor(255, 255, 255);
    delay(40);
    setColor(0, 0, 0);
    delay(30);
  }
  
  // Restore current rainbow color
  setColor(currentR, currentG, currentB);
}

// Random micro-flash effect for added dynamics
void microFlash() {
  int originalR = currentR;
  int originalG = currentG;
  int originalB = currentB;
  
  // Temporarily increase brightness
  setColor(
    constrain(originalR + 60, 0, 255),
    constrain(originalG + 60, 0, 255),
    constrain(originalB + 60, 0, 255)
  );
  
  // Short delay for visible effect
  delay(20);
  
  // Restore original brightness
  setColor(originalR, originalG, originalB);
}
				
			

Download of relevant materials

Purchase link

Leave a Reply

Your email address will not be published. Required fields are marked *