TB3108

TB3108
TRIAC Dimmable LED Driver Using PIC12HV752
WARNING
we
This symbol indicates that building or using the system described in this
document will expose you to electric shock.
Only persons experienced in electrical manufacture should use this document to complete the system
. FAILURE TO FOLLOW PROPER SAFETY PRECAUTIONS COULD RESULT IN PERMANENT
.
described
INJURY OR DEATH DUE TO ELECTRIC SHOCK HAZARDS. To avoid risk of injury from electric shock, do not,
build, or use, the system described in this document without implementing proper safety measures.
Microchip Technology Inc. makes no representation that the system shown in this document meets any standards that
govern the performance, consumer safety, or electrical interference characteristics of the system described herein. We
recommend that you contact the applicable governing body for your geography to determine the standards to which you
should manufacture your system.
Authors:
Kristine Angelica Sumague
Mark Pallones
Microchip Technology Inc.
INTRODUCTION
This technical brief describes a LED driver solution that
is compatible with a traditional TRIAC dimmer.
Microchip’s PIC12HV752 microcontroller manages the
whole circuit solution with a minimal firmware code.
The PIC12HV752 is a low-cost 8-pin chip with on-chip
core independent peripherals that are suitable for
power conversion applications. These peripherals are
the Complementary Output waveform Generator
(COG) and the Hardware Limit Timer (HLT). Other
peripherals include I/O ports, a Fixed Voltage
Reference (FVR), Comparators, a Digital-to-Analog
Converter (DAC), Timers, a Capture/Compare/PWM
(CCP) and an Analog-to-Digital Converter (ADC).
The solution described in this technical brief has the
following specifications:
•
•
•
•
TRIAC Dimmable
Active 0.95 Power Factor Correction (PFC)
90-240 VAC Input
20 VDC/325 mA max. output
 2014 Microchip Technology Inc.
HIGH PF FLYBACK CONVERTER
The design solution which will be discussed in this
technical brief uses a high Power Factor (PF) flyback
converter operating in Critical Conduction Mode
(boundary between continuous and discontinuous
Inductor Current mode). This topology is basically a
conventional flyback, except that it does not have a
bulk capacitor after the full-bridge rectifier. The
absence of the bulk capacitor allows the rectified
sinusoid to be used as input of the converter rather
than a fixed DC voltage.
What makes this topology an attractive solution for a
TRIAC Dimmable application is its inherent Power
Factor Correction (PFC). The incandescent lamp
works well with a TRIAC dimmer because it is purely
resistive. Therefore, in order to design a LED driver
compatible with TRIAC dimmer, the input
characteristics of the LED driver should be resistive,
too. PFC can make the LED driver look like a pure
resistor from the AC input side by making the input line
current in-phase with the input line voltage.
Aside from the high PF, there are other advantages this
topology can offer. The advantages can be
summarized as follows:
• Isolation between the AC mains and the converter
output (this is desirable for safety requirements)
• Minimizes the needs of heat sinks. Critical
Conduction Mode (CrCM) ensures low switching
losses of the MOSFET
• High PF reduces dissipation in the bridge rectifier
DS90003108A-page 1
TB3108
• Low part count helps reduce cost and meets small
form factor
• A small size cheaper film capacitor replaces the
bulky and costly high-voltage electrolytic capacitor
after the full-bridge rectifier
THEORY OF OPERATION
Figure 1 shows the simplified circuit of a TRIAC
Dimmable High PF Flyback LED Driver. The
PIC12HV752 microcontroller controls the circuit at the
primary side, using on-chip core independent
peripherals. The COG peripheral provides a PulseWidth Modulated (PWM) signal which drives the input
of the MCP1416 MOSFET driver to turn-on/turn-off the
FIGURE 1:
MOSFET (Q1). The rising edge of the PWM is
controlled by the HLT or the C1 comparator, while the
falling edge is controlled by the C2 comparator. The
input of C1 is derived from the voltage of the auxiliary
winding of transformer T1, which is compared with VSS
to detect the zero crossing of the auxiliary winding
voltage (VAUX). The input of C2 is voltage across the
RSENSE resistor, which is compared to the DAC output.
The DAC output depends on its VREF, which is
connected to the input wave shape signal, derived from
the rectified input signal through a simple voltage
divider.
TRIAC DIMMABLE LED DRIVER SIMPLIFIED SCHEMATIC
The key advantage of the primary side control is the
implementation of the PFC function, which is achieved
through the feed forward method along with Peak
Current mode control.
The details of circuit operation from start-up to steady
state condition will be discussed in the next sections.
To simplify the discussion, the following assumptions
will be made:
• The line voltage is perfectly sinusoidal
• All components are ideal
• Zero-current detection delay is negligible
DS90003108A-page 2
Start-up Operation
When applying the AC input voltage, the base voltage
of transistor Q4 in the bootstrap circuit shown in
Figure 2 is increasing. When there is enough base
voltage, Q4 turns on and diode (D14) is forward biased.
The voltage across the base of Q4 is held up to 10V by
Zener diode D13. When Q4 turns on, the collector
current flows through RC and D14 to increase the VDD
of the PIC12HV752. When VDD is high enough (usually
the minimum VDD of the microcontroller) HLT, COG,
DAC, ADC and comparators are initialized. After
initialization, the HLT emits a pulse at 58 kHz to turn on
Q1 initially. This will energize the primary inductance of
T1 and transfer the magnetizing current to produce
 2014 Microchip Technology Inc.
TB3108
VAUX when Q1 turns off. Once the rectified VAUX has
reached 10 Volts, the forward voltage of D14 drops
below 0.7 Volts. This allows D14 not to conduct and Q4
to turn off. Once Q4 is off, VDD is supplied by VAUX. It is
important that Q4 always be off during normal circuit
operation to avoid power dissipation on Q4. Q4
remains off as long as there is enough VAUX. The
operation of the bootstrap circuit is depicted through
the waveform shown in Figure 3.
FIGURE 2:
BOOTSTRAP CIRCUIT
FIGURE 3:
BOOTSTRAP WAVEFORM
 2014 Microchip Technology Inc.
DS90003108A-page 3
TB3108
Steady State Operation
EQUATION 2:
INPUT VOLTAGE
When Q1 is on, the secondary diode (D2) is off and the
voltage across the T1 primary magnetizing inductance
(VLP) is equal to VIN (t) (see Equation 1). VIN (t) is the
rectified input voltage which is equal to peak input
voltage (VPK) multiplied by the rectified input line phase
angle 2πfLt (fL = 1/TL; fL is the line voltage frequency
and TL is the line voltage period). To simplify the
notation, let 2πfLt be equal to θ (see Equation 2).
Additionally, when Q1 is on the primary inductance
current (ILP) is increasing linearly. This current will flow
through the RSENSE resistor. The voltage drop across
RSENSE is used as a sense voltage (VSENSE) to
translate ILP (see Equation 3).
EQUATION 1:
EQUATION 3:
PRIMARY MAGNETIZING
INDUCTANCE VOLTAGE
ܸ௅௉ ൌ ܸூே ሺ‫ݐ‬ሻ
ܸூே ሺ‫ݐ‬ሻ ൌ ܸ௉௄ ‫ כ‬ȁ•‹ ߠȁ
VOLTAGE ACROSS RSENSE
ܸௌாேௌா ൌ ܴௌாேௌா ‫ܫ כ‬௅௉
Due to the turn-on event of Q1, ILP is usually affected
by a noise which is eventually reflected to VSENSE (see
Figure 4). In order to prevent this switching noise from
causing a false trigger, the COG peripheral uses the
comparator blanking timers to count off a few cycles.
FIGURE 4:
SWITCHING NOISE ON VSENSE
VSENSE is compared with the DAC voltage (VDAC) (this
is also the peak current set point) by the C2
comparator. VDAC is derived from the rectified input
voltage through a voltage divider so that it follows the
rectified input and forces the peak current of primary
inductance (ILPK) to be synchronized and proportional
to the rectified input. This is how the circuit achieves
the PFC function. Equation 4 represents the VDAC
voltage.
EQUATION 5:
EQUATION 4:
EQUATION 6:
DAC VOLTAGE
When VSENSE reaches VDAC, Q1 turns off and HLT is
reset. The duration while Q1 is on (TON) can be derived
using Equation 1. VLP in Equation 1 is equal to the
primary inductance (LP) multiplied by the rate of
change of ILP with respect to time. Equation 5 shows
this relationship.
DS90003108A-page 4
PRIMARY MAGNETIZING
INDUCTANCE VOLTAGE
ܸ௉௄ ‫ כ‬ȁ•‹ ߠȁ ൌ ‫ܮ‬௉ ௗூಽು
ௗ௧
Deriving the primary inductance current with respect to
VPK leads to Equation 6.
PRIMARY INDUCTANCE
CURRENT
ILP is also equal to IPK sin θ since the IPK is enveloped
by the rectified sinusoid. Using this relationship and
Equation 6 we can solve TON (see Equation 7).
 2014 Microchip Technology Inc.
TB3108
EQUATION 7:
Q1 TURN-ON TIME
ܶைே ൌ ௅ು ூು಼ ȁୱ୧୬ ఏȁ
௏ು಼ ȁୱ୧୬ ఏȁ
ൌ
௏ು಼
When Q1 is off, D2 is on and the voltage output (VO) is
equal to the voltage of T1 secondary inductance winding (VLS). The primary magnetizing current is transferred to the secondary winding as secondary
inductance current (ILS). The ILS decreases linearly and
the duration time before it reaches zero is defined by
TOFF (see Equation 8 to Equation 10 in deriving TOFF).
Using Equation 8, ILS current can be derived as shown
in Equation 9.
VOLTAGE OUTPUT
ܸை ൌ ୐ୗ ൌ ‫ܮ‬ௌ FIGURE 5:
SECONDARY MAGNETIZING
CURRENT
௅ು ூು಼
It can be observed in Equation 7 that TON is not
affected by the θ phase angle. Therefore, TON is
constant over the instantaneous line cycle. However,
TON tends not to become constant at minimum voltage
on both sides of the rectified sinusoid. This is due to a
slight input offset caused by Peak Current mode control
comparator C2.
EQUATION 8:
EQUATION 9:
ௗூಽೄ
ௗ௧
்
‫ܫ‬௅ௌ ൌ ‫׬‬଴ ೀಷಷ
௏ೀ ௗ௧
௅ೄ
ൌ ௏ೀ ்ೀಷಷ
௅ೄ
ILS is also equal to n IPK sin θ and LS is equal to LP/n2
where n is T1’s primary to secondary winding turns
ratio NP/NS. Substituting to Equation 9 and solving for
TOFF yields to Equation 10 below.
EQUATION 10:
ܶைிி ൌ
Q1 TURN-OFF TIME
ಽು ௡ூು಼ ȁୱ୧୬ ఏȁ
೙మ
௏ೀ
ൌ
௅ು ூು಼ ȁୱ୧୬ ఏȁ
௡௏ೀ
In Equation 10, TOFF is a function of θ, therefore, it is
variable over the instantaneous line cycle.
As stated earlier, the design is working in CrCM. In
order to ensure this conduction mode operation, Q1
should turn on again when ILS reaches zero. This is
made possible through zero current detection (ZCD)
using C1. C1 detects ILS zero crossing based on VAUX.
Figure 5 shows a timing diagram to visualize the
control operation from start-up to steady state.
LED DRIVER CONTROL TIMING DIAGRAM
 2014 Microchip Technology Inc.
DS90003108A-page 5
TB3108
Since the circuit works at CrCM the sum of Equation 7
and Equation 10 is equal to the switching period TS
(see Equation 11).
The input power, PIN AVG, drawn by the LED driver is
derived by averaging the product of VIN (t) and IP AVG
over one half line cycle TL. (see Equation 15).
EQUATION 11:
EQUATION 15:
Q1 SWITCHING PERIOD
ܶ௦ ൌ ܶைே ൅ ܶைிி ൌ ௅ು ூು಼ ௏ು಼
ቂͳ ൅ ௏ು಼ ȁୱ୧୬ ఏȁ
௡௏ೀ
ቃ
The switching frequency FS is the inverse of TS shown
in Equation 12.
EQUATION 12:
௏ು಼
௅ು ூು಼
Ǥ
ଵ
DUTY CYCLE
‫ܦ‬ൌ
்ೀಿ ்ೄ
ൌ
ଵ
ೇ
ȁ౩౟౤ ഇȁ
ଵା ು಼
೙ೇೀ
EQUATION 16:
మಽ
൬ మು൰
ವ ೅
AVERAGE INPUT POWER
WITH RESPECT TO INPUT
RMS VOLTAGE
ൌ
௏಺ಿೃಾೄ మ
ோಶಷಷಶ಴೅಺ೇಶ
Ǣ ܴாிிா஼்ூ௏ா ൌ
ଶ௅ು
஽మ ்ೄ
In Equation 16, REFFECTIVE is the input equivalent
resistance of the LED driver seen by the AC main input.
In order to relate the PIN AVG to LED average current
ILED, the relationship of output power PO with input
power PIN of LED driver will be used. This relationship
is defined on Equation 17.
EQUATION 17:
The average input current (IP AVG) can be obtained by
averaging the area under ILP (see Equation 14). This
current is sinusoidal and in-phase with VIN(t). As a
result, the LED driver behaves much like a resistor and
exhibits a PF close to unity (see Figure 6).
AVERAGE INPUT CURRENT
VIN(t) AND IPK WAVEFORM
DS90003108A-page 6
௏಺ಿೃಾೄ మ
Power Transfer
EQUATION 14:
ೄ
In Equation 12, it is observable that FS varies with the
instantaneous line voltage since it is a function of θ.
The switching Duty Cycle (D) is the ratio between TON
and TS, and varies with instantaneous voltage as well
(see Equation 13).
EQUATION 13:
௅ು
PIN AVG can be a function of VIN RMS (see Equation 16).
ܲூே஺௏ீ ൌ ೇ
ȁ౩౟౤ ഇȁ
ଵା ು಼
೙ೇೀ
ଵ ௏ು಼ మ ஽మ ்ೄ
ܸூே ሺ‫ݐ‬ሻ ‫ܫ‬௉஺௏ீ ݀‫ ݐ‬ൌ ସ
Q1 SWITCHING
FREQUENCY
‫ܨ‬ௌ ൌ
FIGURE 6:
்௅Ȁଶ
ܲூே஺௏ீ ൌ ‫׬‬଴
AVERAGE INPUT POWER
OUTPUT POWER
ܲைୀ ߟܲூே
In Equation 17, PO is equal to the product of VO and
ILED where VO is also equal to the LED string forward
voltage. PIN is equal to PIN AVG and is the efficiency
of the LED driver. Deriving the equation for ILED from
this relationship leads to Equation 18.
EQUATION 18:
LED CURRENT
‫ܫ‬௅ா஽ ൌ ߟ
௏಺ಿೃಾೄ మ
௏ೀ ோಶಷಷಶ಴೅಺ೇಶ
In Equation 18, ILED is function of VIN RMS. This is the
same RMS voltage that the TRIAC dimmer alters when
dimming the LED. Therefore, through the relationship
between ILED and VRMS shown in Equation 18, LED
brightness can be controlled by the TRIAC dimmer.
 2014 Microchip Technology Inc.
TB3108
ADDITIONAL CIRCUIT
Bleeder Circuit
In Figure 1, there are some circuit blocks included in
the design in order to improve the reliability.
The bleeder circuit draws additional current in order to
maintain the TRIAC holding current at low input line
voltage. Not maintaining the required holding current of
the TRIAC will cause the TRIAC to misfire. The circuit
is composed of the bleeder resistor and a bipolar transistor, which is turned on by the microcontroller only
when certain rectified low input voltage is detected
through the ADC. This is an efficient way to implement
a bleeder since it will not consume additional power
when it is not needed. Figure 7 shows the switching
timing of the bleeder circuit.
Inrush Current Circuit
The Inrush current circuit is an active circuit that
protects the primary side components by suppressing
the large input current spikes. These large current
spikes are induced in the input line when the TRIAC in
the dimmer is fired. A large spike will also create an
input current oscillation that may cause the TRIAC to
misfire.
FIGURE 7:
SWITCHING OF BLEEDER CIRCUIT
Snubber Circuit
FIRMWARE
The snubber circuit is used to protect Q1 from a large
voltage spike caused by the leakage inductance of T1.
When Q1 turns off, the energy from the leakage
inductance is reflected back to primary winding. The
snubber circuit dissipates this energy to minimize the
voltage spike. The circuit consists of a fast switching
diode in series with a parallel combination of a
capacitor and resistor. In some designs, an additional
Zener transil clamp is included to minimize the power
loss at light load.
The circuit design of the LED driver seems complex as
it appears but the firmware is straightforward (see
Figure 8). It appears that the firmware’s overhead is
small and mainly consists of initializing the core
independent peripherals. The pins on the PIC® device
are configured according to their function. After the pins
have been configured, the peripherals are setup and
turned on. During the initialization, the internal
connections and functions of the peripherals are
established. The ADC detects the status of the TRIAC
dimmer. If the rectified input voltage sampled by the
ADC exceeds the TRIAC minimum holding current
threshold voltage, the bleeder circuit turns off,
otherwise, it will turn on. Before the bleeder circuit turns
on, a certain delay is required to evaluate the state of
TRIAC dimmer.
ACTUAL CIRCUIT
The actual circuit of the TRIAC Dimmable LED Driver
is provided in Appendix B: “LED Driver Schematic”.
The value of components shown are to be treated only
as a starting point. They need to be tuned for each
design. The design must be verified and optimized
across the entire range of operating conditions.
 2014 Microchip Technology Inc.
DS90003108A-page 7
TB3108
FIGURE 8:
MCU PERIPHERAL CONFIGURATION
FIRMWARE FLOW
Figure 9 and Table 1 summarize the MCU peripheral
configuration.
FIGURE 9:
TABLE 1:
PERIPHERAL
CONFIGURATION
PIC12HV752 PIN CONNECTION
Pin No.
Name
1
VDD
2
C2IN-
Comparator 2 negative input
Sensing resistor
3
C1IN-
Comparator 1 negative input
Auxiliary regulated voltage
4
MCLR
Memory Clear
ICSP™ (In-Circuit Serial Programmer™)
5
COGOUT0
Complementary Output Generator
MOSFET Driver
6
AN1/VREF
Analog-to-Digital
Rectifier input voltage through voltage divider
7
I/O
Output
Bleeder circuit
8
VSS
Ground connection
Ground
DS90003108A-page 8
Function
Supply Voltage
Circuit Connection
Bootstrap
 2014 Microchip Technology Inc.
TB3108
COG (Complementary Output Generator)
HLT (Hardware Limit Timer)
The main purpose of the Complementary Output
Generator (COG) in the circuit design is to convert two
separate input events into a single PWM output. The
COG uses two independently selectable event sources
to generate the PWM. These event sources are the
rising event, RS, and the falling event, FS, set by the
two comparators and the HLT. The event input
detection may be selected as level detection or edgetriggered. The rising source and falling source operate
as edge-triggered and level sensitive, respectively.
The primary purpose of the HLT is to act as a timed
hardware limit to be used in conjunction with
asynchronous analog feedback applications. The
external Reset source synchronizes the HLT timer with
the analog application.
COG output Q is set to high only when a rising edge
triggers the rising source input. During this time, the
COG turns on the MOSFET. The MOSFET turns off
when a low-voltage level is detected on the falling
source of the COG. Figure 10 describes the operation
of the COG.
FIGURE 10:
COG OPERATION
When the external Reset source occurs before the HLT
timer and HLT period match, the HLT timer resets for
the next period and prevents its output from going
active. However, if the external Reset source fails to
generate a signal within the expected time, allowing the
HLT timer and HLT period to match, then the HLT
output becomes active.
The HLT is configured to be internally connected to the
rising source of the COG. HLT provides a rising edge to
the COG to initiate the start-up of the converter. The
HLT time is set through the equation as shown below in
Equation 20:
EQUATION 20:
HLT TIME
‫ ݁݉݅ܶܶܮܪ‬ൌ ሺ‫ ͳܴܲܶܮܪ‬൅ ʹሻ ቀ
ସ
ி೚ೞ೎
ቁ
Where: ‫ ͳܴܲܶܮܪ‬ൌ ͵ʹ
‫ܨ‬௢௦௖ ൌ ͺ‫ݖܪܯ‬
COMPARATORS
During MOSFET switching, noise may occur that could
result in false triggering. This can be avoided by using
a blanking scheme. Blanking disregards the event
inputs for a short period of time. Since the oscillator of
the PIC12HV752 runs at 8 MHz and the blanking count
register is set to 4, the resulting blanking time would
range from 500 ns to 625 ns on both falling and rising
sources. Equation 19 describes the blanking
calculation.
EQUATION 19:
ܶ௠௜௡ ൌ
஼௢௨௡௧
ி಴ೀಸ̴಴೗೚೎ೖ
COG BLANKING RANGE
; ܶ௠௔௫ ൌ
The output of C1 is ORed to the HLT and acts as the
rising source of the COG, while the output of C2 is the
falling source of the COG. These two comparators act
as zero-cross detection and peak current detection on
the circuit, respectively. The output of C1 continually
resets HLT during the operation of the converter.
஼௢௨௡௧ାଵ
ி಴ೀಸ̴಴೗೚೎ೖ
Where:
‫ ݐ݊ݑ݋ܥ‬ൌ ൜
Comparators are used to interface analog circuits to a
digital circuit by comparing two analog voltages and
providing a digital indication of their relative
magnitudes. The comparator outputs can be applied to
the COG module and can be configured as a closedloop analog feedback to the COG, thereby creating a
PWM controlled in an analog way.
‫ ܴܭܮܤݔܩ‬൏ ͵ǣ Ͳ ൐ൌ Ͷǡ‫ ݐ݊݁ݒ݁݃݊݅ݏ݅ݎ‬
‫ ܨܭܮܤݔܩ‬൏ ͵ǣ Ͳ ൐ൌ Ͷǡ݂݈݈ܽ݅݊݃݁‫ݐ݊݁ݒ‬
‫ܨ‬஼ைீ̴௖௟௢௖௞ ൌ ͺ‫ݖܪܯ‬
 2014 Microchip Technology Inc.
DAC (Digital-to-Analog Converter)
A 5-bit DAC module is used to translate the rectified
input voltage. It is internally connected to the positive
input of C2. It operates in Full-Range mode with the
DAC output voltage as shown in Equation 21 where
VSRC is the voltage across the voltage divider network
(see Figure 1).
DS90003108A-page 9
TB3108
EQUATION 21:
DAC VOLTAGE
ܸ஽஺஼ ൌ ൬ሺܸௌோ஼ ൅ሻ ቀ
TABLE 2:
஽஺஼ோழସǣ଴வ
ቁ൰
ଶఱ
230 VIN
Where: ‫ ܴܥܣܦ‬൏ Ͷǣ Ͳ ൐ൌ ቄ
ͳǡܽ‫ ܸͲ͵ʹݐ‬
͹ǡܽ‫ͳͳݐ‬ͷܸ
ADC (Analog-to-Digital Converter)
The ADC converts the input signal into a 10-bit binary
representation. This value is calculated using the ADC
equation shown in Equation 22.
The ADC samples and translates the rectified input
voltage in order to control the toggling of pin 7 (RA0).
RA0 becomes low when the voltage sampled by the
ADC is greater than the minimum voltage required to
maintain the holding current of the TRIAC dimmer,
otherwise, RA0 will be high.
EQUATION 22:
ܸ஺஽஼
ADC VOLTAGE
ܸௌோ஼ ሺʹଵ଴ െ ͳሻ
ൌ
ܸ஺஽஼ோாி
PERFORMANCE
Table 2 and Table 3 show the measured dimming
performance of the LED driver operating at 230V and
115V, respectively. Its graphical representation is
shown in Figure 11 wherein the dimming is controlled
by the TRIAC output voltage.
TABLE 2:
MEASURED DIMMING
PERFORMANCE AT 230V
INPUT VOLTAGE
TRIAC Output Voltage
(VRMS)
LED Current (mA)
80.3
32.24
68.2
22.81
60.2
17.86
50.15
12.11
TABLE 3:
MEASURED DIMMING
PERFORMANCE AT 115V
INPUT VOLTAGE
115 VIN
TRIAC Output Voltage
(VRMS)
LED Current (mA)
115.5
300.39
100.5
225.22
90.8
186.03
80.5
148.73
70.7
115.49
60.7
85.23
50.23
61.65
41.2
41.19
29.99
18.84
MEASURED DIMMING
PERFORMANCE AT 230V
INPUT VOLTAGE
230 VIN
TRIAC Output Voltage
(VRMS)
LED Current (mA)
230.1
297.33
218.5
262.21
172
162.63
160.1
141.03
149.1
122.81
139.4
104.57
130.1
85.16
119
72.24
109.8
62.9
101
53.11
90.1
41.95
DS90003108A-page 10
 2014 Microchip Technology Inc.
TB3108
FIGURE 11:
DIMMING PERFORMANCE
POSSIBLE DESIGN IMPROVEMENTS
CONCLUSION
Even a high Power Factor device like the LED driver
discussed in this technical brief represents a capacitive
load. This is because of the filter implemented at the
input side of the circuit. This LC filter can produce a
high voltage ringing derived from input current
oscillation when the TRIAC in the dimmer initially fires.
The voltage ringing makes the TRIAC current drop
below the holding current and switch off and on again
several times during the cycles, resulting in severe
flickering and a humming sound.
This technical brief describes a PIC microcontrollerbased solution controlling the LED driver that is
compatible with traditional TRIAC dimmers. With the
PIC12HV752, the analog control mainly runs by itself
and only requires small firmware overhead. This
enables users to add algorithms in order to improve
design performance, bring intelligence to the system,
or measure any parameter.
FIGURE 12:
FLICKERING WAVEFORM
During the first three cycles in the rectified line voltage
shown in Figure 12, the TRIAC has recovered after
firing and continues the conduction. However, after the
three cycles, the rectified input waveform changed
showing that the TRIAC is turning on and off. This input
line event produces flickering and a humming sound.
For a smooth dimming and a quiet operation, the
challenge is to avoid unwanted TRIAC switching,
caused by the ringing that occurs when the TRIAC is
initially fired. The input filter of the LED driver design
presented in this technical brief requires an
optimization to avoid this problem and ensures that the
line waveform will not be altered.
 2014 Microchip Technology Inc.
DS90003108A-page 11
TB3108
APPENDIX A:
LED DRIVER EQUATION DERIVATION
EXAMPLE A-1:
IP AVG DERIVATION
ܸൌ
௅ௗ௜
݀݅ ൌ
ௗ௧
௏ௗ௧
‫ܫ‬௉௄ ൌ
௅
ܸூே ሺ‫ݐ‬ሻ
‫ܶܦ‬ௌ
‫ܮ‬௉
Where: ܸூே ሺ‫ݐ‬ሻ ൌ ܸ௉௄ •‹ሺʹߨ݂௅ ‫ݐ‬ሻ
ଵ
Let ݂௅ ൌ
்ಽ
ܸூே ሺ‫ݐ‬ሻ ൌ ܸ௉௄ •‹ ቀ
ଶగ௧
்ಽ
ቁ
Substitute ܸூே ሺ‫ݐ‬ሻ to ‫ܫ‬௉௄ equation
‫ܫ‬௉௄ ൌ
௏ು಼ ୱ୧୬൬
మഏ೟
൰
೅ಽ
௅ು
‫ܶܦ‬ௌ
To get the average input current, the equation below must be evaluated
‫ܫ‬௉஺௏ீ ൌ
‫ܫ‬௉஺௏ீ ൌ
ଵ ்ೄ ଵ
‫ݐ݀ ܫ‬
‫׬‬
்ೄ ଴ ଶ ௉௄
ଵ
்
ଵ
்ೄ
‫ܫݔ ݔ‬௉௄ ‫׬‬଴ ೄ ݀‫ݐ‬
ଶ
Integrating and Substituting ‫ܫ‬௉௄ to the equation
‫ܫ‬௉஺௏ீ ൌ
ଵ
்ೄ
‫ܫ‬௉஺௏ீ ൌ
ଵ
௏಺ಿ ሺ௧ሻ
ଶ
௅ು
ଵ
௏಺ಿ ሺ௧ሻ
ଶ
௅ು
‫ݔ ݔ‬
ଵ
்ೄ
‫ݔ ݔ‬
஽்ೄ
‫ܶܦ‬ௌ ቂ‫׬‬଴
்
݀‫ ݐ‬െ ‫׬‬஽்ೄ Ͳ݀‫ݐ‬ቃ
ೄ
‫ܶܦ‬ௌ ‫ܶܦݔ‬ௌ Simplifying the equation results to:
‫ܫ‬௉஺௏ீ ൌ
DS90003108A-page 12
௏಺ಿ ሺ௧ሻ
ଶ௅ು
‫ܦ‬ଶ ܶௌ  2014 Microchip Technology Inc.
TB3108
EXAMPLE A-2:
PIN AVG DERIVATION (CONTINUED)
೅
ܲூே஺௏ீ ൌ ܲூே஺௏ீ ൌ ܲூே஺௏ீ ൌ ಽ
ଶ
‫ ׬‬మ ܸூே ሺ‫ݐ‬ሻ‫ܫ‬ூே ሺ‫ݐ‬ሻ݀‫ݐ‬
்ಽ ଴
మ
మ మഏ೟ మ
೅ಽ ௏
ು಼ ௦௜௡ ൬ ೅ ൰஽ ்ೄ
ಽ
మ
ଶ௅ು
்ಽ ଴
ଶ
‫׬‬
ଶ ௏ು಼ మ ஽మ ்ೄ
ଶ௅ು
்ಽ
೅ಽ
݀‫ݐ‬
ଶగ௧
‫׬‬଴మ ‫ ݊݅ݏ‬ଶ ቀ ் ቁ ݀‫ݐ‬
ಽ
೅ಽ
Solve for the integral equation: ‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ
೅ಽ
೅ಽ ଵିୡ୭ୱଶ൬మഏ೟൰
೅ಽ
ଶగ௧
‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ ் ቁ ݀‫ ݐ‬ൌ ‫׬‬଴మ
ଶ
ಽ
೅ಽ
೅ಽ
ଶగ௧
‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ ் ቁ ݀‫ ݐ‬ൌ ‫׬‬଴మ ଶ ݀‫ ݐ‬െ ‫׬‬଴మ
ଶ
ಽ
೅ಽ
ଶగ௧
ଵ
೅ಽ
ଵ
்ಽ
ቁ ݀‫ݐ‬
݀‫ݐ‬
೅ಽ ୡ୭ୱଶ൬మഏ೟൰
೅ಽ
ଵ
ଶగ௧
೅ಽ
݀‫ݐ‬
ଶగ௧
‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ ் ቁ ݀‫ ݐ‬ൌ ଶ ‫ ݐ‬ฬ ଴మ െ ଶ ‫׬‬଴మ …‘•ʹ ቀ ் ቁ ݀‫ݐ‬
ಽ
ಽ
೅ಽ ୡ୭ୱଶ൬మഏ೟൰
೅ಽ
Simplify the integral equation ‫׬‬଴మ
‫ ݑ‬ൌ ʹቀ
ଶగ௧
்ಽ
ቁൌ
ଶ
݀‫ ݐ‬by letting:
ସగ௧
்ಽ
Derivative of ‫ ݑ‬results to:
݀‫ ݑ‬ൌ
ସగ
்ಽ
݀‫ݐ‬
೅ಽ ୡ୭ୱଶ൬మഏ೟൰
೅ಽ
Simplified equation for ‫׬‬଴మ
೅ಽ ୡ୭ୱଶ൬మഏ೟൰
೅ಽ
మ
‫׬‬଴
ଶ
݀‫ ݐ‬is:
೅ಽ
ଵ
݀‫ ݐ‬ൌ ‫׬‬଴మ …‘• ‫ݑ݀ݑ‬
ଶ
೅ಽ
ଵ
ଶ
ଵ
‫ ׬‬మ …‘• ‫ ݑ݀ݑ‬ൌ ଶ •‹ ‫ ݑ‬൅ ܿ
ଶ ଴
ଵ
೅ಽ ୡ୭ୱଶ൬మഏ೟൰
೅ಽ
‫׬‬మ
ଶ ଴
ଶ
ଵ
ସగ௧
ଶ
்ಽ
݀‫ ݐ‬ൌ ‫݊݅ݏ‬
೅ಽ
ฬ ଴మ
೅ಽ
Substitute to the resulted value to ‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ
೅ಽ
ଶగ௧
ଵ
೅ಽ
ଵ
‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ ் ቁ ݀‫ ݐ‬ൌ ଶ ‫ ݐ‬ฬ ଴మ െ ଶ ‫݊݅ݏ‬
ಽ
೅ಽ
ଶగ௧
ଵ ்
ସగ௧
்ಽ
ଵ
 2014 Microchip Technology Inc.
்ಽ
ቁ ݀‫ ݐ‬:
೅ಽ
ฬ ଴మ
‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ ் ቁ ݀‫ ݐ‬ൌ ଶ ቀ ଶಽ െ Ͳቁ െ ଶ ቆ‫݊݅ݏ‬
ಽ
ଶగ௧
೅
ସగቀ మಽቁ
்ಽ
െ ‫Ͳ݊݅ݏ‬ቇ
DS90003108A-page 13
TB3108
EXAMPLE A-3:
PIN AVG DERIVATION (CONTINUED)
೅ಽ
ଶగ௧
‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ ் ቁ ݀‫ ݐ‬ൌ
ಽ
்ಽ
ସ
Substitute to ܲூே஺௏ீ equation:
ܲூே஺௏ீ ൌ ܲூே஺௏ீ ൌ ଶ ௏ು಼ మ ஽మ ்ೄ
்ಽ
ଶ௅ು
೅ಽ
ଶగ௧
‫׬‬଴మ ‫݊݅ݏ‬ଶ ቀ ் ቁ ݀‫ݐ‬
ಽ
ଶ ௏ು಼ మ ஽మ ்ೄ ்ಽ
்ಽ
ଶ௅ು
ቀ ቁ
ସ
ܲூே஺௏ீ results to:
ܲூே஺௏ீ ൌ DS90003108A-page 14
ܸ௉௄ ଶ ‫ܦ‬ଶ ܶௌ
Ͷ‫ܮ‬௉
 2014 Microchip Technology Inc.
'
&
%
$
5
5
X+
'13
9
3/9$$
5
5
:
—)
'
9
&
9
5
.
+'7
4
.6&'70
5
5
&
—)
9$&
5
5
:
/
9330&/5
9''
*1'
,&63'$7
,&63&/.
1&
1
-
/
,(&&
-
5
.
9
'
9''
8
)0077$
4
'13
'
'
'13
/
X+
&
—)
9
5
.
*1'
5
.
5
.
'
9
5
.
5
.
%$9:6)
4
.6&'70
'
5
.
5
.
'
9
9
966
3,&+9,61
'
5
5
5
)LOH
9
73
8
'
00=9
.
5
0&37(27
—)
&
'
%$76:
&
S)
9
6FK'RF
0/RSHU
--XOLFKHU
:&KDQGOHU%OYG
&KDQGOHU$=
9
73
5
.
&
S)
5
.
:
5
5
:
73
73
6FDOH
6L]H
%
4
)4'1&70
6(&
-$$/
%,$6
35,
7 )&601R
5
5
:
5
5
:
73
7LWOH
'
6-(7
'
60%-$
0LFURFKLS7HFKQRORJ\,QF
5
.
'UDZQE\
(QJ
5
.
%$9:6) 5
9
&
—)
5
.
5$&/.,17&.,&,1&2*287
,&63'$7&2*287'$&287)95287&,1&,1$15$
5$$1&2*)/7&/.287&,1&2*2877*
,&63&/.95()&,1&,1$15$
5$0&/5&2*)/77*
&2*287&&3&287&2877&.,,17$15$
5
. :
&
—)
9
5
.
:
 2014 Microchip Technology Inc.
'
&
X)
9
6FKHPDWLF
&
—)
9
&
X)
9
'DWH
':*1R
6KHHW
9
'
-
RI
'LPPDEOH/('%DOODVW
&
S)
9$&
9'&
&0580
(
'
5HY
72/('6
(
'
&
%
$
FIGURE B-1:
APPENDIX B:
TB3108
LED DRIVER SCHEMATIC
TRIAC DIMMABLE LED DRIVER SCHEMATIC
DS90003108A-page 15
Note the following details of the code protection feature on Microchip devices:
•
Microchip products meet the specification contained in their particular Microchip Data Sheet.
•
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•
Microchip is willing to work with the customer who is concerned about the integrity of their code.
•
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
FlashFlex, KEELOQ, KEELOQ logo, MPLAB, mTouch, PIC,
PICmicro, PICSTART, PIC32 logo, rfPIC, SST, SST Logo,
SuperFlash and UNI/O are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other
countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MTP, SEEVAL and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of
Microchip Technology Inc. in other countries.
Analog-for-the-Digital Age, Application Maestro, BodyCom,
chipKIT, chipKIT logo, CodeGuard, dsPICDEM,
dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial
Programming, ICSP, Mindi, MiWi, MPASM, MPF, MPLAB
Certified logo, MPLIB, MPLINK, Omniscient Code
Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit,
PICtail, REAL ICE, rfLAB, Select Mode, SQI, Serial Quad I/O,
Total Endurance, TSHARC, UniWinDriver, WiperLock, ZENA
and Z-Scale are trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
GestIC and ULPP are registered trademarks of Microchip
Technology Germany II GmbH & Co. KG, a subsidiary of
Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their
respective companies.
© 2014, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
QUALITY MANAGEMENT SYSTEM
CERTIFIED BY DNV
== ISO/TS 16949 ==
DS90003108A-page 16
ISBN: 978-1-63276-315-0
Microchip received ISO/TS-16949:2009 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
 2014 Microchip Technology Inc.
Worldwide Sales and Service
AMERICAS
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://www.microchip.com/
support
Web Address:
www.microchip.com
Asia Pacific Office
Suites 3707-14, 37th Floor
Tower 6, The Gateway
Harbour City, Kowloon
Hong Kong
Tel: 852-2943-5100
Fax: 852-2401-3431
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4123
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Austin, TX
Tel: 512-257-3370
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Novi, MI
Tel: 248-848-4000
Houston, TX
Tel: 281-894-5983
Indianapolis
Noblesville, IN
Tel: 317-773-8323
Fax: 317-773-5453
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
New York, NY
Tel: 631-435-6000
San Jose, CA
Tel: 408-735-9110
Canada - Toronto
Tel: 905-673-0699
Fax: 905-673-6509
 2014 Microchip Technology Inc.
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8569-7000
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
China - Hangzhou
Tel: 86-571-8792-8115
Fax: 86-571-8792-8116
China - Hong Kong SAR
Tel: 852-2943-5100
Fax: 852-2401-3431
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8864-2200
Fax: 86-755-8203-1760
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
India - Pune
Tel: 91-20-3019-1500
Japan - Osaka
Tel: 81-6-6152-7160
Fax: 81-6-6152-9310
Japan - Tokyo
Tel: 81-3-6880- 3770
Fax: 81-3-6880-3771
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Germany - Dusseldorf
Tel: 49-2129-3766400
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Germany - Pforzheim
Tel: 49-7231-424750
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Italy - Venice
Tel: 39-049-7625286
Malaysia - Kuala Lumpur
Tel: 60-3-6201-9857
Fax: 60-3-6201-9859
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
Poland - Warsaw
Tel: 48-22-3325737
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
Taiwan - Hsin Chu
Tel: 886-3-5778-366
Fax: 886-3-5770-955
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
Sweden - Stockholm
Tel: 46-8-5090-4654
UK - Wokingham
Tel: 44-118-921-5800
Fax: 44-118-921-5820
Taiwan - Kaohsiung
Tel: 886-7-213-7830
Taiwan - Taipei
Tel: 886-2-2508-8600
Fax: 886-2-2508-0102
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
03/25/14
DS90003108A-page 17