Light Dimmer with Capsense Brightness Control

advertisement
Light Dimmer with Capsense Brightness Control
Author: Petro Koblyuk
Associated Project: Yes
Associated Part Family: CY8C21x34, CY8C24x94
GET FREE SAMPLES HERE (CY Sample Request Form for all Product Lines)
Software Version: PSoC Designer™ 4.4
Associated Application Notes: AN2302, AN2394, AN13943
Abstract
Sometimes there is a need to regulate the incandescent lamp brightness to gain more comfortable and pleasant room lighting.
This Application Note describes the Light Dimmer for smooth incandescent lamp brightness control. User adjusts the lamp
brightness level by touching the CapSense slider. Dimmer includes the LED bar graph to display actual brightness as
additional feature.
Introduction
Triac Control
The modern lighting systems allow controlling brightness
smoothly to obtain more comfortable and pleasant room
lighting. Some popular devices use potentiometer with triac
phase control technique for lamp brightness regulation. The
proposed dimmer uses a touch-sensitive control to enable
the user to control brightness in the convenient, easy and
understandable way.
Design demonstrates the PSoC ability doing more than only
Capsense: one chip is used for capacitance sensing, lamp
power phase control, AC frequency calibration for worldwide use, multiplexed LED bar graph driving with night slight
backlight.
Table 1 shows the technical specification of the Light
Dimmer.
Triac
110-220V,
AC~
Lamp
Figure 2. The Timing Diagram of Lamp Power Phase
Control
AC 110-220V
t
AC
Zero Crossing
t
Triac TurningOn Pulses
t
Lamp
Waveform
t
Table 1. Light Dimmer Specifications
Characteristic
Value
110 – 220 V, 47 – 63 Hz
AC Supply
Depending on triac,
200W for current design
Lamp Power
CapSense Slider Overlay Thickness
Quantity of Brightness Levels
1
1 mm – 6 mm
17
Notes
1. The silicon glass, ABS, plexiglass can be used for overlay. The slider
segments dimensions should be adjusted accordingly to the overlay
thickness.
Power Phase Control
The Light Dimmer uses the principal of power phase control,
which is easy in implementation. The phase control
operation principle lies in controlling triac turning on phase
within AC supply period. Figure 1 shows the typical triac and
lamp interconnection circuit. The delay variation between
AC Zero Crossing signal and triac turning on time is used to
control the amount of power provided to lamp, see Figure 2.
Figure 1. Typical Interconnection Circuit of Triac and Lamp
January 10, 2008
Delay 1
Delay 2
Delay 3
Light Dimmer Block Diagram
The Light Dimmer consists of the following blocks: AC zero
crossing detector, PSoC’s CPU core for general control,
power supply, CapSense slider for load power control, LED
bar graph (see Figure 3).
Figure 3. Light Dimmer Block Diagram
Document No. 001-08990 Rev. *B (AN# is same as last 5 digits of doc #.)
1
Error! Reference source not found.
triggering prevention when noised AC signal is close to zero,
the D4 limits the reverse voltage applied to Q2 base-emitter
junction, R17 is zero-crossing detector pull-up. The zerocross detection operation is shown on Figure 4
AC~
AC Zero
Crossing
Power Supply
220V AC to 5V DC
Figure 4. The Timing Diagram of “Zero Crossing” Signal
Vcc
Zero Crossing
PSoC
110-220V, AC ~
Lamp
t
Triac Control
User
Interface
Capsense
Slider
LED Bar
Graph
Zero Crossing
t
Dimmer Hardware
Figure 5 shows the Light Dimmer schematic. The R4…R7
resistors are used for limiting of Q2 base current, C9 and
R4…R7 form the LPF for zero-crossing detector false
Figure 5. Light Dimmer Schematic
POWER BOARD
R1
Power Supply
+11.5V
C1
0.1uF
F1
FUSE
J2
12k 1%
4
D2
1N4007
1
2
5
AC main con
+
3
B
F
P
B
D
U1
S
S
S
S
R2
2k 1%
+
2
1
8
7
C2
10uF 35V
L1
1mH 280mA
VCC
U2 LP2950/TO92
3
LNK304
D3
UF4005
C3
4.7uF 400V
R3
+ C4
IN
D
N
G
C5
1
OUT
C6
C7
1uF
0.1uF
2
3.3k
Triac Control
+5V
D1
1N4007
100uF
AC Zero Crossing Detector
1uF
VCC
Q1
MAC15
R17
4.7k
ZeroCrossing
J1
1
2
R5 107k 0.5W
R7 107k 0.5W
Q2
BC847
Lamp con
R4 107k 0.5W
C8
0.47uF
R6 107k 0.5W
R 10
10E
C9
470pF
D4
LL4148
TriacControl
CAPSENSE BOARD
CapSense Slider
SEGMENT1
SEGMENT2
SEGMENT3
SEGMENT4
SEGMENT5
SEGMENT6
SEGMENT7
SEGMENT8
SEGMENT9
PSoC's CPU Core
R 24
R 15
R 18
R 19
R 20
R 21
R 22
R 23
R 16
1k
1k
1k
1k
1k
1k
1k
1k
1k
sl0
sl1
sl2
sl3
sl4
sl5
sl6
sl7
sl8
VCC
C10
LED Bargraph
0
X
D
E
L
1
X
D
E
L
2
X
D
E
L
3
X
D
E
L
R11
255E
R12
255E
R13
255E
R14
255E
D20 LED
D11 LED
D15 LED
D19 LED
LED
LED
LED
LED
2 1 0 9 8 7 6 5
3 3 3 2 2 2 2 2
s 3][ 5][ 7][ d 6][ 4][ 2][
s
d
V 0 0 0 V 0 0 0
P P P
P P P
1
2
3
4
5
6
7
8
Y3
Y2
Y1
Y0
ZeroCrossing
TriacControl
P0[1]
P2[7]
P2[5]
P2[3]
P2[1]
P3[3]
P3[1]
P1[7]
D8 LED
D12 LED
D16 LED
D9 LED
D13 LED
D17 LED
D7 LED
D10 LED
D14 LED
D18 LED
sl8
sl7
LED
sl6
sl5
sl4
LED
LED
sl3
sl2
sl1
LED
sl0
X3
X2
X1
X0
9 0 1 2 3 4 5 6
1 1 1 1 1 1 1
LED Y 1
D6 LED
U3
CY 8C21434
P0[0]
P2[6]
P2[4]
P2[2]
P2[0]
P3[2]
P3[0]
XRES
24
23
22
21
20
19
18
17
] ] ]
] ] ] ]
5[ 3[ 1[ s 0[ 2[ 4[ 6[
1 1 1 s 1 1 1 1
P P P V P P P P
LED Y 0
D5 LED
0.1uF
LED Y 2
R26
2k
C13
0.1uF
L
C
S
A
D
S
LED Y 3
January 10, 2008
Document No. 001-08990 Rev. *B (AN# is same as last 5 digits of doc #.)
2
Error! Reference source not found.
Power Supply
A dimmer power supply is implemented using the
transformer-free switching DC-DC regulator, type LNK304
from Power Integrations [1]. The F1 self-recovered fuse
serves two functions: it protects from possible over
currents and its resistance (about 8 Ohms) limits the C3
inrush current at power-on. The values of R1-R2 divider
define the U1 regulator output voltage, it is about 11.5 V.
The U1 output voltage can vary with input voltage change
and load current variations. Usage of CapSense requires
stable PSoC power supply [2]. That is why the additional
U2 linear regulator has been used to form the clear 5 V
supply.
Triac Control
Triac is driven by short pulses for power consumption
optimization. These pulses are generated by PSoC and
are differentiated by C8R10 network. Triac is turned on by
series from 3 pulses, see Figure 6. At full brightness triac
turning on time is some delayed from zero-crossing event
to guarantee reaching the minimum triac turning on
voltage. This scheme provides stable operation if AC
mains signal is noised.
t
Zero Crossing
LED Bar Graph Control
Dimmer uses multiplexed LED control to drive 16 LED
using only 8 PSoC’s pins. LEDs control occurs on four
phases. On each phase only one appropriate LEDs row is
turned-on. The row switching time base is formed by CSD
sensor scanning time taking into account that scanning
time is constant. The LED control state machine switches
each row after each slider segment scanning for getting
high refresh rate (about 250Hz) and it prevents the visible
bar graph flickering. In each LED scanning cycle all LED
are turned on for 3 us by using the software delay routine
for providing low-intensity night backlight for all LED.
Lamp Light Intensity Linear Control
The incandescent lamp power is not linearly proportional
to the triac turning on delay (see Figure 7) due sinusoidal
AC mains current waveform nature.
Figure 7. Lamp Power vs. Triac Turning on Delay
Lamp
Power, %
Figure 6. The Timing Diagram of Triac Control
110-220V, AC ~
duration and 170us interval between them. After 3 pulses
generation PWM disables itself and is re-enabled by
following zero-crossing interrupt.
t
100
50
0
t
Threshold
t
110-220V, AC ~
T/8
T/4
3T/8
T/2
Note: In Figure 7 the “T“ is equal to AC mains period.
Zero Crossing
t
Triac Control
t
340µs
170µs
3 pulses
Note: In Figure 6 the “Triac Control” signal at minimal
delay i.e. at the maximum brightness level is shown.
The human eye has logarithmic visible brightness vs. lamp
brightness; also lamp visible brightness is non-linear
function from applied voltage RMS value via variation
lamp resistance due lamp coil temperature change.
To provide linear visual lamp brightness change, a nonlinear lookup table (baConst array in C code) has been
used. This table has 17 entries and Figure 8 shows a
lookup table graph. Customers can adapt this table per
need.
Dimmer Firmware
Triac Control
The controllable delay between zero-crossing signal and
triac turning on is used for lamp brightness control. The
delay is generated by PWM8 user module for low-jitter
operation. The both edges of zero-crossing signal are
used for interrupt triggering. The interrupt handler restarts
the PWM with appropriate period value, depends on
required delay. Initially PWM generates a first pulse with
delay, set by expected brightness level. Once delay
interval expiration, the PWM registers are reloaded for
generation series triac turning on pulses with 340us pulse
January 10, 2008
Document No. 001-08990 Rev. *B (AN# is same as last 5 digits of doc #.)
3
Error! Reference source not found.
connectors, located at the opposite board sides. The PCB
Gerber files are provided in the supporting archive
together with PSoC project can be used for PCB routing
reference. Figure 9 shows different Light Dimmer photos.
Tdelay
T/2
Figure 9. Light Dimmer Photos
3T/8
a) Front View
T/4
T/8
0
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Nslid
b) Back View
Figure 8. Triac Turning on Delay vs. Slider Position
AC Mains Frequency Calibration
There are several frequency AC standards in the world;
some countries use 50Hz frequency, other 60Hz. For
dimmer operation ability worldwide without any manual
adjustments, the additional calibration procedure is
implemented. This procedure measures the actual AC
mains frequency and calculates a scale coefficient to
transform the lookup table array in the actual triac turning
on delay values. The calibration procedure is initiated
once after dimmer power up.
c) Side View
Calibration takes in three stages. At first stage the duration
of AC half period is measured using a CSD UM counter
block. The 32 measurements are taken, averaged value is
calculated. For this purpose a CSD is manually
reconfigured by re-routing counter enable signal from
comparator bus to zero-cross detector output.
At the second stage the scale coefficient is calculated as
relation of measured period (TC) to expected period (TC50)
for 50Hz AC:
T
K= C
TC 50
Equation 1
At third stage the triac turning on delay table (baConst) are
scaled by coefficient K.
Dimmer Mechanical Construction
The dimmer is composed from two boards. The LED array
and Capsense slider are placed on the first board, only
SMT components are placed on this board. The reverse
mount LEDs were placed in the slider segments.
The power supply, zero-crossing detector, triac and screw
power/lamp connectors were placed on second board. All
through hole components were located on this board as
well. The boards were connected together using 2
January 10, 2008
Safety Warnings
The Light Dimmer does not have galvanic isolation from
AC Mains Line. Plastic overlay should have thickness
more than 2mm for user electrical shock preventing.
Please newer touch PCB or dimmer components when
supply voltage is applied. For device debugging and
testing, please use the isolation transformer or galvanically
isolated scope probes.
Possible Modifications
Some customers are willing optimizing the dimmer price
for cost sensitive applications. The most expensive part is
switching DC-DC converter. To reduce BOM amount, the
power supply can be redesigned by using the simplest
capacitive
current
source,
see
Document No. 001-08990 Rev. *B (AN# is same as last 5 digits of doc #.)
4
Error! Reference source not found.
Figure 10.
Figure 10. Simplified Power Supply
C1
0.47uF 400V
R1
47 Ohm 0.5W
VCC
4
J1
1
2
3
6.8V
up to 20 mA
D1
BRIDGE
-
+
1
AC
D2
6.8V
+ C2
470uF 25V
2
In this case the total current consumption should be
reduced to 25mA by supplying smaller currents to LED
array and reduction the LED amount. The C1 capacitor
value should be selected accordingly for AC voltage (110
or 220V), the provided value was intended for 220V
supply.
Note: for successful passing of EMC tests a AC Mains
filter can be required if radiated noise due triac turning on
is too large.
Alternative Dimmer Applications
Originally, dimmer has been designed for incandescent
lamps control. Without any modifications device can be
used for control speed of universal motors in various
applications, as electric drill, pumps, air-conditioners,
kitchen machines, etc. That is good chance to replace the
potentiometers with capsense control.
Appendix
January 10, 2008
1)
LNK304 datasheet,
http://www.powerint.com/linktnproduct.htm
2)
CSD UM datasheet
Document No. 001-08990 Rev. *B (AN# is same as last 5 digits of doc #.)
5
Error! Reference source not found.
About the Author (optional)
Name:
Petro Koblyuk
Title:
Application engineer
Background:
Petro
graduated
from
National
University
“Lviv
Polytechnica”
(Ukraine) in specialty ‘computer
systems’ in 2001. Working in the
Ukraine Solution Center since 2005.
Contact:
Petro.Koblyuk@cypressua.com
Document subject-specific trademark information, if any.
Example - PSoC is a registered trademark of Cypress Semiconductor Corp. "Programmable System-on-Chip," PSoC Designer, and PSoC
Express are trademarks of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of
their respective owners.
The blue bar and the information below it are placed at the bottom portion of the page.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone: 408-943-2600
Fax: 408-943-4730
http://www.cypress.com/
© Cypress Semiconductor Corporation, 2007. The information contained herein is subject to change without notice. Cypress Semiconductor
Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any
license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or
safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as
critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The
inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies
Cypress against all charges.
This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide
patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a
personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative
works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress
integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source
Code except as specified above is prohibited without the express written permission of Cypress.
Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the
right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or
use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a
malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems
application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.
January 10, 2008
Document No. 001-08990 Rev. *B (AN# is same as last 5 digits of doc #.)
6
Download