Give away medical masks when you place an order. learn more
When lighting relied purely on incandescent bulbs and fluorescent tubes, there was very little a home owner could do to alter the feel and mood of the illumination in a living room or bedroom other than change the lampshades and invest in dimmer controls.
The arrival of LED lighting has opened up a new world of lighting control to the ambitious home user, one in which the feel of a room can be changed at the touch of a button or even react to external conditions, such as the homeowner’s arrival home, which appliances are being used in a room, or the sun setting outside.
LED technology makes possible much more flexible and attractive lighting in the home thanks to the ability to tune colors in the case of RGB or four-color LEDs. For example, the light can alter based on the time of day, gradually brightening and changing the color mix as the light fades outside, or it can change depending on what is happening inside a room. For example, light levels can increase close to a computer while it is being used, automatically dimming when the screen saver activates, and respond to the image displayed on a TV, darkening the room when people are watching the TV and even subtly altering the color mix based on the predominant color on the screen to provide more of a home-cinema experience.
Even for white light, designers can tune its quality, producing a blue-tinged light for users who want daylight simulation illumination or a warmer yellowish hue for those who want an effect similar to that of tungsten-filament lamps. Three-color LEDs make it possible to go much further, simulating the effects of sunset or matching the color picked up by a sensor or a color picker on a PC or tablet computer that is able to communicate with the lighting control system in the room. Networked control makes it possible to perform these changes remotely so that, when the user arrives home, the lights are set up the way they want.
There are a number of requirements for such a lighting-control installation, but a key component is a microcontroller (MCU) or digital signal processor (DSP) to provide intelligent control that is armed with the right peripherals to provide the necessary color control for each set of LEDs. A problem of dynamic control in LED lighting is that LED output is not uniform, particularly over temperature. As its diode junction heats up, the output light level generated by the LED falls and even the wavelength of light it generates can alter slightly. Good mechanical design is needed to maintain high color quality, but it is also often necessary to compensate for these effects in the control algorithm itself, using input from the temperature sensor to alter the output power of the other LEDs in the array. One option is to store the variation in output level versus temperature as a set of coordinates and use linear approximation to adjust power levels.
The LEDs themselves can vary in terms of color output. Manufacturers can choose to purchase ‘binned’ components that are known to work within a given range, which adds to cost, or use calibration and control algorithms to adjust how the LEDs are driven to compensate for variations. When the lighting fixture is assembled, bin codes applied by the LED manufacturer when they are made can be used to program the correct color-control curves into the MCU’s ROM.
Although a simple resistor can provide feedback on current consumption by the LED to the MCU, better control is maintained through the use of dedicated sensors. Temperature sensing is one way to control the output of the LED. A suitably equipped MCU can use a sensor connected to an A/D input to detect the temperature of the lighting elements and use a table lookup and linear approximation to adjust the light output.
An alternative is to use a light sensor to read light levels directly, which can provide finer-grained control. One option is to use a light-to-voltage sensor that is connected to an A/D port or, if analogue ports are scarce, to use comparator channels or a light-to-frequency sensor. Comparator channels can be used with a programmable voltage reference. By running a successive-approximation loop in code on the MCU it is possible to reprogram the voltage reference to converge on the incoming signal and so read its level. This technique can work well in systems where the changes in color and lighting level are comparatively slow.
The light-to-frequency sensor outputs a signal with a frequency that is proportional to the overall level of light. These pulses can be counted by the MCU, using a timer to determine the pulse frequency during a particular time window.
Typically, a proportional-integral-derivative (PID) control algorithm is used on each output channel to take the sensor data and calibration values, evaluate the difference between those and a target set point and adjust the output channels accordingly.
The PID loop runs continuously to reduce the error between the set point and sensor input. PID coefficients can be tuned to maximize the response of the system, but how quickly the PID algorithm can converge on the target is a function of the MCU’s speed. A highly responsive color-control system will generally demand a faster MCU to guarantee rapid convergence from the PID algorithm.
To drive the strings of LEDs themselves, the system designer has a number of options. One is to use high-resolution D/A converters to provide the required level of brightness to an external dimming-compatible power converter and LED driver. Another is to use pulse width modulation (PWM) to drive a power converter and LED driver directly using power from the mains. Alternatively, it is possible to use a DC power supply to the LED controller and lighting circuitry, with the MCU providing a constant-current supply to the LEDs in each string using external power transistors.
When used with an AC mains supply, high-frequency PWM is a particular requirement for LED control to reduce flicker – low-frequency pulses lead to long periods between bursts of power to the LED which cause it to lose brightness periodically to the degree that the change becomes detectable by the human eye.
With PWM, pulses of variable width are generated by the MCU. The longer the pulse, the more power delivered to the LED and, therefore, the higher its brightness. In a software implementation, a timer can be programmed to generate a regular interrupt or trigger signal on each cycle, the MCU then raises the output high and waits for a period determined by its control algorithm. This can be performed using a loop counter. Once the loop has counted down to zero, the PWM output is taken low and the MCU waits for the next cycle. The PWM signal feeds through to, typically, a power switch that turns on and off in response to the high and low signals, providing power to a string of LEDs of a particular color in the lighting element.
With a PWM update rate of 100 Hz or more to avoid flicker, the load on the MCU can be significant. MCUs that are used for LED control often use hardware-based PWM, which implements the timers and counter.
To use hardware PWM, the MCU program simply has to update the pulse timers and counters with the appropriate values based on the incoming sensor inputs. The timers and counters built into the hardware PWM generate the necessary control signals.
Figure 1: PWM in combination with PID control adjusts the duty cycle to track dynamic changes in light output.
The remaining consideration is that of communications. Protocols such as the Digitally Addressable Lighting Interface (DALI) and DMX512 were developed to control networks of lights, originally for entertainment systems. However, the command protocols are useful for home lighting as well as they provide the ability for a remote control to send commands on light levels and color to individually addressable light fixtures. The DALI and DMX512 protocols use the RS232 and RS485 serial communications interfaces, respectively, allowing easy implementation on a range of MCUs.
Wireless communication is now an option for home lighting, making it easier to install remote-controlled systems without using extra wires. The ZigBee protocol was developed primarily for home automation using the license-free industrial, scientific, and medical band centered on 2.4 GHz. ZigBee’s mesh network support allows a number of lighting nodes to communicate with each other and relay commands from a remote control and take in data from sensor nodes that are physically separate from the lighting elements themselves, providing information on the lighting levels across the entire room.
Alternatively, power line communications can be used to supply commands and data to lighting elements without requiring the user to add extra cabling.
There are a number of MCUs that have the interfaces and PWM peripherals to support color-controlled home lighting. One example is the Microchip PIC24FJ16GA002. This 16-bit PIC24 device has program memory up to 64 Kbyte and provides serial communication interfaces for use with DALI and DMX, a 10-bit A/D converter, and five PWM channels.
Another option based on a 16-bit architecture is the Renesas Electronics 78K0/Ix2, which offers up to nine 10-bit A/D inputs, a three-channel comparator, two 16-bit PWM timers ? each with two channels, as well as a DALI-capable serial port.
Figure 2: Two options for controlling three-color LED systems, using A/D converters or comparators on the Renesas 78K0/Ix2.
Using a 32-bit core, the Atmel AVR UC3 provides high-performance floating-point processing for accurate PID loop control as well as hardware support for PWM. Members of the family include A/D converters with resolution up to 12 bits and serial ports for connection to DALI, DMX512 or a wireless or power line transceiver.
There are also single-chip MCUs that can provide on-chip ZigBee, such as the Atmel ATmega128RFA1. This device is supported by a ZigBee evaluation board. In many cases, a serial port can be used to communicate with an off-chip power line or ZigBee-compatible transceiver.
DSPs are available that provide the performance for high-performance color control. An example is the Texas Instruments Piccolo C200. The company has developed an evaluation board based around the C200 that was specifically designed for prototyping lighting-control systems. The board and support code offers DALI and DMX512 compatibility as well as the possibility to use power line communications using a separate daughterboard.
Similarly, the Freescale Semiconductor MC56F8006 is a digital signal controller (DSC) that includes two 12-bit A/D converters and hardware support for PWM.
Thanks to all these offerings, the LED lighting designer has a number of high-integration MCU and DSP offerings to consider when implementing advanced color-control systems for home lighting.
This article has provided an overview of techniques for implementing color-controlled LED lighting for home systems and MCUs and DSPs that provide support for these systems. The devices discussed include products from Atmel, Freescale Semiconductor, Microchip Technology, Renesas Electronics, and Texas Instruments.