AN1971
APPLICATION NOTE
ST7LITE0 MICROCONTROLLED BALLAST
Demand for flexibility is increasing in new ballast applications. If a designer can use the same ballast with different tube lamp wattages and types, savings can be made reducing logistic costs. The aim of this application note is to show designers how the ST7 microcontroller helps in the design of such a ballast. In addition, it shows how the use of the ST7LITE0 microcontroller adds some attributes facilitating design-work and improving the ballast functionality.
Figure 1 shows a diagram of the whole application.
Figure 1. Block Diagram
=400V
Half bridge Driver |
|
Power |
|
Lamp |
|
|
|
|
|||
L6384 |
|
Section |
|
|
|
|
|
|
|
||
|
|
|
|
|
|
ST7LITE0
Microcontroller
Voltage
Measurement
Current
Measurement
Rev. 2
AN1971/0106 |
1/16 |
1
ST7LITE0 MICROCONTROLLED BALLAST
This application note focuses on the lamp control and therefore a DC voltage 400V has been chosen to supply the application. To have a complete ballast connectable to the standard mains, the EVAL6562-80 board can be chosen to serve as a PFC part, between AC-mains and the 400V DC link.
In this application, voltage-fed series resonant half-bridge inverters are used to drive a fluorescent tube lamp in zero-voltage switching mode and the microcontroller handles the control of the ballast. The microcontroller drives the L6384 high voltage half bridge driver. L6384 is a small eight-pin device, with one input, selectable dead time and implemented bootstrap diode (refer to the L6384 datasheet for more information). In Figure 2, the driver and resonant tank topology are shown. Thanks to the microcontroller flexibility, existing resonant circuits can also be used.
Figure 2. Power Section Circuit
|
|
|
|
|
|
|
|
|
|
|
|
|
400V |
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
C4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
U2 |
|
|
|
|
100nF |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
1 |
IN |
Vboot |
8 |
|
|
|
63V |
|
|
|
|
|
|
|
Q1 |
|
L1 |
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10nF |
|||||
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1600V |
||
|
|
|
|
|
|
|
|
|
|
|
1W |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2/16
2
ST7LITE0 MICROCONTROLLED BALLAST
The ST7LITE0 microcontroller has been chosen as it is small and easy to use (please refer to Section 5 REFERENCES AND RELATED MATERIALS [1]). This processor has a 1.5kB flash program memory, 128 bytes of RAM and moreover it has 128 bytes of EEPROM of usable memory, for example, for storing lamp parameters. There is no need for any external clock circuitry, because it has an integrated RC oscillator with an accuracy of 1%. This oscillator provides a clock signal up to 8MHz. What makes this microcontroller a strong tool for the ballast application are the peripherals: Autoreload Timer, Lite Timer and Analog to Digital Converter. Foremost, it must be highlighted that the software drivers for all the peripherals are available in the ST7 software library (see ST7 Software Library, http://www.st.com/mcu) and you do not need to spend time to develop your own.
The Autoreload timer is a peripheral which controls a PWM output from the microcontroller. The principle of its function is shown in Figure 3. At the heart of the autoreload timer is a freerunning counter, which works absolutely independently from the processor core. For designers, there are only two important values: “Reload Value Register” and “Compare Value Register”. The counter increments its value to the maximum. When it is reached, it switches the output pin to the logical 1 (5V) and after that the counter starts incrementing again from the value stored in the already mentioned “Reload Value Register”. After each increment, the counter is compared to the “Compare Value Register”. If the match occurs, the output pin is switched to the logic value 0 (0V).
Figure 3. PWM Function
4095 |
|
|
r |
Compare Value |
|
e |
Register |
|
tn |
||
|
||
uoC |
Reload Value |
|
|
||
|
Register |
|
000 |
t |
|
|
||
Output |
|
|
pin |
|
From Figure 3, it can be seen that the control of the PWM signal is very simple with ST7LITE0 through just the two registers: by writing into the Reload Register, you select the frequency and by writing into the Compare Register you can select the duty cycle. This way, the frequency can be selected from 2kHz up to 4MHz. The incremental period change is 125ns with fclock = 8 MHz.
In addition to the autoreload timer, there is also another generic timer available. This timer (called Lite Timer) is a free running counter generating a software interrupt every 1ms. There
3/16
ST7LITE0 MICROCONTROLLED BALLAST
is a simple software trick using a variable which counts the number of these interrupts. If you want an event to occur after a certain time (e.g. switch from preheating to ignition mode after one second), you should watch this global variable and when it reaches the desired value a proper procedure is run. The time from 1ms up to the dozen of minutes can be measured this way (with the step of 1ms).
To connect the analog world to the digital core there is an analog to digital converter (ADC) implemented in the ST7LITE0. This ADC has two input ranges, the first measures the analog voltage from 0 to 5V in order to obtain a digital value ranging from 0 to 255 (8-bit resolution). The second turns on an integrated amplifier with a gain of eight, which means that it can measure the voltage in the range from 0 to 250mV. This integrated amplifier is very useful, especially when measuring the small voltage drop on the current sense resistors.
Lamp current and voltage must be measured to have complete information about the ballast circuitry. In Figure 4 and Figure 5 are the circuits used to filter the voltage on the current sense resistor. The first filter is used to obtain the peak current value and the second one to get an average current.
Figure 4. Peak Current Sensor |
|
|
|
Figure 5. DC Current Sensor |
|||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
R37 |
D4 |
|
|
|
Analog Input |
R33 |
|
Sense Resistor |
||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
8k2 |
|
|
|
|
|
||||||||||||
Analog Input |
|
|
|
|
|
|
|
Sense Resistor |
|
|
|
|
|
|
|
|
|
|
|
|
|||||||||
|
|
|
|
|
|
|
|
|
C19 |
|
|
|
|
|
10k |
||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
R38 |
|
|
|
|
|
|
|
|
C12 |
BAT46J |
|
|
|
|
|
|||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
470nF |
|
|
|
|
|
|
|
||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||
|
12k |
|
|
|
|
|
150n |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Two circuits are used for voltage measurement, similar to the current measurement. The first, used to measure a peak value, is depicted in Figure 6. It is a simple voltage divider with output in the range from 0 to 5V. To avoid an error caused by the voltage drop on the diode D3, the divider has been split into two parts. The second measurement circuit, used to obtain the voltage DC offset on the lamp, is shown in Figure 7. Because the offset can be either positive or negative the circuit has been adapted to raise the zero point to 2.5V. This means that a measured voltage smaller than 2.5V results in a negative offset and voltage higher than 2.5V gives a positive offset.
4/16
ST7LITE0 MICROCONTROLLED BALLAST
Figure 6. Peak Voltage Sensor |
Figure 7. DC Voltage Sensor |
|
|
|
|
Voltage Sense |
|
Voltage Sense |
|
|
|
|
|
|
|
||
|
|
|
|
R19 |
|
|
R14 |
|
|
|
|
|
|
300k |
|
|
|
|
|
300k |
|
|
|
|
|
|
|
|
|
300V |
|
|
|
|
|
300V |
|
|
|
|
|
|
|
R20 |
|
+5V |
R15 |
|
|
|
|
300k |
|
300k |
|
|
|
|
|
300V |
|
|
300V |
|
|
|
|
|
|
R18 |
|
|
|
|
|
R21 |
|
2k4 |
R16 |
|
|
|
|
300k |
|
|
100k |
Analog Input |
R23 75k |
D3 |
300V |
|
Analog Input |
300V |
|
|
|
|
|
|
|||
|
|
|
|
|
|
||
C10 |
R24 |
|
1N4148 |
R22 |
|
R17 |
|
68nF |
27k |
C9 |
|
|
100k |
C8 |
2k4 |
|
|
4.7nF |
|
|
|
470n |
|
|
|
|
|
|
|
|
|
|
|
150V |
|
|
|
|
|
5/16