AN392
Application note
Microcontrollers and TRIAC-based dimmers
Introduction
Today, electronics is used in home appliances for applications as widely varying as motor
regulation in a washing machine, control of a vacuum cleaner, dimming of a lamp or heating
in a coffee machine. This evolution has increased pace rapidly because appliances require
enhanced features that are easy to build and modify while electronics-based solutions
become cheaper and more sophisticated.
Within this evolution, microcontrollers (MCU) progressively replace analog controllers and
discrete solutions even in low cost applications. MCUs are more flexible, often need less
components and provide shorter time to market. With an analog IC, the designer is limited to
a fixed function frozen inside the device. With a DIAC control, features like sensor feedback
or enhanced motor drive cannot be easily implemented. With an MCU the designer can
include his own ideas and test them directly using EPROM or one time programmable (OTP)
versions.
The TRIAC is the least expensive power switch to operate directly on the 110/240 V mains.
Thus it is the optimal switch for most of the low-cost power applications operating online.
The logic level or snubberless TRIACs can operate with low gate current and can be directly
triggered by the MCU.
This application note describes two different MCU based applications: a universal motor
drive, and a light dimmer. They all operate with the same user interfaces and almost the
same software and hardware.
April 2009
Doc ID 1863 Rev 2
1/11
www.st.com
Universal motor drive
AN392
1
1.1
Universal motor drive
Power control
The power device is a TRIAC because it is the most economical online switch. In a TRIAC-
based controller the output power, and, for example, the motor speed, are controlled by the
phase delay of the TRIAC drive. This delay is referred to the zero crossing of the line voltage
which is detected by means of a connection to the mains neutral (Figure
1).
Changing
operation from 60 Hz to 50 Hz can be achieved by making simple modifications to the MCU
EPROM/ROM table defining the TRIAC conduction angle versus power level. Automatic
selection of the 50 Hz/ 60 Hz tables can be implemented.
The TRIAC can be directly driven by the MCU. A very short gate current pulse (~ 100 µs)
could be enough to trigger the TRIAC for rms load currents above 2 A. Such pulse control
allows the low voltage MCU power supply consumption to be reduced. The snubberless
TRIAC is driven in quadrants QII and QIII with a 60 mA gate current provided by three I/O
bits of the ST6210 in parallel. This pulse is sufficiently long to ensure the TRIAC is latched at
the end of the pulse. Pulse length can be modified if another TRIAC or motor is used.
Figure 1.
Mains synchronization
1.2
User interfaces
Different user interfaces can be implemented - a touch control, a push button or a
potentiometer. The circuit diagram in
Figure 2
show that the three modes are implemented
on the board to let the system designer choose the preferred user interface.
Control action is obtained when the sensor or the button is touched for more than 330 ms. If
the touch duration is between 50 ms and 330 ms, the circuit is switched on or off. A contact
of less than 50 ms causes no action.
2/11
Doc ID 1863 Rev 2
AN392
Figure 2.
Motor drive circuit diagram
Universal motor drive
Fuse
Line
19
18
17
16
1
+5 V
Optional
user interface
RESET 7
4.7 M
10 nF
GND
Touch sensor
4.7 M
VDD
47
BTA16-600CW
-
GND
PA0
PA1
PA2
PA3
PB2
PB3
PB4
PB0 15
PB1
14
4.7 M
Version
Push button
13
12
11
ST6210
ST6210
5
NMI
VPP 6
VSS 20
OSCOUT
4
GND
1M
+5 V
OSCIN
3
+5 V
Load
5.6 V
Neutral
820-1/2W
1N4148
GND
100 uF/10 V
1
2
Potentiometer
22 pF
8 MHz
22 pF
220 nF/400 V
GND
GND
GND
GND
1.3
Circuit components
The MCU chosen (ST6210) includes an 8 bit accumulator, 2 k ROM, 64 bytes RAM, an 8 bit
A/D converter that can be connected to 8 different inputs, 4 I/O lines with 40 mA sink current
capability and a timer. Hysteresis protection is included in series with each I/O pin. The
ST6210 is packaged in DIL or SMD packages. The ports, the timer and interrupt
configurations can be chosen by software, providing high flexibility. The ST6210 has been
designed to operate in very disturbed environments. Each I/O line contains internal diodes
which clamp the input voltage between V
dd
and V
ss
. These diodes are sized to withstand a
continuous current of 1 mA (typ.).
The snubberless TRIAC (BTA 16-600CW) has been specially designed to drive loads which
generate very strong dynamic constraints such as a vacuum cleaner motor. This TRIAC can
be triggered in quadrants QI, QII or QIII with gate and latching current of 35 mA and 80 mA
respectively. In this application it is driven by three I/O lines of the ST6210 in parallel. This
TRIAC has high current switching capability ((dI/dt)c > 8.5 A/ ms and 5.5 A/ms for
BTA10600CW), and high static dv/dt ((dV/dt) > 500 V/ms). So, in this circuit, it can operate
without any snubber.
Total consumption of the board is 3 mA with an 8 MHz oscillator. The board supply comes
from the mains through a simple RCD circuit. The +5 V is referred to anode 1 of the TRIAC
in order to provide the negative gate current necessary to drive the TRIAC in quadrants QII
and QIII. The 5 V supply capacitance is connected as near as possible to the MCU with very
short interconnecting traces to maximize RFI immunity.
The touch sensor is a voltage divider between line and neutral. It works only if the +5 V
supply input of the circuit is connected to the line. This connection to the mains must be
ensured according to local electrical safety rules.
Doc ID 1863 Rev 2
3/11
Universal motor drive
AN392
1.4
Software
All operating features are contained in a 700 byte program. So more than 1 byte of ROM is
available for additional features.
A look-up table relating delay time to the power requirement contains 64 different levels. The
conduction time of the TRIAC can vary from 1.7 ms to 6.7 ms for a 60 Hz application and
from 2 ms to 8 ms to a 50 Hz application. The user can easily adjust the minimum and
maximum power levels because the corresponding delay times are slowly changing at the
top and bottom of the table.
It is recommended that all MCU inputs be filtered so that an input is validated only if it
remains constant for 15 s or more so that passive filter components can be saved. The
mains supply carries disturbances (glitches, telecommand signals, ...) which could disturb
the TRIAC drive. For this reason, a mains voltage zero crossing is only validated if it occurs
during a window of time (1.7 ms each 16.6 ms for 60 Hz operation and 2 ms each 200 ms for
50 Hz operation) selected by the internal timer of the MCU. This block acts as a filter and
again eliminates external components (Figure
3).
This circuit can be used in the following applications:
●
●
●
●
●
Vacuum regulation in a vacuum cleaner
Speed control in a food processor
Speed regulation with torque limiting in a drill
Unbalance detection in a washing machine
Washing machine door opener with remote control
Major steps of the software
Figure 3.
RESET
Initialization
Read version
Line synchronization
Sensor acquisition
Power level requirement
Delay time td1 in timer
Calculation next delay
TRIAC firing
Delay time td2 in timer
Calculation next delay
TRIAC firing
Window for zero
crossing mains
4/11
Doc ID 1863 Rev 2
AN392
Light dimmer
2
Light dimmer
For a light dimmer application, the board can be plugged in series with the line wire like a
mechanical switch. The line synchronization and the auxiliary supply are obtained from the
voltage across the TRIAC (Figure
4).
Figure 4
shows a schematic which can operate either on 110 V or 240 V mains. It uses an
MCU ST6210 and a logic level TRIAC. This circuit drives halogen or incandescent lamps
supplied directly from the mains or through a low voltage transformer. It includes soft start
and protection against transformer saturation and against open load. The user interfaces
are the same as previously presented.
Figure 4.
Light dimmer circuit diagram
Optional
user interface
4.7 M
Touch sensor
10 nF
GND
4.7 M
4.7 M
Fuse
Line
100
BTA08 -600SW
+5 V
19
18
17
16
1
+5 V
RESET
VDD
PA0
PA1
PA2
PA3
PB2
PB3
PB4
PB5
OSCOUT
OSCOUT
4
4
OSCIN
3
PB0
PB1
13
7
15
14
Version
12
GND
11
Push button
100k
12 V
T?
ST6210
ST6210
5
NMI
6
VPP
20
VSS
GND
200k
Trans
100k
+5 V
200k
+5 V
1
2
Potentiometer
22 pF
22k
5.6 V
GND
8 MHz
22 pF
GND
GND
GND
GND
Neutral
820-1/2W
220 nF/400 V
1N4148 100 uF/10 V
GND
2.1
Power control
Power is controlled by the phase delay (t
d
) of the TRIAC drive. In the previous design, t
d
is
referred to the zero crossing of the line voltage. To avoid a connection to the mains neutral
as the circuit is in series with the load, the trigger delay is referred to the zero crossing of the
current (see
Figure 1).
When the TRIAC anode current reaches zero, the mains voltage is
reapplied across the TRIAC. Synchronization is achieved by measuring this voltage. This
voltage is monitored over each half cycle with a network of resistances connected to two I/O
lines of the ST6210. This allows detection of spurious open load and the retriggering of the
TRIAC with multipulse operation if it is not latched after the first gate current pulse.
Doc ID 1863 Rev 2
5/11