Professional Documents
Culture Documents
Application note
Using an ST7ULTRALITE microcontroller
to drive a TRIAC or an AC switch for a Mains supply
Introduction
This document describes how to design a light dimmer or motor speed control device using
an ST7ULTRALITE microcontroller as a driver for a TRIAC or AC switch on the mains
supply. This electronic equipment is typically used in home appliances or in industrial
applications for a variety of purposes such as motor regulation in washing machines,
vacuum cleaner control, light dimming in a lamp, heating in a coffee machine, or motor
regulation in a ventilator.
The STEVAL-ILL004V2 evaluation board illustrates ST’s solution for these kinds of
applications. This design is mainly based on the solution presented in Application Note
AN2263: Universal motor speed control and light dimmer with TRIAC and ST7LITE
microcontroller which provides a complete design description for the STEVAL-ILL004V1
evaluation board.
The main difference between these two evaluation boards is the microcontroller; the
STEVAL-ILL004V2 uses the smaller 8-pin ST7ULTRALITE microcontroller while the
STEVAL-ILL004V1 uses a 16-pin ST7FLITE09 microcontroller.
This document presents only new and important information concerning the STEVAL-
ILL004V2 evaluation board in order to get quickly started with evaluation. Application Note
AN2263 can be used as a reference for complete design solution and provides examples of
capacitive power supply circuit design calculation, TRIAC power dissipation calculation,
recommended TRIAC summary, ZCD (zero crossing detection) resistor calculation and
gate-limiting resistor calculation.
STEVAL-ILL004V2 evaluation board
Contents
1 Basic principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Light dimmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1 2-load configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4 EMC testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.1 EN 55015 for the light dimmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 EN 61000-3-2 class A for light dimmer . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.3 EN 55014 for motor speed control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.4 EN 61000-3-2 class A for motor speed control . . . . . . . . . . . . . . . . . . . . 12
5 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5.1 Main.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.2 Ports.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3 Pwm_ar_timer_12bit.c module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Appendix A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2/21
AN2425 Basic principle
1 Basic principle
Control techniques for monophase motors, light dimmers or any AC load are based on
phase-angle adjusting. The block schematic of this principle is shown in Figure 1. The
TRIAC is turned ON by the control signal coming from the microcontroller with a given delay
after the zero crossing, and is automatically turned OFF when its current reaches a zero
value. It is the same for positive and negative voltages. The total power delivered to the
LOAD depends on the time, when the TRIAC is turned ON.
The “heart” of this application is the small, 8-pin ST7ULTRALITE microcontroller. The
synchronization used to switch ON the TRIAC at the same time for each of the cycles is
provided by zero crossing detection (ZCD). The MCU detects the zero crossing after each
period of the input signal and sets the time to switch on the TRIAC in relation to the value of
the voltage on the potentiometer or button. Due to the low power consumption, the
evaluation board includes a low-cost capacitive power supply. As the TRIAC produces a
noise when it is turned “ON” or “OFF,” an input EMI filter is connected on the board.
3/21
Universal motor speed control AN2425
4/21
AN2425 Universal motor speed control
The Zero Cross Detector (ZCD) is realized by R1, R2, and C2 and the signal is connected to
the PA2 port of the microcontroller. A new software implementation can be easily done on
the board, due to the ICC connector used to program the microcontroller. As stated above,
Switch S2 selects the control method (button or potentiometer).
The TRIAC is driven by high-current capability port PA4 of the microcontroller with maximum
current up to 20mA. If there is not enough power to switch ON the TRIAC, Jumper J5 can be
connected to two ports in parallel configuration. In this case, the maximum current capability
is 25mA. Jumper J4 must be disconnected in order to use the reset pin as the output. This
action must be also supported by software modification, because the reset pin must be set
as the output (port A3). To configure this pin as output, write 55h to MUXCRO and AAh to
MUXCR1 registers. For more information, please refer to the ST7ULTRALITE datasheet.
Note: The STEVAL-ILL004V2 demonstrates both the light dimmer and motor speed control. It
means the potentiometer and button is used. If one type of solution is requested, only the
potentiometer or button can be used and therefore the next two high-sink ports of the
microcontroller can be available (Switch S2 is also not used). It can increase current
capability up to 60mA.
5/21
6/21
Figure 2.
Application schematic
L1
R1 R2
2
AIN0 PA1
JUMPER 3
JUMPER 1
VARIS
VARISTOR
1 2 J5
C3 ST 7ULT RALI TE
R3
1 10nF R1
R11
1
MAINS S3 3 4 1M
Q1 4K 7
JUMPER 5
J1 N R4
2 1
1 ~275 BTB16
B16 or 47
2 VC C
ACST67S C8
L TR IAC
10
8
6
4
1
2
2.2nF P1 R12
ICC
C7 C9 10K 2
Snubber
F1 R9 20K
1
9
7
5
3
3
470nF 100nF
1k
~275V AC X2 R1
R13
FUSE 4K 7 VC C
R1
R10 VC C
150 R8 R5
VC C
S2 1 2 20K 20K
+ itch
Switch
ZD1
1 5.6V C5
3 S1 1 2
C4 D1 470uF/16V
470µF/16V C6
R7 R6 Bu tton
tto
1nF
3 4
150 150 330nF D4007
~275V AC X2
AN2425
AN2425 Light dimmer
3 Light dimmer
The STEVAL-ILL004V2 evaluation board is also used for light dimmer applications. This
solution is based on the same design principle as the motor speed control; meaning that all
information provided in Section 2: Universal motor speed control is also valid for light
dimmers.
In regards to lighting specifications, a different type of input filter is selected compared with
the motor speed control. A CLC filter (C7 = 470nF, C9 = 100nF and L1 = 0.1mH) is used.
In order to control the light (typical of dimmer applications), the use of Switch S2 must be
taken into account when designing the application to enable certain features such as
decreasing or increasing lamp brightness. If the switch is pressed twice quickly (between 0
and 40ms), nothing happens. If pressed between 40ms and 240ms, it means turn “ON” or
“OFF” device. If the lamp is turned “OFF”, the brightness level is stored in the memory of the
microcontroller. When pressed for longer than 240ms, the brightness “automatically”
increases until it reaches its maximum value at which point the brightness starts decreasing
and so on.
7/21
Light dimmer AN2425
2.
8/21
AN2425 Light dimmer
Figure 4. Maximum time for switching ON the TRIAC with lamp in series
9/21
EMC testing AN2425
4 EMC testing
Light dimmer applications are tested for compliance with EN55015 and motor speed control
applications with EN55014-1 and EN61000-3-2 class A specifications.
● EN55015 specifications describe the limits and methods of measurement of radio
disturbance characteristics for electrical lighting and similar equipment.
● EN55014-1 specifications describe electromagnetic compatibility - requirements for
household appliances, electric tools, and similar devices - part 1: emission.
● EN61000-3-2 specifications describe the limits for harmonic current emissions
(equipment input current up to and including 16A per phase).
For more information, please refer to Application Note AN2263: Universal motor speed
control and light dimmer with TRIAC and ST7LITE microcontroller.
The evaluation board was tested for compliance with these three specifications. Note that for
any other design of these applications (light dimmer, motor control, etc.), the results will not
be the same and the tests must therefore be repeated.
In conclusion, only a certification laboratory can provide and approve the compliance with
specifications for the products to be sold on the market.
10/21
AN2425 EMC testing
11/21
EMC testing AN2425
12/21
AN2425 Software
5 Software
13/21
Software AN2425
Figure 8. ZC events
Period Period
AI12629
OC int. OC int. OC int. OC int. OC int. OC int. OC int. OC int. OC int. OC int. OC int.
ZC sync. ZC sync.
FFF
DCR = DCR
+ 640 hrs
DCR = CNTR
+ 640 hrs DCR =
DCR + 640 hrs
000
14/21
AN2425 Software
MAIN
PORTS settings
TIMER settings
ADC settings
WDG refresh
WFI
END
AI12631
15/21
Software AN2425
PORTS_0_
Interrupt
NO NO
1st 2nd
interrupt? interrupt? NO NO
1st ZC Fit signal ZC
missed? window?
YES YES
Set ZC window
Set ZC window for 50Hz
or 60Hz
Reset Micro Prepare new value
by WDG for triac firing
Synchronize (read from button
TIMER or potentiometer)
WDG on
RETURN
Micro is already
synchronized
1
AI12632
16/21
AN2425 Software
AR_TIMER_0C
_ Interrupt
YES
1st ZC Recount edges
missed? for firing the triac
NO
Button
checking and
handling
Dimming
direction
handling
YES
Is it the
time to fire Fire the triac
the triac?
NO
YES
2nd ZC Reset the
missed? Micro
NO
Counter ++
WDG refresh
RETURN
AI12633
17/21
References and related materials AN2425
1. AN 2263: Universal motor speed control and light dimmer with TRIAC and ST7LITE
micro
2. AN 1255: New circuital solution to efficiently drive an AC monophase motor or AC load
3. ACST6-7S Datasheet
4. BTB16 Datasheet
5. AN1512: ST FIVE control of an AC monophase motor without harmonic distortion
6. ST7ULTRALITE Datasheet
7. AN 392/1098: Using Microcontrollers and TRIACs on a 110/240V mains supply.
18/21
AN2425
Appendix A
1 1 CONNECTOR2 ICC
2 1 C1 100nF/50V
3 1 C2 100pF/50V
4 1 C3 10nF/50V
5 1 C4 330nF/~275V AC X2
6 1 C5 470µF/16V
7 1 C6 1nF/50V
8 1 C7 470nF/~275V AC X2
9 1 C8 2.2nF (NC)
10 1 C9 100nF/~275V AC X2
11 1 D1 D4007
12 1 F1 FUSE- 10A
13 1 IO1 ST7ULTRALITE ST7FLITEUS5B6
14 5 J1, J2, J3, J4, J5 JUMPER
15 2 J6, J7 CON3
16 3 J8, J9, J10 CON1
17 1 L1 0.1mH/5A
18 1 P1 10KΩ
19 1 Q1 BTB16 BTB16-600CW
20 2 R1, R2 160KΩ
21 1 R3 1MΩ
22 1 R4 47Ω
23 3 R5, R8, R12 20KΩ
24 3 R6, R7, R10 150Ω
25 1 R9 1kΩ (NC)
26 2 R11, R13 4,7kΩ
27 2 S1, S3 Button
28 1 S2 Switch
29 1 ZD1 5,6V
30 1 ~275 VARISTOR
19/21
Revision history AN2425
Revision history
20/21
AN2425
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
21/21