Microcontroller Enables Digital Control in SMPS

Feb. 1, 2004
While DSPs are the primary controllers in uninterruptible power supplies (UPS) with power-factor correction (PFC), ac generation and battery management,

While DSPs are the primary controllers in uninterruptible power supplies (UPS) with power-factor correction (PFC), ac generation and battery management, microcontrollers serve secondary functions for status and command features in analog-controlled dc-dc converters. The role of digital control in power supplies continues to grow as semiconductor performance increases and prices drop, so more converters are going digital for their primary control functions. However, the transition is slow. In addition to technological and price constraints, it's challenging to merge multiple disciplines within an established field.

An inherent obstacle that impedes the growth of digital power conversion is the fact that digital and analog designers tend to speak different languages. Considering that digital is taking over our analog world, engineers must learn to work together effectively. Seamless integration of disciplines is beneficial for everyone involved, because emerging technologies create valuable opportunities in a highly competitive market. This article focuses on merging digital and analog technologies in power-conversion applications and avoiding problems along the way. Specific design examples are presented to illustrate guidelines for robust digital power control.

Converter Development

The circuit in Fig. 1 is a 12-V/5-A digital power converter that is easy to build and uses the parts list shown in Table 1. It has a minimum number of robust parts with simple interfaces. Components are available in through-hole packages for prototype development and are readily available from distributors at reasonable prices. The power stage includes high-side and low-side FETs with a gate driver that reduce EMI emissions by shortening conduction paths, provided that sufficient charge-storage capacitance is placed close to power and ground pins with heavy conductors. Protection circuitry within the power device avoids shoot-through, undervoltage, over-temperature (current limiting is highly desirable but not included).

The microcontroller integrates analog-to-digital converters (ADC) and pulse-width-modulator (PWM) for power control, in addition to the typical central processing unit (CPU) and memory found in other processors. It also contains an internal oscillator, watchdog timer, brownout reset and protection diodes to operate through tough environments. Integrating the sensitive oscillator lessens EMI susceptibility, while the other functions allow recovery from a disturbance.

Table 1. Digital power converter parts list.Find Quantity Ref Des Part Number Description Manufacturer Price * 1 1 U1 LM78L05ACZ 5-V linear regulator National Semi 0.26 2 1 U2 PIC16F818-I/P Microcontroller Microchip 1.72 3 1 U3 TDA21201-P7 Integrated switch Infineon 2.71 4 1 D1 1N5232B 5.6-V Zener diode Diodes Inc. 0.14 5 1 L1 2317-H 270-μH inductor 5.5 A J.W. Miller 1.39 6 2 C1, C2 K103Z15Y5VF5TL1 0.01-μF capacitor BC Components 0.08 7 1 C3 K104Z15Y5VF5TL2 0.1-μF capacitor BC Components 0.08 8 2 C4, C5 EEU-FC1V271 270-μF capacitor Panasonic 0.44 9 2 R1, R2 CFR-12JB-3K0 3 K resistor 1/8 W Yageo 0.02 10 1 R3 CFR-12JB-100K 100 K resistor 1/8 W Yageo 0.02 11 1 R4 77063472 (3) 4.7 K resist Net CTS 0.11 * Digikey distributor price for quantity 100. Total 7.51

Fig. 1 demonstrates a practical digital power control circuit, and the system in Fig. 2 shows hardware and software capabilities needed to facilitate development. The power board has a socket to accommodate a variety of microcontroller chips plus essential support circuitry. The power stage can be used as half- or full-bridge and includes current limiting, thermal shutdown and undervoltage lockout. The PCB contains a split-ground plane with tight layout of charge-storage capacitors, analog filters, protection diodes, current-limit resistors and isolated PC interface for robust operation in switching power applications.

An important component in the development system is the In-Circuit-Debugger (ICD), which can program and test code real-time to find errors quickly. Debuggers burden micro resources to a small degree but offer significant cost savings over emulators. Basic or C compilers tend to be faster to program than assembly language. However, execution is usually slower (more lines of code), so some assembly programming of key routines is usually required.

Firmware (software that controls hardware) development can be time consuming and frustrating, but is critical in defining the performance and features unique to each product. The circuit in Fig. 1 can be used in countless product variations, depending on the firmware programmed into the microcontroller. For example, Flextek Electronics created a patent-pending version (Part CLZD010) that satisfies a broad range of power, thermal, motion, lighting and flow applications by grounding appropriate configuration pins (without reprogramming) for each specific installation.

A challenge for those anxious to learn power-control firmware is that companies keep their code private, but many other resources are available. Microcontroller manufacturers offer detailed application notes on their Web sites that contain diagrams, description, flow chart and source code. Reference 4 describes a simple pulse-skipping algorithm for a dc-dc converter using a few dozen lines of assembly code (provided) that may be executed in a low-cost 8-pin micro (PIC12F629).

The most popular control technique is the Proportional-Integral-Differential (PID) algorithm that has the advantages of being proven and widely documented. Most analog power supplies contain an op-amp version of PID, which may not be obvious since control engineers use three op-amps for independent gain adjustment and power designers use one for economy. Reference 3 shows how to transition back and forth from software control equations to analog circuits, which may be helpful for digital or analog designers uncomfortable working in the other discipline.

Robustness Guidelines

Table 2 is a design checklist that covers a variety of technologies used in digital power control. Since a major advantage of digital control is parts reduction, power stages with internal drive and protection circuitry are often chosen. However, these easy-to-use parts still require care in their application. The inductance of long power leads can generate switching transients that exceed voltage ratings and result in damage. Sufficient thermal path must be provided with charge-storage capacitors located close to the power stage with adequate ripple-current rating.

Even a properly designed power stage will couple small amounts of energy to the controller, particularly during start-up and heavy loads. Thus, control circuitry must be designed to operate through harsh environments. Traces that terminate to board connectors are prone to transients or shorts, so current-limit resistors and input-filter capacitors close to chip pins attenuate external disturbances. A Zener diode across power pins will protect the micro from overvoltage if a connector pin is inadvertently connected to a higher voltage. Preventing power stage transients from propagating through control circuitry is essential in stopping a glitch from cascading into a catastrophic failure.

While Table 2 lists several guidelines, the bottom line is to be extremely careful and check out each section of code prior to system integration. It's essential that critical tasks, such as control updates, are executed on time and lower priority tasks, such as sending status to PC, are done when convenient. Synchronizing key events to a master clock, such as ADC sampling and PWM generation, help ensure consistent and predictable behavior. Place limits on relative changes and absolute values. For example, ramp duty cycle to avoid high inrush current and do not exceed 95% in a power stage with high-side charge pump driven by output switching.

The most important and difficult thing to look for is the unexpected. For example, the high byte of an integrator register under-flowing from 00 to FF (255 decimal), causing the converter to apply full output power when it should be at low power; noise causing repeated reset of CPU or re-triggering of external interrupts to tie up the CPU; and digital inputs sampled only once during a power switch transition, causing an invalid command to be accepted.

Many microcontrollers have PC serial ports so intuitive programs like Visual Basic make a graphical user interface (GUI) attractive. Power supplies should be electrically isolated, thus opto-couplers on PC data lines are recommended. Don't allow PC data to get in the way of microcontroller critical tasks and ensure that false commands are rejected. A subtle but common problem is for the micro to modify multi-byte data during transmission to the PC, resulting in undetected errors.

Most power engineers know that claims in data sheets cannot be accepted without question. The same is true for program code. They may effectively illustrate a specific concept without providing the safeguards required in your application. Designers are ultimately responsible for their product, so scrutinize every line of code as you would a component data sheet.

Operational Results

The Fig. 2 system was used to develop firmware for a flexible converter capable of satisfying a variety of applications in multiple disciplines without reprogramming. After development, the firmware was recompiled in the small inexpensive Fig. 1 microcontroller for production. One ADC reads the desired set point and another measures the feedback signal. The difference between the two is the error driven toward zero through adjustment of the PWM duty cycle. The timing of the control loop is set for a specific application by grounding digital input pins that have internal pull-ups.

The ac response of the digital power converter into a 5-W load is shown in Fig. 3. In addition to dc-dc conversion, this device is an effective multi-quadrant power amplifier. This converter also has been successfully applied in motion, lighting, thermal and flow systems by adjustment of loop timing through pin settings. Fig. 4 is the thermal step response of the converter driving a heater with temperature feedback through an LM34 sensor chip. The slowest setting of the digital scope was too fast to capture the envelope of the thermal response, thus the serial port of the power board in Fig. 2 was used as an isolated PC data logger to record ADC readings.

The performance of this converter is good in each application, despite the use of a low-cost microcontroller with limited resources. The chip uses its internal oscillator at 8 MHz for a 31.25 kHz PWM with 8-bit resolution. Control updates are completed every 128 μS through a 10-bit multiplexed ADC. The effective control resolution (Vsetpt — Vfeedback) is 12 bits despite 10-bit ADC and 8-bit PWM. This converter provides a lot of bang-for-the-buck because its limited resources are well used and robust digital control techniques are implemented.

The object of this effort was to develop a low-cost single-chip solution to satisfy a variety of applications quickly and easily, which is simply not feasible in analog. Extra time spent in the initial development of digital control technology pays off in the long run through repeated reuse of software and hardware modules in multiple applications. This is similar to the proven concept of Active X Controls in Visual Basic, where common functions are dropped into countless applications with appropriate setting of control parameters. A digital control chip may cost a bit more than an analog PWM chip, but that cost is recovered through fast subsequent development efforts, few parts to buy and assemble, and the ability to add features without mechanical rework.

Digital Future

Although the digital converter can do more than its analog counterpart, the cost and performance of a digital dc-dc converter doesn't yet match that of analog. But that gap is narrowing. Thus, companies and individuals with relevant skills and experience in digital power conversion will be positioned to take advantage of opportunities in the near future.

Presently, hundreds of analog power chips have been introduced that don't have interface capabilities, and current microcontrollers don't adequately address the unique needs of power conversion. Thus, the two industries must work more effectively for the power conversion industry to catch up with the rest of the technology world.

References

  1. David J. Caldwell, “Power Control: Digital Flexibility at Analog Prices,” Power Systems World '98, Santa Clara, Calif., November 1998.

  2. David J. Caldwell, “Digital Power Flexibility: Applications and Advantages,” Power Systems World '99, Chicago, November 1999.

  3. David J. Caldwell, “Analog Simulation Tools Aid Digital-Control-Circuit Designers” Electronic Design Magazine, Dec. 4, 2003.

  4. Hartono Darmawaskita, “DC-DC Converter Controller Using a PICmicro Microcontroller” Microchip Application Note AN216, 2000.

Table 2. Robust digital power control checklist.

Power Stage

Current limit, thermal shutdown, and undervoltage lockout protection
Tight switching path layout with power ground plane
Close charge storage capacitance and twisted power lines

Micro Hardware

Bypass capacitors and crystal close to micro pins with signal ground plane
Current limit resistors on pins to connectors
Pull-up or pull-down resistors on enable pins
Clamp VDD voltage for transients and polarity reversal
Filters on critical inputs with shielded wires
Split signal ground plane from power ground plane

Micro Firmware

Real-time operating system with multi-tasking and prioritized interrupts
Synchronize ADC sampling to PWM
Smooth transitions and operational limits
Digital filters and safeguards
Limit external interrupt rate
Prevent register overflow and underflow
Watchdog timer and brownout detection

PC Software

Electrically isolated PC data interface
Check sums and error detection
Safeguards to prevent inadvertent program code update
Avoid partial updates of multi-byte data

General

Do not assume that vendors have designed out all problems
Include built-in test capabilities and calibration

For more information on this article, CIRCLE 341 on Reader Service Card

Sponsored Recommendations

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!