Expectations are high; once persuaded, and subsequently compelled by legislation, to abandon incandescent lamps in favor of more efficient products, users' experience with compact fluorescent lamps has often been unsatisfactory. Now, the message to these consumers is that LEDs will provide a longer lifespan, durability, and efficiency, along with pleasing spectral characteristics.


General lighting – the provision of ambient lighting for homes, offices, and public spaces – is, in fact, somewhat lagging behind the pace of LED adoption across a wide range of applications. Examples include automotive lighting for brake lights, position lights, and, soon to be introduced, headlights; color lighting for architecture; industrial, outdoor, and street lighting; traffic and railway signals; and backlighting for LCD screens in televisions and monitors. In some of these applications, efficiency is paramount, by far the most compelling reason for adopting LED technology. In other applications, the primary motivation lies in the flexibility it offers designers to adjust lighting when they are not required to provide access for replacing lamps with a limited lifespan. In still other cases, it may be the degree of control over the light, in terms of both tone and intensity, that appeals to lighting engineers.


Just as CCFLs changed the concept of a light source, evolving from a device simply plugged into a power supply to one requiring its own control electronics, the advent of LEDs necessitates the addition of a driver and, in many cases, control circuitry. LEDs require constant current control. While a linear voltage regulator configured as a constant current source may be acceptable for low-current applications, any design requiring high light output and efficiency demands a switched-mode power supply. A variety of commonly used power supply topologies are useful for controlling LEDs, including buck, boost, charge pump, SEPIC, buck-boost, and flyback, each offering its own advantages in different circuit configurations. Many suppliers, such as Microchip Technology, offer dedicated driver ICs: a microcontroller can add intelligence to an application when combined with a driver IC, or the microcontroller can integrate the LED driver function, generating the timing and control waveforms.

 

LED LIGHTING 1pIn an application like architectural lighting, the contribution of a microcontroller for precise level adjustments to control LEDs of different colors is obvious. Perhaps less obvious is the challenge of managing white light generation, where a microcontroller not only adds intelligence but is fundamental.
Single-source white LEDs are, in fact, blue light emitters in which some of the blue emitters are used to power a mixture of phosphors that emit light in a color range between red and green to achieve white light. Some white LEDs cannot achieve a high Color Rendering Index (CRI), which measures the light source's ability to accurately reproduce all colors. Systems with better white light quality can be obtained by mixing the light from two or more colored LEDs. The light generated by each color source experiences drift with aging and temperature. This can be corrected in the total light generated – a specific color or the Correlated Color Temperature, CCT – which is kept constant by a feedback loop using a light sensor and a small microcontroller.


The market offers a variety of small, inexpensive light sensors. These typically include selectable color filters—red, green, blue, or none (white)—and a light level sensor. The light sensor can supply intensity level data to the microcontroller in several ways. Voltage-to-voltage light sensors send voltage levels to an analog-to-digital converter (ADC). Frequency-to-frequency light sensors provide a variable frequency output, where the frequency is proportional to the amount of light. The pulse output from these sensors can be accumulated in a microcontroller's timer to determine the light level. Digital-to-digital light sensors usually incorporate a serial digital interface, such as I2C™. Each type of sensor interface offers unique advantages and requires different microcontroller resources (Figure 1).
In a complete closed-loop color control system, the microcontroller must read the color components from the light sensor, calibrate the light sensor's output, and adjust the output of the individual LED drivers to achieve the desired color. The choice of driver technique will depend on factors such as efficiency requirements, input voltage range, and the number of LEDs used.


Several methods can be used to control the driver output. The microcontroller can generate an analog reference voltage using a digital-to-analog converter (DAC) or a digital potentiometer, and this voltage will directly set the current to the LED driver. Alternatively, in a fully digital control chain, the microcontroller can provide pulse-width modulation (PWM) signals that are used to modulate the driver output. The PWM signal can be used to turn the driver on or off, or to control a switch that disconnects the LEDs from the driver output. If PWM control is used, a PWM frequency is chosen that is high enough that the human eye cannot detect any fluctuations. This technique can be practical if the application demands maximum efficiency, as many LEDs deliver their maximum efficiency (light output for a given current) at or near their peak value. Providing reduced light levels by pulsed control at the peak current level will be more efficient than using a constant, reduced current.

 

LED2p LightingThe designer must decide on the level of control resolution needed in a color control system in order to select a microcontroller with the appropriate peripherals. For a Light-to-Voltage sensor, the measurement resolution of the integrated A/D converter will be important. A Light-to-Frequency sensor requires a microcontroller timebase that can be incremented using an external clock. Light-to-Digital sensors will need the appropriate serial communication interface peripheral.
A microcontroller with multiple PWM peripherals is useful for controlling individual LED drivers. In high-resolution color control systems, a PWM peripheral with 16-bit color resolution or higher is preferred. Serial communication peripherals, such as UART, SPI, I2C™, LIN, and USB, enable input/output control and display functionality.


The designer must also determine the sampling rate at which the control loop operates and choose a microcontroller with the appropriate computing resources. If the system is primarily dedicated to maintaining a constant white output as the LED ages, then a relatively low sampling rate is required. LEDs of different colors will generally follow different light output curves with age, but they will also respond differently to varying levels of control. In variable brightness or dimming applications, the color control loop must be updated to synchronize with the rate at which the brightness varies. One of the most demanding applications of this type is selective backlight dimming in LCDs. To improve contrast in the dark areas of a television image, the backlight is dimmed in those areas, but a pure white must be maintained so that the LCD screen can continue to display the correct image tone. In this case, an appropriate update of the control loop for the TV frame rate is required.


A device like the PIC24FJ16GA002, Figure 2, is a good candidate for a microcontroller in a color control system. The PIC24 is available in a small 28-pin package with 16 to 64KB of program memory, and provides serial communication interfaces, a 10-bit A/D converter, and 5 PWM channels, all in one device. The 16-bit microcontroller core easily handles the mathematics associated with sensor calibration and color control.


The light sensor's data output must be calibrated against a reference to provide reliable results. The calibration process uses a Chromaticity Meter to mathematically correlate the output of different colored LEDs with the spectral response and sensitivity of the light sensor according to a standard coordinated color system established in 1931 by the CIE (International Commission on Illumination): the CIE XYZ color space. The calibration process generates a matrix of coefficients that must be stored in non-volatile memory with the luminaire system and will be used to determine the difference between the correlated and desired output at each step through the control system.


Once calibrated, the microcontroller compares the sensor data against the desired coordinates on the CIE chromaticity graph and adjusts the control values ​​on each output channel until the correct CCT is achieved. Since the control loop operates in a dynamic environment, servo-like techniques are appropriate; each channel has a PID (proportional-integral-derivative) algorithm that matches the sensor data to the calibration values, evaluates the difference to establish a setpoint, and adjusts the output channels accordingly. As with any closed-loop PID architecture, the algorithm continuously works to reduce the error until the output CCT reaches the setpoint. The PID coefficients can be adjusted to maximize the system's response, but the convergence factor to the setpoint depends on the microcontroller's efficiency in the mathematical process. As noted earlier, some color control systems will require faster processing and response times than others.


Systems requiring an adjustable light source or one with a high CRI (color rendering index, or color accuracy) can have a long list of user control requirements. A medical device with a graphic LCD display needs adjustable LED backlighting, which requires a microcontroller to communicate with the LCD via SPI, as well as a touchscreen interface to adjust the CCT and brightness. General lighting for a shop window might need control from a central panel or computer to automatically adjust brightness, CCT, and on/off status based on the time of day. Communication between these devices can be achieved using wired serial bus protocols common in the lighting industry, such as DALI (Digital Addressable Lighting Interface, IEC 929) or DMX512 (a common standard in stage and theatrical lighting systems). Others might use a custom interface over USB or Ethernet. When modernizing lighting systems in existing buildings, lighting designers are replacing wired interconnection infrastructures with wireless communications and adopting protocols like ZigBee® for control. A microcontroller with flexible peripherals is the ideal device for communication and user interfaces in these types of lighting applications.
LEDs as general lighting sources are poised to have a significant impact on our lives, offering energy efficiency, compact size, portability, durability, and long lifespan. Multi-color LEDs, controlled by a small microcontroller, will adjust the generated light, thus providing a pleasant light that suits the space being illuminated. The microcontroller intelligently governs the driver circuitry, maximizing effectiveness, monitoring status, and maximizing energy efficiency and operational life.

References
- Microchip Application Note AN1257, “Closed Loop Chromaticity Control: Interfacing a Digital RGB Color Sensor to a PIC24 MCU.” The application note itself, as well as further information on Microcontroller Peripherals for LED Color-Control Systems (“MCU Peripherals useful for LED Color-Control Systems”), can be found under the heading “Color Control Solutions” in Microchip’s online Intelligent Lighting Design Center, http://www.microchip.com/lighting.

Author:

Microchip Technology

More information or a quote