This application note deals with the general principles of LED dimming. This note also
focuses on the use of pulse width modulation (PWM) for digital dimming. Its implementation
on the STM32
described in detail and the most common design approaches are compared.
The conclusion helps developers choose the best approach for their LED dimming
application.
™
microcontroller in combination with the STP24DP05 LED driver is
Analog: Uses a linear device to set the current flow through the LED.
Advantages: Absence of digital noise; a simple implementation.
Limitations: Color shift, low dynamics.
●
Digital: Uses a switch to set nominal or zero current flow through the LED.
Advantages: Accurate and fast color control.
Limitations: The presence of digital noise and necessity to use a frequency high
enough to prevent flickering; a complex implementation.
This document focuses on digital dimming and the use of PWM (pulse width modulation) in
common applications.
When using PWM for lighting applications, the following rules must be kept in mind:
●
For the LED light to be seen as non-flickering by the human eye, in most cases the
PWM frequency must be higher than 100 Hz.
●
The LED light brightness depends on the PWM duty cycle. The brightness depends on
the resolution of the PWM duty cycle.
Figure 1.PWM signal with 16 steps of possible voltage values
Step: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
T
PWM
0 1 ...
AM00341
Using a 4-bit PWM resolution, there can be 16 different light intensity (energy) values.
Concerning color applications, 16 million (256 × 256 × 256) colors can be reached using
tricolor LEDs with an 8-bit dimming resolution for each single color LED.
5/31
Description of LED dimmingAN2841
2.1 Driving multiple LED applications
Displays, indicators and panels increasingly use more and more LEDs. There are three
approaches for driving higher numbers of LEDs:
1.Dedicated pin
Each LED is driven by dedicated system (microcontroller, FPGA) pin.
Advantages: Simple implementation of dimming algorithm. No conversion.
Disadvantages: Unusable for high LED counts. Consumes pins of microcontroller.
2. Serial-parallel conversion
Multiple LEDs are driven by a single system pin.
Advantages: Reduced number of system pins required. High LED count systems can
be developed.
Disadvantages: Additional components and external buffers are needed. The data rate
on a single pin must be n times greater than that for the single LED out of n, where n is
the number of LEDs.
3. Matrix
LEDs are arranged in a square matrix and driven by a complex and sophisticated
algorithm that combines serial-parallel conversion with additional decomposition of the
serial data stream into the rows and columns by another active component.
This document focuses on serial-parallel conversion applications.
2.2 Multi-channel dimming using serial-parallel conversion
The serial-parallel conversion approach is in fact a parallel-serial-parallel conversion since
the data is stored in the system memory in parallel format and then is converted to serial
format before its transfer over the serial interface. The serial stream is then reconverted to
parallel format by the LED driver used to drive each LED. The serial data transfer speed
must be n times faster than driving a single LED, where n is the number of parallel driver
outputs.
Buffers (LED drivers) used for serial-parallel conversion come generally with the four most
important signals:
■
SDI: Serial data in
■
SDO: Serial data out
■
CLK: Clock signal used for loading data in the driver buffer via the SDI (input) and
sending data from the buffer via the SDO (output). It also shifts all data actually
present (previously loaded) in the driver.
■
LE:Copies (latch enable) the actual values loaded in the driver into its output cells.
The output cells drive parallel outputs.
The standard serial peripheral interface (SPI) contains SDO, SDI and CLK signals.
It is necessary to latch (LE signal pulse) internal driver data once per n CLK cycles, where
n is the total LED count. This latching rule ensures the correct mapping of the serialized
PWM data coming on SDI to the corresponding parallel output. Refer to Figure 2, Figure 3
and Figure 4.
6/31
AN2841Description of LED dimming
Figure 2.PWM serial-parallel conversion for multiple LED applications
Figure 3.Example of a specific lighting setting
T
PWM
SERIAL DATA
T
SEND_DATA
PARALLEL DATA
1101 0101 00010000
1111
LEVELS
1111 or new
data
t
Output 1 - ( L E D 1 )
Output 2 - ( L E D 2 )
Output 3 - ( L E D 3 )
Output 4 - ( L E D 4 )
4% duty cycle
14% duty cycle
3% duty cycle
99% duty cycle
t
t
t
t
AM00343
The following equation is used to determine how many LEDs can used in an application with
specific maximum SPI speed and PWM resolution requirements:
Equation 1
f
N
SPI
=
n
f
2
PWM
where;
N is the maximum number of LEDs
f
is the SPI communication speed
SPI
n is the PWM resolution
f
is the dimming frequency
PWM
7/31
Description of LED dimmingAN2841
The outcome of Equation 1 is valid only for the best-case scenario when the data are sent
to the LED driver without any delay between blocks of data. This example, of course, is not
a real one. The values for a real application can only get close to the value determined
above.
2.3 Specific dimming application using an STP24DP05
Figure 4 illustrates a simple dimming application using an STP24DP05 24-bit constant
current LED sink driver with output error detection.
Figure 4.Simplified setup of an application using an STP24DP05
5 V
3.3 V
LED block
Temperature
sensor
RGB LED configuration
Driving
system
R1...8 G1...8 B1...8
SPI
OE-R/G/B
STP24DP05
STP24DP05
SPI
LE
More drivers in cascade…
AM00344
8/31
AN2841Dimming application using an STM32 microcontroller
3 Dimming application using an STM32 microcontroller
This section describes a dimming application that uses an STM32 microcontroller (MCU).
All the computations, results and tests were performed on an evaluation board (reference:
STEVAL-ILL015V1) containing an STM32 MCU running at a clock frequency of 48 MHz.
For more information about the use of this evaluation board and dimming applications,
please refer to user manuals UM0588 and UM0574 listed in Section 5: References
documents.
Figure 5 and Figure 6 provide a brief overview of the STM32 evaluation board.
Figure 5.STM32 evaluation board setup
Figure 6.STM32 evaluation board block diagram
USBSPI
ESD for USB
USBUF01P6
Power supply
ST1S10
STM32
3.1 Data transfers and timing
This section describes the two approaches used to transfer data (dynamic and static) as
well as timing considerations.
3.1.1 Dynamic data transfer
When using a dynamic data approach, all data is computed just before being transfered to
the LED drivers.
LED driver
STP24DP05
SPI
LED driver
STP24DP05
SPI
AM00345
9/31
Dimming application using an STM32 microcontrollerAN2841
The LED brightness value is defined by the user in the LEDmap array. The LEDmap is an
array of 8-bit numbers (when using an 8-bit dimming resolution). Each value is dedicated
to one single LED (Figure 7).
The dimming algorithm converts the LEDmap array into a serial stream. The serial stream
in combination with the LE signal generates requested PWM outputs on the LED drivers
as shown in Figure 8.
Figure 7.Computation of LEDdriverDATAbuffer variable
Begin
depth = 0
DATAchar = 0
Detail in Figure 8:
LEDmapLEDdriverDATAbuffer
DATAchar++
–
–
DATAchar>3
+
depth++
depth>255
0 .. 255 for 8-bit PWM resolution
0 .. LEDcount / 8
SPI
Driver
LED
+
10/31
AM00346
Loading...
+ 21 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.