AN3151
Application note
Digital constant-current controller for
LED applications based on STM8S208X
Introduction
LEDs have been used for many years simply as status indicators but are now playing a
considerable role in a host of application fields, even with high power requirements, due to
improvements in lighting efficiency, longer lifetime, reliability, and costs. LED-based lighting
systems are increasingly used in display panels, emergency lighting, architectural lighting
and also backlighting.
The growth of such systems is mainly due to new manufacturing technologies and
innovations in this segment area, which probably represent the most important markets
within the lighting field.
The intent of this application note is to describe a new technique, based on a digital
approach, performing a real average current-control on an LED streetlighting platform.
A demonstration board, based on this approach, is orderable with the STEVAL-ILL031V1
code.
Further details are shown in STEVAL-ILL031V1 documentation.
The LED streetlight platform has been developed on a DC-DC converter based on an
“inverse buck” converter, creating advantages in terms of power switch control and
conditioning signal circuitry for the current sensing.
Moreover, performance, including cost performance, is also looked at.
This solution has been customized for a streetlighting application but can be extended to
many other fields.
The advantages offered are in terms of low energy consumption, low maintenance, and a
small and lightweight design.
The real aim of this application note is to describe the average current-control methodology
suitable for LED driving.
The effectiveness of the control with the inverse buck's advantages is described on a
dimmable platform, based on a multi-string system up to 120 W with independent current
control. Two different kinds of dimming have been implemented: analog, also called linear
dimming, and digital.
The control has been implemented on the STM8S208RB microcontroller, [1] which is the
best compromise in terms of cost and performance, validating an innovative current reading
methodology.
August 2010
Doc ID 17051 Rev 1
1/34
www.st.com
Contents
AN3151
Contents
1
Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1
1.2
Power stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Control stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2
Microcontroller peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1
2.2
TIMER1: advanced control timer (TIM1) . . . . . . . . . . . . . . . . . . . . . . . . . . 8
AD converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3
Overview of inverse buck converter . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1
Average current reading methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4
5
Independent current control for a multi-string system . . . . . . . . . . . . 14
Firmware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.1
5.2
5.3
Basic initialization of peripherals and I/O pins . . . . . . . . . . . . . . . . . . . . . 17
Peripheral settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
PI regulator overview and firmware implementation . . . . . . . . . . . . . . . . 19
6
7
8
9
10
11
Board description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Experimental results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Short-circuit protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Bill of material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2/34
Doc ID 17051 Rev 1
AN3151
List of figures
List of figures
Figure 1.
Figure 2.
Figure 3.
Figure 4.
Figure 5.
Figure 6.
Figure 7.
Figure 8.
Figure 9.
Figure 10.
Figure 11.
Figure 12.
Figure 13.
Figure 14.
Figure 15.
Figure 16.
Figure 17.
Figure 18.
Figure 19.
Figure 20.
Figure 21.
Figure 22.
Principle schematic of the circuit described . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Power stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Control stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
TIM1 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
TIM1 and ADC triggering functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Inverse buck converter (single-string). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Counter(a), PWM(b) and ILED(c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Multi string current control methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Basic flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Current control flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
PI standard controller with anti-saturation control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
LED street light platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
ILED on 3 strings (green, blue and violet waveforms); PWM @100 kHz (yellow
waveform) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ILED on 3 strings (green, blue and violet waveforms); voltage across the sense resistor
(yellow waveform) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ILED on 3 strings (green, violet and blue waveforms) @ 60% of duty cycle (PWM
dimming) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
ILED on string (violet waveform) @ minimum PWM dimming; PWM (yellow waveform) . . 25
MOSFET turn-on zoom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
MOSFET turn-off zoom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Overall efficiency (4 channels) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Short-circuit protection circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Short-circuit event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Electro-optical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Doc ID 17051 Rev 1
3/34
Hardware
AN3151
1
Hardware
The hardware is mainly composed of the power conversion section and the control stage,
based on the microcontroller unit.
From a common DC voltage input the 4 strings are driven by 4 inverse DC-DC buck
converters.
The inverse buck converter offers advantages not only in the driving section and the ground
referred circuitry but also in terms of cost.
All these aspects are explained in detail in the power stage.
The principle schematic of the circuit described in this application note is shown in
Figure 1.
Figure 1.
Principle schematic of the circuit described
4/34
Doc ID 17051 Rev 1
AN3151
Hardware
1.1
Power stage
Figure 2
shows the schematic of the power stage with 4 output channels:
Figure 2.
Power stage
Doc ID 17051 Rev 1
5/34