More Than Efficient Lighting: An Effective LED Driver Using an 8-Bit MCU

An 8-bit microcontroller can create an effective LED driver and add advanced features that make the lighting solution even more attractive.

Mark Pallones

January 10, 2017

8 Min Read
More Than Efficient Lighting: An Effective LED Driver Using an 8-Bit MCU

In today’s energy-conscious environment, LEDs are often favored over conventional light sources. This is because of their inherent low power and long life. In addition to this, since LEDs are solid-state lighting (SSL), they can be dimmed, allowing the user to create fantastic lighting effects while reducing the overall power consumption.

Obtaining these benefits from LEDs requires an effective LED driver. The LED driver’s effectiveness is linked to its ability to provide an efficient energy source, to ensure LED’s optimal performance and to maintain the long life of LEDs, even both as the driver keeps the LED output intensity constant and while changing intensity. Also, an LED driver that is intelligent and has advanced capability can make lighting solutions even more attractive.

Although an effective LED driver can offer many advantages, there are also challenges in its implementation. This article will show how an 8-bit microcontroller (MCU) can be used to alleviate design challenges and create high-performance LED driving solutions with capabilities beyond that of traditional solutions.

Some 8-bit microcontrollers have building blocks that can create an effective LED driver. The microcontroller in Figure 1 independently controls up to four different colors of LED channels. Each channel has the LED dimming engines created out of the peripherals available in the microcontroller. Each of these engines has an independent closed loop that can control the power converter with minimal to no central processing unit (CPU) intervention. This leaves the CPU free to perform other important tasks such as supervisory functions, communications or added intelligence in the system.

Fig. 1: Diagram of four LED strings being controlled by a Microchip PIC16F1779 8-bit microcontroller

LED Dimming Engine

The current-mode boost converter shown in Figure 2 is an effective LED driver which is primarily controlled by the LED dimming engine. The engine is mainly composed of core independent peripherals (CIP) such as complimentary output generator (COG), digital signal modulator (DSM), comparator, programmable ramp generator (PRG), op amp (OPA) and pulse-width modulator 3 (PWM3). Combining these CIPs with other on-chip peripherals, such as fixed-voltage regulators (FVR), digital-to-analog converters (DAC) and Capture/Compare/PWM (CCP), completes the whole engine. The COG provides the high frequency switching pulse to MOSFET Q1 to allow the transfer of energy and supply current to the LED string. The switching period of the COG output is set by the CCP and the duty cycle, which maintains the LED constant current and is dictated by the comparator output. The comparator produces an output pulse whenever the voltage across Rsense1 exceeds the output of PRG module. The PRG, whose input is derived from OPA output in the feedback circuit, is configured as a slope compensator to counteract the effect of inherent subharmonic oscillation when the duty cycle is greater than 50%.

The OPA module is implemented as an error amplifier (EA) with a Type II compensator configuration. The FVR is used as the DAC input to provide voltage reference to the OPA non-inverting input based on the LED constant current specification.

Fig. 2: LED driver solutions using the LED dimming engine.

In order to achieve dimming, the PWM3 is used as a modulator of the CCP output while driving the MOSFET Q2 to rapidly cycle the LED on and off. The modulation is made possible through the DSM module and the modulated output signal is fed to the COG. PWM3 provides pulse with variable duty cycle which controls the average current of the driver and in effect controls the brightness of the LED.

The LED dimming engine can not only accomplish what the typical LED driver controller does but it also has features that solve the typical problems that an LED driver poses. We’ll now walk through these problems and how a LED dimming engine can be used to avoid them.

Flickering

Flickering is one of the challenges that typical dimmable LED drivers may have. While flickering can be a fun effect when it’s intentional, when LEDs inadvertently flicker it can ruin the user’s desired lighting design. In order to avoid flickering and provide a smooth dimming experience, the driver should perform the dimming step from 100% light output all the way down to its low-end light level with a continuously fluid effect. Since the LED responds instantaneously to current changes and doesn’t have a dampening effect, the driver must have enough dimming steps so the eye does not perceive the changes. To meet this requirement, the LED dimming engine employs PWM3 for controlling the dimming of the LED. The PWM3 is a 16-bit resolution PWM that has 65536 steps from

100% to 0% duty cycle, ensuring a smooth lighting-level transition.

LED Color Temperature Shifting

The LED driver can also shift the LED’s color temperature. Such color change can be noticeable to the consumer and undermine claims made about the high-quality lighting experience of LEDs.  Figure 3 shows a typical PWM LED dimming waveform. When the LED is off, the LED current gradually declining due the slow discharge of the output capacitor. The color is changing with the current change so the gradual discharge of the output capacitor can lead to color temperature shifting and higher power dissipation of the LED.

Fig. 3: LED dimming waveform.

The ideal current should be rectangular just like the one shown in Figure 3. To achieve this, the slow discharging of the output should be eliminated. This can be done by using a load switch. For example, in Figure 2, the circuit used Q2 as a load switch and the LED dimming engine synchronously turns off the COG PWM output and Q2 in order to cut the path of the decaying current and allows the LED to turn off quickly.

Current Peaking

When using a power converter for driving the LED, a feedback circuit is usually employed to regulate the LED current. However, during dimming, the feedback circuit can create current peaking (see Figure 3) when the operation is not handled properly. Looking back at Figure 2, when the LED is on, a current is delivered to the LED and the voltage across RSENSE2 is fed to the EA. When the LED turns off, no current is delivered to the LED and RSENSE2 voltage becomes zero. During this dimming off-time, EA output increases to its maximum and overcharges the EA compensation network. When the modulated PWM turns on again, it takes several cycles before it recovers while high-peak current is driven to the LED. This current peaking scenario shortens the lifetime of the LED.

To avoid this problem, the LED dimming engine allows the PWM3 to be used as an override source of the OPA. When the PWM3 is low, the output of the EA is tristate which completely disconnects the compensation network from the feedback loop and holds the last point of the stable feedback as a charge stored in the compensation capacitor. When the  PWM3 is high and the LED turns on again, the compensator network reconnects and the EA output voltage immediately jumps to its previously stable state (before PWM3 is low) and restores the LED current set value almost instantly.

Complete Solution

As mentioned earlier, a LED dimming engine can operate with minimal to no CPU intervention. Therefore, since all work for controlling the LED driver is offloaded to the CIPs, the CPU has significant bandwidth to execute other important tasks.

In Figure 2 the microcontroller senses the input and output voltage. Out of these sensed voltages the LED driver employs protection features such as undervoltage lockout (UVLO), overvoltage lockout (OVLO) and output overvoltage protection (OOVP). Implementing this protection through software ensures that the LED driver is operating within desired specifications and the LED is protected from abnormal input and output conditions. The CPU can also process the thermal data from a sensor to implement a LED’s thermal management. Moreover, when setting the dimming level of the LED driver, the CPU can process triggers from a simple external switch or command from a serial communication. Also, the parameters of LED driver can be sent to external devices through the serial communication for monitoring or testing.

Aside from the features mentioned above, the designer has the luxury to add more intelligence on their own LED application inclusive of communications, like DALI or DMX, and control customizations.

Conclusion

An 8-bit microcontroller can be used to create an effective LED driver. Aside from providing efficient energy source, ensuring LED’s optimal performance, and maintaining the long life of LEDs, the microcontroller can add advanced features which make the lighting solution even more attractive.

Additional Resources:

Operational Amplified Module of 8-Bit PIC Microcontrollers

SEPIC LED Driver Demo Board for Automotive Applications

Mark Pallones is a Principal Engineer and Team Manager of the Applications Engineering Group MCU8 division in the Philippines for Microchip Technology Inc. He has authored and co-authored several application notes and technical articles and has been published on the Microchip website as well as technical publications across the world. He earned his post graduate degree in Electrical Engineering in Power Electronics at the University of the Philippines and his undergraduate degree in Electronics and Communications Engineering at New Era University.

Explore the Smart Manufacturing Revolution! Smart manufacturing is redefining your industry - and it's here to stay. Robots are becoming smarter and complex systems are connecting to provide unprecedented flexibility, insight, and efficiency on the factory floor. It's not a matter of if to adopt, it's when. And you can see it all in perspective at Pacific Design & Manufacturing, Feb. 7-9, 2017, at the Anaheim Convention Center. Register Today!

Sign up for the Design News Daily newsletter.

You May Also Like