How to Dim an LED

Published

Dimming is the process of varying the light output of a light source. This is done to set the ambience or to save energy when full light output is not really needed. Most of the dimming systems used before LEDs or even today are designed for incandescent light bulbs. These systems usually use forward-phase and reverse-phase dimming methods in which the dimmer interrupts or chops the AC line input to reduce the power going into the driver. With less input power, there will be less output on the driver and the brightness of the light is decreased. The problem with these dimming methods is that they reduce the efficacy of the incandescent light bulb. They also produce unwanted EMI radiations, current surges, and AC distortions.

Though LEDs are expensive, they’re better when it comes to efficiency, quality of light, lifespan, toxicity, and durability. Compared to incandescent light bulbs, dimming LEDs has a lot of advantages and one of them is better efficiency. Because light intensity is directly related to LED current, dimming the LEDs saves energy. Dimming also extends the lifespan of LEDs because they run cooler when dimmed. Another advantage of LEDs is they have broader dimming range than other light sources. They can be dimmed to less than 1 percent of their full output.

What controls the brightness of an LED?

Forward Current (mA) vs. Forward Voltage (V) Graph of an LED
Forward Current (mA) vs. Forward Voltage (V) Graph of an LED

The amount of current flowing through an LED determines its light output. If we try to look at the graph above, we will see that changing the voltage also changes the current through the LED which makes us think to dim an LED by increasing or decreasing the voltage across it. However, we can also see that the region where we can change the voltage without the current getting too much is very small. Also, the current is not predictable as well as the brightness.

Relative Intensity (a.u.) vs. Forward Current (mA) Graph of an LED
Relative Intensity (a.u.) vs. Forward Current (mA) Graph of an LED

If we scan some LED datasheets, we can see that the luminous intensity of an LED depends on the forward current. Their relationship is almost linear too. So in dimming LEDs, we take the forward voltage as a fixed value and control the current instead.

LED Dimming Methods

All LED devices require a driver in order to be dimmed and there are two common methods that drivers use to dim LEDs: Pulse Width Modulation and Constant Current Reduction (also known as Analog Dimming).

Pulse Width Modulation (PWM)

In PWM, the LED is turned ON and OFF at its rated current at a high frequency. The rapid switching is high enough for the human eye to see. What determines the brightness level of the LED is the duty cycle or the ratio of the time when the LED is ON and the total time of one complete cycle.

Advantages:

  • Provides a very precise output level
  • Suitable for applications that need to maintain certain characteristics of the LED such as color, temperature, or efficiency
  • Broad dimming range - can decrease light output to values of less than 1 percent
  • Avoids color shift by operating the LED at its recommended forward voltage/forward current operating point

Disadvantages:

  • Drivers are complex and expensive
  • Since PWM uses fast switching, the fast-rising edge and falling edge of each switching cycle produce unwanted EMI radiations
  • The driver might have performance issues when running with long wires since the stray characteristics of the wire (capacitance and inductance) can interfere with the fast edges of the PWM

Constant Current Reduction (CCR)

In CCR, the current flows continuously through the LED. So the LED is always ON, not like in PWM where the LED is always turned ON and OFF. The brightness of the LED is then varied by changing the current level.

Advantages:

  • Can be used with applications with strict EMI requirements and remote applications where long wire runs are used
  • CCR drivers have higher output voltage limit (60 V) than drivers that use PWM (24.8 V) when classified as UL Class 2 drivers for dry and damp locations

Disadvantages:

  • CCR is not suitable for applications where dimming light levels below 10 percent is desired because at very low currents, LEDs do not perform well and the light output can be erratic
  • Low drive currents can result into inconsistent color

Dimming an LED through PWM

For now, we don't have an example for CCR but we have a simple demonstration for PWM to show how PWM dimming works. We have here an Arduino Uno which we will use as our PWM signal generator, an LED with its series resistor, and a potentiometer.

LED PWM Arduino Uno

The wiring as shown in the image is just very easy. The LED is connected to the PWM pin (D9) and the wiper terminal of the potentiometer is connected to the ADC pin (AD0) of the Arduino Uno.

The ADC of the Arduino Uno reads the analog voltage across the wiper terminal of the potentiometer and based on that voltage, the Arduino Uno adjusts the duty cycle of the PWM signal. So by tweaking the potentiometer, we can change the duty cycle of the PWM signal driving the LED and change the brightness of the LED.

LED Dimming with Arduino Uno Schematic Diagram

In case you want to try this, you can follow the schematic diagram above and upload the code below into your Arduino Uno board. If you have an oscilloscope to monitor the duty cycle of the PWM signal, that would be great. But if you don't have, you can monitor the duty cycle through the serial monitor of the Arduino IDE.

/*This program changes the duty cycle of the PWM signal at digital pin 9 using a potentiometer connected to ADC channel (A0). You can monitor the duty cycle value through the Arduino IDE serial monitor. Notes: (1) PWM signal frequency at digital pin 9 is 490Hz. (2) Serial.print only executes when there’s a change in the ADC reading.*/

int PWMOutPin = 9; // PWM output pin that the LED is attached to

int PreviousPotValue = 0;

int Threshold = 0; //Reference for SerialPrint

void setup()

{

Serial.begin(9600); // initialize serial communications at 9600 bps

}

void loop()

{

int PotValue = analogRead(A0); // read analog input A0

int PWMValue = PotValue/4; // Convert 0 --> 1023 range to 0 --> 255

analogWrite(PWMOutPin, PWMValue); // Change the output of the PWM pin

Threshold = abs(PotValue - PreviousPotValue);

//This part is executed only when there's a change in A0 reading

if (Threshold >= 10){

// print the results to the Serial Monitor:

int PWM_DutyCycle = ((float)PWMValue/255.0)*100.0;

Serial.print("PWM Duty Cycle = ");

Serial.print(PWM_DutyCycle);

Serial.println("%");

PreviousPotValue = PotValue;

}

//This part is executed only when there's a change in A0 reading

// wait 2 milliseconds before the next loop for the analog-to-digital

// converter to settle after the last reading:

delay(2);

}

So that's how we can basically dim an LED. I hope this tutorial helps you understand the concepts, the pros and cons, and the different ways to dim an LED. If you’ve found this tutorial interesting or helpful, give it a like and if you have any questions, leave it in the comments below. For more tutorials about technology and electronics, please sign up for our newsletter!

Make Bread with our CircuitBread Toaster!

Get the latest tools and tutorials, fresh from the toaster.

What are you looking for?