Today's design engineers are faced with new challenges when it comes to designing fluorescent or HID electronic ballast applications. In addition to the usual cost, reliability and longevity pressures, designers are now challenged to provide enhanced end-user functionality such as remote dimming control, while also meeting more stringent domestic and international lighting regulations.
Traditional discrete analog design techniques can still accommodate many of these new requirements. However, today's generation of low-cost, 8-bit Flash-based microcontrollers (MCUs) offer many system advantages for implementing low-cost, high-resolution, digital electronic ballast-control designs that meet regulations. In particular, these MCUs ease digital inverter control and integration of power factor correction (PFC).
Electronic Ballast Control
Fig. 1 shows the basic building blocks found in most electronic ballast-control applications. The major blocks include an electromagnetic interference (EMI) filter, a full-wave rectifier, an active PFC front end, a digital control section and a resonant lamp output stage.
The EMI filter blocks ballast-generated noise from being transmitted back onto the power lines. The full-wave rectifier converts the ac source to a dc voltage supply, which can be controlled by the other blocks. Normally some sort of PFC circuitry is used for sinusoidal input current control and generation of a regulated dc bus voltage. The ballast-controller section provides frequency modulation control (usually by a pulse-width modulated [PWM] signal) of a traditional R-L-C-type resonant-output circuit for preheating, igniting and ballasting the lamp.
This R-L-C resonant-output stage easily adapts to a wide variety of lamp types. If an embedded MCU-based circuit is used for the digital control section of the design, it can provide the necessary circuitry and software to perform closed-loop dimming, lamp fault detection, shutdown and auto restart. Today's embedded MCUs also can be easily connected to standard communication interfaces such as the digitally addressable lighting interface (DALI), or other RS-232-type or synchronous serial interface buses such as I2C or serial peripheral interface for remote control and monitoring.[1]
Notice in Fig. 1 how there is no current flowing through the fluorescent tubes, and the impedance seen by the ballast controller is nearly infinite when the lamp is off. To turn the lamp on, the voltage across the electrodes must reach a high enough voltage for the highly ionized gas mixture to arc across the two lamp terminals. This maximum voltage is called the strike voltage (VSTRIKE value). Once the lamp starts conducting, the voltage should be reduced to a lower steady-state voltage (INOM).
To better understand this ballast-controller circuit, it's necessary to review what is needed to power a typical low-pressure fluorescent lamp. The electronic ballast circuit must perform the following basic functions. First, they must provide a high enough strike voltage across the lamp's electrodes. Then, when the lamp is on, the circuit must maintain a constant current while operating in the steady state. Next, the electronic controller must compensate for fluctuations and fault conditions on the dc bus supply through the inverter circuit. This ensures a stable light output and the longevity of the lamp. Finally, the ballast circuit must comply with applicable domestic and international regulations.
New digital lamp ballast designs can include additional features such as dimming capabilities, end-of-life monitoring, startup fault detection or tube-removed indications. Different lamp tubes require different settings, which are easily controlled in digital designs via software settings stored in the MCU's nonvolatile memory. These MCUs can also adjust the required lamp settings to ensure maximum efficiency over the lamp's lifetime. For example, the strike voltage may need to be increased or the steady-state voltage slightly varied while in a steady on-state.
Digital Inverter Control
The half-bridge power inverter and R-L-C resonant tank circuits control the voltage across the fluorescent or HID lamp's electrodes. More accurate control on the PWM signals that drive the inverter MOSFETs enables better output-voltage control. High-resolution steps on the PWM module give better linear-frequency control, especially between 40 kHz and 120 kHz. This ensures that enough voltage is provided across the electrodes to turn on the fluorescent or HID lamps and help provide a stable steady-state voltage.
Most 8-bit MCUs targeted for these types of applications have a 10-bit hardware PWM module onboard that can easily be configured on the fly through software. The biggest problem is that these PWM modules typically have a wide operating-frequency range, which can limit the accuracy or resolution of frequency steps between the previously mentioned range of 40 kHz to 120 kHz.
Finer steps can be achieved using simple software-controlled dithering techniques in conjunction with a 10-bit hardware PWM peripheral. The MCU can implement this dynamic software frequency-dithering control scheme for visually improved lamp ballast dimming features. The 8-bit MCU's various integrated hardware peripherals, such as PWM peripherals or software-configurable analog comparators, together with advanced software techniques makes them well suited for this application.
PFC Implementation
The input of a PFC stage appears as a resistive load to the ac source and provides a regulated dc output voltage, which is usually fed to an additional buck converter stage. One method for achieving PFC is based upon proportional current control. This system operates in continuous-conduction mode with a variable switching frequency (30 kHz to 100 kHz). The PFC control algorithm includes two control loops: one fast loop for input current control and one slow loop for control of the dc output voltage.
The output-voltage controller is implemented digitally using the MCU's processor and analog-to-digital control (ADC). Under control of the processor, data from the ADC is used to modulate the PWM, the output of which establishes the ratio between the instantaneous ac input voltage and the desired instantaneous input current.
The desired input current is then represented as a voltage and fed to an analog comparator in the current-control loop. Several digital and analog peripherals found on the PIC16F8XX MCUs, including a comparator and PWM controller, can be used to implement the proportional continuous current mode (CCM) control technique.
MCUs
Two functions where low-cost 8-bit embedded MCUs can be used in electronic ballast control are PFC and precise driving of the electronic ballast power inverter. Many of these MCUs integrate analog circuitry such as analog comparators and multichannel ADCs. This circuitry is typically combined with digital peripherals such as digital PWM modules. All of this circuitry is placed under firmware control, which can be made to control traditional analog systems.
In addition to these analog blocks, several embedded MCUs also have enhanced universal synchronous-asynchronous receiver transmitters or master serial synchronous port communication hardware peripherals. This provides many possible communication interfaces, including those for remote control and making the ballast design more modular and flexible.
Increasing PWM Resolution
A simple software technique enables all PIC MCU PWM modules to support different classes of applications, including several lighting applications where the duty cycle must be constant and the output frequency can change only in very small increments.[2]
For example, in fluorescent and HID electronic ballasts, the frequency variation is used to control the impedance of an inductor (the ballast) in series with the lamp. To keep the ballast inductor small (for lower cost and size), the switching frequency must be relatively high — typically in the range of 40 kHz to 120 kHz. To enable optimal control of the current through the lamp, the frequency must be controlled in small increments while maintaining a fixed 50% duty cycle.
Fig. 2 shows a block diagram of a typical Microchip PIC MCU's Capture and Compare and Enhanced Capture and Compare PWM modules (CCP and ECCP, respectively). Each time the 8-bit timer value in Timer 2 (TMR2) equals the period-register value (PR2), a new cycle is started, the PWM output is set (output high) and the timer is reset. Each time TMR2 equals the CCP duty-cycle register (CCPRxH), the PWM output is cleared (output low). The necessary flexibility to control the PWM frequency is therefore provided mainly by the TMR2 module structure.
The table shows typical output frequencies achievable around 100 kHz, as well as the impact of the PR2 register value on the actual PWM period. Unfortunately, if this 10-bit PWM module were used in dimmable electronic ballasts, the resolution would not be sufficient to provide a smooth dimming effect, especially at the low range of the lamp-intensity scale where the human eye is the most sensitive.
In order to provide steps of about 60 Hz, a commonly used reference value, with a digital PWM peripheral, the clock frequency needs to increase by a factor of 16, which can be a costly and technically challenging solution. A simpler and less expensive solution can be adopted using the timer-interrupt mechanism associated with the CCP/ECCP modules and only a few lines of firmware code.
The basic idea consists of considering groups of 16 PWM periods at a time and alternating between two discrete frequency values (two contiguous values of the PR2 register). For example, by alternating eight periods of PR2 equals 100 with eight periods of PR2 equals 99, we obtain an average frequency of 100.5 kHz. By using other ratios of 1 to 16 up through 15 to 16, we can produce 14 intermediate steps equally spaced by about 64-Hz increments, between the 100 kHz and the 101.01 kHz. In this lighting application, the human eye will naturally integrate the luminous output and perceive it as though the overall frequency resolution was, in fact, increased by a factor of 16.
The simplest algorithms suitable for implementing such mechanisms use a counter and perform several cycles equal to the desired fraction at the lower frequency (T1), followed by the complementary number of cycles at the higher frequency (T2) as shown in Fig. 3. To obtain the evenly spaced distribution of periods, a 4-bit accumulator is used and, at each cycle, the chosen fractional value (1 to 15) is added to it. If a carry is generated, the following period will have the duration of T1. Otherwise, it will be at the base value of T2.
With the combination of basic software timer-interrupt techniques and the 10-bit hardware PWM module available on many MCUs, it is easy to generate a composite frequency signal resulting in the same continuous dimming effect as a high-resolution variable-frequency digital signal. Using the interrupt mechanism built into the CCP module, a 100-kHz signal can be effectively adjusted in steps of 64 Hz, while still only using a small percentage of the available MCU instruction cycles.
Digital Voltage Scaling
To implement PFC based on proportional current control, it is necessary to generate a reference waveform that is in phase with the sinusoidal input voltage from ac mains. One method for doing this is to use a PWM output driving into a low-pass R-C filter (Fig. 4) and then varying the PWM output based on a lookup table stored in the MCU's memory to produce the desired amplitude and frequency. This is a resource-intensive method of generating an analog reference signal. It is also difficult to adapt this method dynamically as part of the software feedback loop.
An alternative method for controlling a linear signal is to digitally scale the analog signal's amplitude. For example, the PFC circuit scales the incoming ac voltage waveform to generate a reference signal for the initial boost section of the converter. This scaling keeps the current through the ac line proportional to the voltage, and the converter's ac input appears resistive.
For this electronic ballast-control application, the converter also must scale the reference value based on the intermediate dc voltage at the output of the converter, so the implementation of PFC requires a method for controlling the scale factor applied to the ac input voltage that it uses to derive its current reference signal.[3]
A digital potentiometer is the simplest method to accomplish digitally controlled scaling of an analog signal. However, for lower frequency analog systems operating in the range of the ac input voltage supplied to the electronic ballast controller, an alternative method utilizing the MCU's CCP can be used.
This method uses a low-pass R-C filter whose resistance is equally divided with a single tap, which is connected to a MOSFET transistor. A digital PWM output drives the gate of the MOSFET (Fig. 5). The low-pass filter's corner frequency must be approximately 100 times the maximum frequency of the analog-power signal, such that the filter's response characteristics will not adversely affect the signal's amplitude or phase.
Similarly, the PWM frequency must be around 200 times the R-C filter's corner frequency, such that the PWM frequency will not pass an appreciable amount of energy through the filter.
The circuit in Fig. 5 periodically grounds the incoming signal by modulating MOSFET Q1 using the PWM signal. This has the effect of scaling the original analog signal that passes through to the output of the filter. The scaling factor is adjusted by varying the PWM duty cycle, which is under control of the firmware running on the MCU.
The portion of the first-order low-pass filter consisting of R2 and C1 strips out the high-frequency PWM signals and smooths the signal to its original sinusoidal shape. The result is a simple analog scaling of the ac input voltage that uses only a few passive components — a transistor and a common digital PWM peripheral.
However, there are some limitations associated with this technique that must be observed. First, the analog signal's maximum frequency harmonic must be less than the R-C filter's corner frequency to prevent signal distortion. Second, the higher the PWM frequency relative to the R-C filter's corner frequency, the more the filter will attenuate the PWM frequency. Thirdly, because the resistance of the filter is split into R1 and R2, the actual corner frequency seen by the PWM signal is two times the frequency seen by the analog signal.
Software Voltage Control
The one missing portion of this design is feedback between the power inverter's output and the electronic ballast controller's PFC block. This feedback is easily achieved by measuring the dc bus output voltage using one of the ADC channels, and then feeding this information back to the PWM controller that determines the ratio to be used for digital scaling of the analog input voltage within the PFC block (Fig. 6).
Instead of only using a direct linear correlation between the output voltage and the scaling ratio applied to the analog input voltage, the ADC measurement can be fed into a sophisticated software proportional-integral-derivative loop filer. This enables better and smoother closed-loop control. Other parameters such as the lamp's overall current consumption also can be sampled using ADC channels on the MCU.
Fig. 7 shows the important signals in the overall design of an electronic ballast that uses a MCU for the PFC control, the current-control feedback loop and the frequency control of the power inverter (having an effective resolution of 64 Hz).
The PIC16F88X samples the PFC block's output and determines what frequency adjustments to the PWM output driving the digital/analog scaling circuit are needed. This application also uses the ECCP module's interrupt mechanism, which can adjust the drive signals for the half-bridge power inverter with small frequency steps by means of a simple software-dithering scheme.
This ballast design uses a MCU to eliminate the need for a separate PFC controller and only requires a few low-cost passive external components. Also, through the combination of simple software and hardware techniques, the resolution available in the integrated 10-bit PWM module has been increased. The design provides an example of how the integration of digital and analog circuit functions within 8-bit MCUs can enhance functionality or improve overall light-system performance.
References
-
Fosler, Ross, Microchip Technology Inc.; and Contenti, Cecilia, and Ribarich, Tom, International Rectifier, “Digitally Addressable DALI Dimming Ballast,” Microchip Technology Application Note AN809.
-
Di Jasio, Lucio, “A Technique to Increase the Frequency Resolution of PIC MCU PWM Modules,” Microchip Technology Inc.
-
Curtis, Keith, “Bit Bashing,” Microchip Technology's micro-Solutions e-Newsletter, November 2006.