Students in grade school are usually taught square roots before or during junior high, and with these lessons comes one immutable fact: It’s forbidden to take the square root of a negative number. Not too much longer after that, however, the students all learn that this is a big fat lie and that taking square roots of negative numbers is critically important in many fields of study.
There’s a similar “lie” in existence for anyone studying electricity, whether they’re physicists, engineers, or electronics enthusiasts: it’s only possible to raise and lower voltage levels on alternating current (AC) circuits using a transformer. If you generate direct current (DC) voltage through the use of a generator or a battery and need a different voltage level for your new power distribution system in New York or your battery-powered electronics, well, you’re out of luck.
Of course we all know that DC-DC conversion, like taking square roots of negative numbers, is not only possible but fundamental to most modern electronics. After all, there are certain integrated circuits that we can drop into our projects to magically transform one DC voltage to another DC voltage without thinking too much about the problem. And we’re not just talking about linear regulators, which can only drop the source voltage to a smaller level by dissipating energy. Using switch mode DC-DC converters, it’s possible to decrease or increase a DC voltage, and do it at around 95% efficiency or higher for some applications (compared to around 30% efficiency for any linear regulator). But unraveling the mystery of how switch-mode power supplies (SMPS) and other DC-DC converters work, and how they’re different from AC transformers, involves diving a little deeper.
Getting Past Mechanical Generation
Part of the reason that we learn that voltage transformation is only possible using an AC system is historic: It used to be very difficult (and impractical) to convert one DC voltage to another. Before the invention of the transistor ushered in our modern age of cheap electronics, essentially the only way to accomplish this task (besides bizarre and esoteric methods beyond the scope of this article like the mercury arc rectifier) was through the use of a motor-generator set. In this setup, a DC motor drives a separate DC generator that is configured for a different voltage level. Besides being exceptionally inefficient, it’s also impractical for everything but the largest applications. Imagine if each voltage in your computer needed a separate motor-generator set to operate properly!
Instead, we can use switch mode power supplies. At the core of most of these power supplies is an inductor and a switch. Inductors resist changes in current, and will do everything in their power to keep the current that flows through them at a constant level. If the current is switched off, an inductor will raise the voltage in the circuit briefly in a desperate attempt to keep the current flowing at the same rate that it was before. This is why you see a spark when you unplug a vacuum cleaner without turning it off; the vacuum’s motor (essentially a big inductor) doesn’t like when you change the current that is flowing through it, and the resulting spark at the outlet is a result of the voltage spike that is produced. If we do this switching operation thousands of times every second in a controlled manner (hence “switch mode”), and do a little bit of filtering, we can maintain that voltage increase and do something useful with it. This circuit forms the basis of a switch mode power supply called the boost converter.
A simple boost converter. Above: When the switch is closed energy from the source is stored in the inductor. Below: When the switch is opened, the stored energy flows to the load at a higher voltage than the source. The capacitor helps smooth the output DC voltage, and the diode prevents this higher output voltage stored in the capacitor from pushing energy backwards through the circuit when the switch is closed.
Depending on the configuration of the circuit, the output voltage can be huge compared to the input voltage. In fact, the ignition coil in a gasoline-powered vehicle uses a similar mechanism to step the 12V from the battery to around 20,000 V needed to create the spark in the combustion chamber. In a switch mode power supply, the output voltage is dependent on the type of inductor used, the input voltage, and, most importantly, the impedance of the load. If the impedance changes, the power supply’s controller must change the duty cycle of the switch. At its simplest, a lower duty cycle will result in less energy being sent to the load, whereas a higher duty cycle will result in more. Essentially, regulating the duty cycle is how the power supply is able to precisely control the output voltage.
There is a limit to this, though, since a 100% duty cycle would result in a short circuit, and typical SMPS units don’t get too close to this limit for reasons beyond the scope of this article. The important thing to note is that if the energy required by the load changes for any reason, the SMPS has to immediately change its duty cycle to maintain an appropriate output voltage. Remember that the switching frequency is very high: often in the kilohertz (and sometimes megahertz) range. As a result of all of these properties, SMPS units can get complicated and expensive.
What Goes Up Also Goes Down
By changing the circuit around slightly we can decrease the output voltage rather than increasing it. Such a circuit is called the buck converter. You might be wondering why anyone would do such a thing, though, when we could just throw a LM317 or similar linear regulator in to drop the voltage down. While linear regulators are much simpler and cheaper, buck converters are much more efficient and don’t dissipate as much heat. And, to take this a step further, we can make another change that allows us to get virtually any output voltage for a given input voltage, whether it’s higher or lower.
Since engineers are terrible at naming things, this type of circuit is called a buck-boost converter. They’ve become really easy to use thanks to Integrated Circuit designs that require just an external inductor and some capacitors. The main image of this post is a great example. It’s a Pololu 5V regulator that can step up from voltages as low as 2.7v and down from voltages as high as 11.8v, all at above 90% efficiency. The chip being uses is a Texas Instruments TPS63061 whose functional diagram is shown below.
There are a few downsides to using switch mode power supplies, especially if you think it’s a good idea to build your own from scratch. First of all, they can get complicated. Something has to produce the switching signal for the switch (which is usually a transistor of some sort). This can be a 555 timer if you’re skilled at hardware design, but is usually a microcontroller of some sort. And the programming needs to be spot-on too because a mistake can result in voltage levels that are extremely high which can lead to your project (including power supply) releasing all of its magic smoke. In addition, other failures of switch mode power supplies tend to result in a short circuit which can easily cause damage. A quality fuse can go a long way in this situation.
Besides increases in complexity and the potential for damage, the high switching rates and non-linear nature of these circuits cause a huge amount of harmonic distortion and other electrical noise to be transferred back to the source power supply. For a commercial power supply (such as those found in most computers) this adds an additional layer of complexity (and further increased costs) due to the filters required to improve the power quality of these devices. Non-regulated power supplies, such as those one might build from scratch on a workbench, typically don’t implement these filtering schemes, but any user should be aware of the problems that electrical noise can transmit to other systems using the same power source.
While any power supply topology has its downsides, the upsides of switch mode power supplies are incredible. Besides the efficiency gains over linear regulators, and being able to achieve an otherwise impossible step-up DC-DC transformer, we can do other things that are otherwise very difficult to do. One of the biggest advantages are the ease at which we can do impedance matching, which is finding the precise voltage and current that will transfer the most power to the load in the most efficient way possible.
The best example (outside of radio frequency applications) for using an impedance matching circuit is the circuits that are used to handle the power that is produced from a solar panel. Imagine a simple setup with a solar panel and a battery. If the sun is out in full brightness there’s no problem connecting the solar panel straight to the battery. There will be enough voltage to charge the battery without any issue. A problem arises when it gets a little cloudy, and the panel no longer has a higher voltage than the battery. The panel is still producing a little energy, but the impedance of the battery is too high for this energy to get delivered to it.
We can solve this problem by using two switch mode power supplies side-by-side. The first part of the circuit will step up the voltage of the panel, no matter what it is, to a higher voltage. The next part of the circuit will step the voltage back down to a level that matches the voltage on the battery. A great example of this is Debasish Dutta’s Solar Charge Controller entry in last year’s Hackaday Prize.
Even in full sunlight this type of circuit is more efficient because the impedance of the panel (regardless of the amount of sunlight) and the impedance of the battery are matched, so the most possible energy available at the panel can flow to the battery. Such a circuit is the basis for maximum power point tracking circuits. An added bonus of this circuit is that it helps deal with the nonlinear IV curve of a solar panel which results from solar panels producing less current at higher and higher voltages.
Another place that a switch mode power supply is exploited for its efficiency gains is aboard the International Space Station. Of course power is produced by solar panels, but the entire space station uses a DC power distribution system with many different voltages. The different voltage levels are easily achieved using switch mode power supplies, and the batteries that power the station when it’s on the dark side of the Earth also benefit from the use of these highly efficient power converters.
In the future it may be more economical to use these power supplies for bulk transmission of electric power via DC. The efficiency of these circuits rivals the efficiency of AC transformers, and an argument could be made that if Edison had switch mode power supplies at his disposal, he would have won the War of Currents. We already have high-voltage direct current transmission, and using switch mode power supplies or other types of choppers may eventually be feasible. We’ve even talked about having an all-DC house, too, which would involve similar applications of this technology.
They’re Taking Over
Switch mode power supplies aren’t used exclusively for high-tech applications like green energy or spaceflight, though. The cost for the control electronics has plummeted in the past few decades, and now these power supplies can be found anywhere, from wall warts to computer power supplies, televisions, cars, and hobby electronics projects. Even the legendary joule thief is a special type of switch mode power supply. So next time you’re building a project remember that it’s not too difficult to add a switch mode power supply to it if you have an extra pin on your microcontroller. You might even be able to benefit from the other properties of switching power, like following an IV curve on a solar panel, or maybe something no one’s though of yet!
[Main image source: Pololu 5V buck-boost converter]