Efficient Smart Lighting with PWM Control
Contributed By Digi-Key's European Editors
The light emitting diode (LED) has quickly become the favored choice for many illumination applications. Improvements to efficiency and brightness made by LED manufacturers mean there are few other equivalent choices for applications ranging from automotive headlamps to warehouse and factory lighting. An important advantage of the LED over other options is its controllability, though this does require the use of electronic circuitry to take full advantage of the technology and not introduce problems such as flicker or overheating.
Not only is the efficient control of LEDs a necessity, lighting systems need to be able to automatically respond to changes in conditions such as ambient light, and to changes in requirements that may be signaled over a network connection.
Sensors close to the lighting assembly can determine the most appropriate level of artificial illumination to avoid situations where power is wasted. In applications such as smart greenhouses, high-bay illumination and street lighting, LEDs can be turned off completely while ambient conditions are favorable, and be gradually brought online as darkness increases. At the same time, darker areas such as the corners of warehouses that are far from windows can be kept safely and productively lit.
In principle, the luminance provided by an LED is easy to control. The light output of an LED is an approximately linear function of forward current. To provide consistent lighting, the LED requires a constant drive current. The amount of current required depends not just on the LED, but also on environmental factors. Typically, the brightness-versus-current curve increases. However, an increase in current causes the LED junction temperature to increase. Excessive junction temperature results in a reduction in light output, and a reduction in overall efficiency.
The current supplied to an LED is not always maintained at a constant level. Instead, high frequency switching is used to deliver pulses of current that average out to a near constant level. Most LED lighting designs employ pulse-width modulation (PWM) to provide current control.
A common configuration for PWM-based LED power control at a target brightness level is to compute a fixed off time. The circuitry then varies the time during which power is applied to suit conditions based on current measurements. The advantage of the fixed off time approach is that the ripple current and the average current level depend only on the off time and the LED forward voltage. With a fixed off time, the forward voltage depends on the temperature and number of LEDs in the string.
Software algorithms can compensate for these effects by implementing adaptive voltage compensation. The algorithm monitors the voltage drop across the LEDs and makes adjustments to the off time length. The average LED current is then controlled by regulating the peak current supplied, which is measured while the MOSFET supplying power to the LED string is switched on.
The STLUX line of lighting controllers from STMicroelectronics provides the means to drive as many as six LED strings independently using fixed off time control with the aid of a modified buck topology power converter. The heart of the control strategy employed in the STLUX line of lighting controllers is the state machine, event driven (SMED) technology. This lets the controller operate a number of strings of LEDs, each with their own PWM generator and the ability to react to external and internal events independently without software intervention.
A built-in microcontroller configures and programs the SMED units, as shown in Figure 1. The microcontroller is based on the ST8 microarchitecture, which is based on a CISC design for high code density and provides optimizations for low power consumption.
Figure 1: The relationship between the SMED units and the supervisor core and I/O.
Each of the six SMEDs in the STLUX switches between four states, with the addition of a Hold state for circumstances where the PWM clock needs to be frozen until an exit condition is satisfied. One application for this is in dimming. The SMED enters the Hold state when supervisory control decides to start the off state of a dimming duty cycle. When the off state timer reaches its limit, the SMED is switched back to normal operation for regular, precise PWM voltage control.
Motion can be between any of the four states, as shown in Figure 2. Conditions programmed into the SMED control when and how the state machine shifts to its new target state, and SMEDs can be linked to build more complex state machines where fully independent control of each string is not required.
Figure 2: Possible state transitions of SMED units.
Using an operating frequency of 96 MHz, the PWM’s maximum resolution is 1.3 ns. The SMED architecture lets the controller react to events within 10 ns.
To support a fixed off time configuration, the basic SMED provides enough states to handle the core PWM cycle as well as fault response and recovery. After initialization, the SMED switches to S0, which is used primarily to control the off time. While in this state, the output PWM line is set to 0 V. A timer is used to determine the exit time from S0. To support dimming, S0 can move to the Hold state to keep the output at 0 V. If dimming control is not required, the state moves to S1.
S1 acts as a current ramp and fault detection state. The PWM output line is set to high during the shift to S1. This turns the output power MOSFET on and allows current to flow into the LEDs and sense resistor. Under normal conditions, the current should not reach a peak safe limit during the time in which the SMED is in S1. In the fixed off time algorithm, S1 is generally programmed to exit after a third of the on time of the PWM cycle has elapsed: the remainder of the on time is handled during S2. However, if the current limit is reached unusually early, which should not occur under normal conditions, this signals an error, which forces the SMED to enter S3.
S2 is the current limit state and is used to find the peak current level under normal conditions. The current peak is determined by the voltage configured on the STLUX’s DAC. When the current peak arrives, the SMED cycles back to the S0 state and the PWM output switches back to 0 V for the beginning of the next fixed off time cycle.
S3 acts as the overcurrent state. During the transition, the PWM output is switched off to protect downstream circuitry and the timer set to its maximum value of 5 µs. When the timer expires, the SMED advances to S0 for a new cycle, but also generates an interrupt to the internal MCU so that software can monitor future cycles, stop SMED transitions if necessary, and generate a user alarm.
The current peak level is detected by a comparator that feeds into the SMED. This comparator receives the current input sense signal and compares it to the internal DAC value. When the voltage on the comparator pin is higher than the DAC value, the output of the comparator’s output pin goes high. At other times, the output remains low.
Dimming can be handled using a second layer of PWM control. However, the cycle can be handled using software as it involves a significantly slower control loop than that required for the current management PWM algorithm. To minimize noticeable flicker, a switching rate of 200 Hz is sufficient, dividing each second into 5 ms periods. The amount of time that the PWM cycle is allowed to run within each slot determines the overall level of brightness of the LED string.
With independent LED strings, the dimming cycles can be offset in phase. This helps balance power consumption and further helps minimize the apparent flicker of the overall lighting array. With such phase shifting, the LED strings are switched on and off at different times. To drive the dimming control, the STMR internal timer can be used to generate interrupts at regular intervals. The algorithm works through its list of LED strings, calculating desired brightness, activating or deactivating SMED units, followed by setting the timer to wait for the next dimming event. At very low duty cycles, the internal MCU core may be put to sleep using the WFI instruction. This stops the core from running until an interrupt is received.
Although the lighting unit may be designed to operate in a standalone manner, the benefits of smart lighting come with support for remote or networked control. A network of lighting ballasts and controllers allows high flexibility. For example, the controllers can easily be reprogrammed to separate lighting ballasts into different groups as partitions are changed in an office or warehouse environment.
A widely accepted international standard for controlling lighting systems is the Digital Addressable Lighting Interface (DALI). Key advantages of DALI include a simple wiring topology, and the ability to address lighting units individually or as part of a group. As a result, DALI fits a niche between older 1 - 10 volt analog interfaces and complex network-based lighting control systems. The use of DALI does not preclude integration into a network. However, large-scale systems will often be architected by bringing luminaires together in DALI-linked groups that are interconnected at the macro scale by IoT networks such as 6LowPAN, Ethernet or Thread.
Typically, a DALI group will include a DALI control unit that is linked to a local control panel and a variety of sensors able to detect presence and ambient light levels. The DALI control unit then communicates with the building management systems using an IoT-type protocol. DALI units can be connected using a star or serial topology. The serial topology has advantages in systems that need to cover long linear distances such as street lighting, as well as installations such as warehouses. In the serial connection scheme, each DALI unit is connected by serial links to its nearest neighbors. Commands are passed along the serial bus so that each of the DALI units can be addressed by a broadcast command.
The maximum cable length is governed by the voltage drop along its length, which is defined in the standard as a maximum of 2 volts. For a cable with a cross-section of 1.5 mm2, this corresponds to approximately 300 m. DALI control cables can run alongside mains power cables as the scheme is not classified as separated extra low voltage (SELV).
The DALI protocol controls illumination in 254 steps from off to maximum. The lighting units are expected to follow a logarithmic brightness curve. To support gradual changes in lighting level, the protocol lets the controller set fade times in seconds. The controller can then issue commands to have the individual ballasts increase or decrease illumination in steps until the set point is reached. To support easier maintenance, the ballasts can report problems such as missing lamps to the controller using status messages.
In a light harvesting scenario, the controller may take full control of illumination using its own sensors to determine the optimum light levels for each ballast, operated in this case by STLUX-based modules sending appropriate step-up or step-down commands. Alternatively, the MCU inside the STLUX could be given greater autonomy. In this scenario, the DALI commands set an optimum illumination level, but the local STLUX controllers use locally attached ambient light sensors to determine the required dimming level. A simple closed-loop control algorithm can tune the dimming level to the sensed light levels picked up by the local sensors.
As the eight ADC and four comparator channels may be used for voltage and current measurement by the SMED units, the sensor may be attached using the STLUX’s built-in I2C interface. Ambient light sensors with I2C interfaces include the OPT3001 from Texas Instruments and the VML6030 from Vishay Semiconductor.
Other sensors may be attached to the I2C interface or used by the controller to determine when to send DALI commands to support more advanced control strategies. For example, in street or parking bay lighting networks, motion sensors can be used to increase illumination as cars or people pass by before settling down to a minimal inactivity setting.
Thanks to the combination of support for network-based control, the ability to attach sensors and use advanced state machine strategies to manage LED output, the STLUX range of devices provides a highly suitable basis for advanced illumination systems.
Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.