Basics of digital LED control

Basics of digital LED control

LED dimming isn't just for mood lighting. Here's how digital controllers can handle dimming chores necessary for creating multicolor displays.

Most engineers are quite familiar with typical low-power-indicator LEDs, whether they be surface-mount or the classical through-hole packages. All that's needed to use them is a voltage source and a series resistor of the right value. The resistor, of course, keeps the current of the LED within spec — typically less than 5 mA. Tie this to a GPIO pin on a microcontroller and you get one of the world's most common demonstrations — a blinking LED.

However, all of the simplicity goes out the window when you move to a high-brightness, high-current LED with a forward current of well over 350 mA. This is particularly true when you put 10 of them together in a string.

The first issue with a high-brightness LED is the complicated process of efficiently maintaining a high constant current. LED brightness and color both change as a function of current. The accompanying figure shows the luminous flux of the LED — effectively the measurement of the amount of visible light it emits — is a function of the forward current through the LED. This shows the need to maintain a constant forward current, IF, through the LED to get a consistent color and light output.

Consider the case of a simple resistor, R, in series with the LED. The diode forward current is determined by IF = (VSource-VF)/R where VF is the LED forward voltage. As the source voltage, VSource, varies, the forward current IF will also fluctuate, varying the amount of light the LED emits. This clearly shows that the LED must be driven by a power supply that actively regulates IF.

In general, one important characteristic of LEDs and diodes is that their VF rises with temperature — even with a constant and regulated forward current. This is another example of the need to properly regulate IF rather than VF.

The next major challenge is heat. High-power LEDs get extremely hot. Excessive heat will significantly reduce LED lifespan and possibly cause premature failure. Active control of the LED forward current gives designers the ability to determine the necessary heat-sinking based upon the target forward current and estimated forward voltage. The use of temperature sensors also provides the option of monitoring for possible over-temperature situations. Additionally, there are other issues with high-brightness LEDs that must be addressed. But the intelligence of a DSC (digital signal controller) lets designers handle these issues through the power of software-based control.

LEDs have the amazing ability to change their light outputs almost instantly. This makes them candidates for use in color light-fixtures that provide rapid color change. It's possible to make any color of the rainbow by simply stringing together red, green and blue LEDs and then adjusting the brightness of the appropriate devices.

But dimming each LED becomes a design challenge in this scheme. Because the forward current of the LED dictates the brightness, the obvious approach is to simply raise or lower each LED's forward current. However, this creates a problem, as the color of the LED will also change slightly when its forward current changes. A varying LED color is usually undesirable.

The usual solution is to pulse the forward current rather than directly lowering or raising it. The effect on dimming is the same as a reduced forward current.

Use of digital control greatly simplifies the process of pulsed current dimming. Many DSCs have advanced PWM (pulse-width modulation) modules able to control the power stage of the LED. These PWM modules have override inputs that can quickly and precisely shut off the PWM outputs, thereby sending a precisely pulsed current to the LED.

Page 2 of 2

The amount of dimming is quantified by a number between zero and some value that represents full brightness. To, say, power the LED to 50% brightness, a designer would have the system monitor a counter which might count from zero to 255. It would trigger the PWM override when it noticed a count of 128. The PWM output then would shut off, effectively removing the current from the LED. When the counter reaches its maximum value of 255, it resets to 0, the PWM is again enabled, and the process repeats. The dimming frequency must be high enough so that the human eye cannot perceive the flicker in the LED. Typically, a frequency greater than 400 Hz will suffice.

Active control of LED forward current requires an active power supply. The topologies normally used for powering LEDs are the buck and the boost Switch Mode Power Supply (SMPS). Both actively control the current to the LED, and both benefit from the intelligence of a DSC.

A buck topology is best in cases where the forward voltage of the LED, or string of LEDs, is below the source voltage. A typical buck topology used to control an LED employs a PWM signal to control a switch, Q, in series with a sense resistor, Rsns, and the LED. Voltage across the sense resistor corresponds to the forward current of the LED when the switch Q is closed.

The voltage across Rsns is fed to the DSC comparator, which then compares this voltage against a configurable internal reference that is proportional to the desired forward current of the LED. If the sensed voltage exceeds the internal reference, the analog comparator disables Q, which causes an inductor, L, which is also in series with the LED, to discharge its stored current through the LED and a diode, D, across it. On the start of the next PWM period, switch Q closes, and the process repeats. The DSC's advanced features let this method actively regulate the forward current through the LED while using no CPU overhead.

As the name implies, a boost topology is best in cases where the forward voltage of the LED or string of LEDs exceeds the source voltage. Like the buck topology, the PWM controls a switch, Q, and the forward current is monitored across a sense resistor, Rsns, in series with the LEDs. The A/D converter module on the DSC samples the voltage across the sense resistor, which corresponds to the forward current of the LED. This value is then fed into a proportional integral (PI) control loop software routine on the DSC. The integral term in the loop reduces oscillations in the LED current in response to changes in the dimming frequency.

Based upon the ADC reading and a software reference value corresponding to the amount of needed current, the PI loop adjusts the duty cycle to switch Q. The advantage of using a DSC here is that the PI control loop is implemented in software so a wide variety of more sophisticated control-loop methods can be used. Furthermore, the PI control loop uses little CPU overhead, so the DSC can handle multiple LED strings with headroom left over for other features.

One of those other features is often the ability to add communications to the system. A DSC has enough processing capability to intelligently control the LED fixture, while simultaneously exchanging data with the outside world. This eliminates the need for a separate communication-and-control device.

One common lighting-control protocol is DMX512. This standard uses one-way communication with one master and multiple slaves to send commands to individual light fixtures. DMX512 transmits 512 bytes of data per packet and lets each device or node be individually addressed. DSC high-speed processing lets it run a fast control loop, such as the PI controller for the boost converter, as its top priority. It can run the communication protocol, such as DMX512, in the background. Because software implements the communication scheme, the fixture isn't limited to just one protocol. It can run as many as the designer needs.

Like any new technology, digital LED control has a learning curve. To simplify learning digital control, many silicon suppliers now offer digitally controlled LED lighting kits and reference designs. Many of these include free source code and hardware documentation.

Because there is such a wide variety of LED topologies, some reference designs even offer interchangeable power stages. For example, the LED Lighting Development Kit (part no. DM330014) from Microchip has the LED driver stage on a daughter card, permitting experiments with multiple driver stages using the same board.

All in all, digital control using a DSC can take designers and their lighting fixtures to the next level.


Microchip Technology Inc., Chandler, Az., (480) 792-7200,

Want More?

More info:

Focus on this code image using your smartphone and free software from and you will be connected to related content on

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.