The Classroom

Part 2: The Switchmode Power Supply

Bob Harper

Issue 12, June 2018

SMPS (Switch Mode Power Supplies) rule today, but have been around much longer than you might think.

The first switch mode power supplies I saw were almost completely transistor-based. The transistors were even more obvious when there were no large transformers to hide behind, but the transformers were still laminated iron and the frequencies quite low.

We tend to think that modern electronics is new, that old technology couldn’t do what ICs and microcontrollers can do, but having worked on electricity for a long time, I can tell you that the electronics may have made life easier, but electronics didn’t invent life.

FLUORESCENT INVERTER

In hindsight, I saw another kind of switch mode power supply even before those transistor devices – a device known as a fluorescent light inverter. They had two TO3 switching transistors, a relatively small transformer, a diode, a few resistors and a capacitor or two, all mounted in a diecast heatsink as a case.

My job was to fix them for the QLD Railways, which was my first electronics job back in about 1975. The new (then) stainless steel carriages had modern fluorescent lights that had worked well since Nikola Tesla first invented them around the beginning of the 20th century; but they didn’t work at all on 24VDC.

So somebody designed these clever little boxes to convert 24VDC to 110VAC at around 100kHz, which was enough to light standard household fluorescent lamps. What’s more the inverters were easily hacked to work off 12VDC making them useful for camping - not that we would ever do that!

Fig 1

Here is a simplified version of the circuit, maybe for nostalgia, but perhaps also to show how things were done before microcontrollers were invented. Technically, I remember that these inverter circuits were called “saturation oscillators”.

To begin with, at power-on, the transistor bias was simply a resistor (R) supplying a bias current, which was voltage limited by a forward biased diode (D) to ~0.6V.

The capacitor caused the voltage across the diode to rise gradually, so the bias voltage to the two transistors increased over a few milliseconds.

Of any two transistors, one is always a little more sensitive than the other and the first one to switch on (let us assume Q1) came on fast, causing a rapid increase in current flowing in the main transformer coil on the T1 side. The resulting magnetic field in T1 caused a transformed voltage in each of the other coils. T1b assisted the bias of Q1 so it turned on even harder while the T2b voltage was reverse biased, so Q2 was actually held off.

When the transformer reached saturation (i.e., the magnetic field was fully developed), the T1b bias dropped to zero, and Q1 was slowly turned off. The bias, T2b, to Q2 was now increasing so Q2 turned on; also increasing the bias in T2b, and following the same cycle as Q1 until saturation occurred in the opposite polarity, and Q2 turned off.

Each transistor turned on and then off in what we call a “push-pull” action, resulting in a continuous oscillation of a frequency, determined only by the load current and the speed at which each half cycle reached saturation. In effect, although the frequency was around 40kHz when the fluorescent lamp was lit and stable, the frequency topped over 100kHz at start-up, and the voltage was also much higher than the 110VAC the tubes required to run.

The transformer secondary, T3, has a voltage developed across it that reaches perhaps 800V while the tube is cold, and not lit, but the two filament windings, 2 × T3f, cause a current in the tube filaments that heats the tube and allows limited current to flow within the tube from end-to-end, causing the light to glow. The tubes would be slower to start on cold mornings, but so was I!

The transformer saturation also helped to round off what would otherwise have been square waves, and another choke and some capacitance was used to limit the EMI (electro-magnetic interference) that was generated by the inverters.

CFLs

This could be considered the beginning of the miniature (a.k.a compact) fluorescent lamps, that we know as “CFLs”. If you carefully dismantle a blown CFL, by cutting the two pins off and gently levering the plastic cap away from the glass lamp, you may see that inside the base is a transistor-based circuit, which does pretty much the same as those old inverters.

CFL

The two transistors, which I believe are FETs although I haven’t tested any to prove this, could be configured in the same or similar basic circuit. More likely they form a very simple switch mode buck convertor, to provide a lower voltage, suitable to light the fluorescent tube, and also to limit the current to something safe.

Note: Do not attempt to power up the circuit while disassembled, or you might find that 340VDC bites even more than 240VAC!

A TAFE Switch Mode Power Supply :

USING LM555 AS MULTIVIBRATOR AND PWM

The circuit that follows is based on a concept circuit used in some TAFE colleges to teach electronics students how SMPS controllers can work, based on the common LM555 and LM741.

The circuit can supply 5V at 1.5A from an input of 9 to 40V at 1.5A, plus about 10mA for the ICs.

Switch mode power supplies typically use a voltage-controlled PWM (pulse-width-modulation) switched series element to vary the voltage output. Although several output topologies might be suitable, this exercise is particularly interested in the control circuitry for the SMPS.

There are many ICs suitable as SMPS controllers; the LM494, for example, which has been used in millions of IBM-style computer SMPS. Some ICs include everything except the inductor and filter components.

In an attempt to describe the functions as blocks that might exist inside a dedicated IC, this project is designed to show students and readers how the blocks work, how they are interconnected, and the effects of making changes, by allowing builders of the circuit to modify the circuit. Here we have a demonstration of the circuit blocks, which were all designed around commonly available parts already used by TAFE Colleges, and in previous electronics labs.

Fig 3

POWER IN

Raw power is connected to the first block, generally via a switch and some form of overload protection, such as a fuse, and possibly over-voltage protection. EMI and spike protection may also be utilised according to the kind of service to be expected. Most of these tasks were already satisfied, as the circuit was supplied by BWD power supplies.

IC1 – ASTABLE MULTIVIBRATOR

The first block of the control circuit, even in an IC, may repeat some of these protections internally, and may use some kind of voltage regulation for the controller itself, but our simple SMPS begins with an LM555 (IC1) connected as a conventional Astable Multivibrator, which is a simple square wave oscillator.

IC1 uses two resistors R1 = 10k, and R2 = 100Ω, and one capacitor C1 = 1nF, to set the frequency and mark space ratio of the oscillations by the formula:

f = 1/T = 1.44/((R1 + 2R2) × C), which results in a calculated frequency of 141kHz, and a mark/space ratio of 99:1 (1%).

For more information on the LM555 Astable, there are many online sites that feature a calculator ready to do your calculations for you.

There is one other component, a 10nF capacitor placed between pin 5 and Ground to stabilise the oscillations. Note that IC2 uses pin 5 differently, and its purpose will be explained in the next section.

IC2 – MONOSTABLE MULTIVIBRATOR

The second block takes the pulses from pin 3 of IC1 into pin 2 of IC2, the trigger pin, via a 100Ω resistor as a little protection for the second ICs input. Each pulse from IC1 causes IC2, the second LM555 to turn on pin 3 for a period of time in what is called the monostable mode.

Pin 3 in turn switches Q1, the series transistor, which can be any one of a number of switching technologies, BJT and MOSFET being the most likely choices. In this circuit we have drawn a generic MOSFET symbol, which could be an IRF510 for example.

The switched current is applied to L1, a 68µH cored inductor, and a 1N5811 flyback diode, followed by an electrolytic capacitor, C6 = 100µF, as a final filter for the SMPS.

The circuit is a monostable because there is no resistance between pin 6 and pin 7 of IC2. The monostable period is determined by resistor R3 = 47k, and capacitor C3 = 10nF.

The on-time of the monostable is determined by the formula:

T (a period) = 1.1 × R × C, = 1.1 × 47k × 10nF = 517µS.

However, there is a second factor affecting this period, the voltage on pin 5, which will be generated by IC3 an operational amplifier, which could be an LM741, or similar.

Pin 5 is connected to the voltage reference chain inside the LM555, at the point that would normally be two thirds of the supply voltage (2/3 VCC).

Applying an external voltage to this pin will adjust the voltage at which the LM555 discharges, thus reducing the period according to the voltage on pin 5.

IC3 – FEEDBACK-ERROR AMPLIFIER

That feedback voltage comes from IC3, an LM741 for this experiment, and these notes refer to the classic op-amp pin-out.

The reference divider chain of R6 and R7 should be directly connected to the output terminals to avoid interference and voltage drops. The values shown divide the SMPS output by 4, which for a 5V output means a 1.25V feedback voltage, plus or minus error, which is fed to IC3 pin 2, the inverting input.

Pin 3, the non-inverting input is set to 1.25V by a suitable voltage reference, maybe a Zener diode, a pair of forward-biased signal diodes, or perhaps an IC voltage reference device. The choice depends on the level of accuracy desired, but for this experiment, even a 1.2V NiCd cell would be difficult to beat.

An IC voltage reference, such as the TL431, 1.25Vref would be a good choice if you intended to build this experiment into a full-blown 5V SMPS.

The difference between the feedback voltage and the reference voltage is buffered by IC3, and what we now call the “error voltage” is applied to IC2, pin 5, causing the PWM period to change if there is an error. This configuration causes a smaller PWM period when the output voltage increases, and a longer PWM period when the output voltage decreases, thus correcting the error through negative feedback.

For a variable output voltage, R6 could be replaced with a 10k potentiometer, providing an SMPS output between 1.25V and 5V, and even higher if R7 is reduced. However, the circuit requires a DC supply voltage of approximately 1.5 times the output voltage to operate.

In a TAFE laboratory class, students have a maximum of two hours to breadboard this circuit and test it, usually in stages: IC1, then adding IC2, and then IC3 and the switching components. Once they have completed their experiment, they often try other modifications to the circuit, testing their own theories.

Fig 2

WHAT WOULD YOU DO?

What experiments would you try, to modify this circuit to your requirements? Perhaps a switchable 3.3V/5V output? How would you modify the circuit to make that happen?

I trust you recognise that this is a learning circuit, and not a project kit; it is meant to let you see the principles before attempting to design, or repair another circuit.

WHAT ELSE COULD BE CHANGED?

The two LM555 ICs could be replaced by a single LM556 IC, which accommodates two 555s within it. You might like to reduce losses by using all CMOS ICs, or a FET op-amp such as the TL071 or TL081. In fact, hacking used to imply cutting up existing circuits and modifying them to perform other duties. Modifying this experiment is hardware hacking.

The LM555s are limited to 30V rail voltage so the supply might manage 20V output. However, what if you wanted a 60V supply for some other experiment? You would require a 100V raw supply perhaps, but then the supply to the LM555s and the op-amp would be too high. You could use a voltage divider and an LM317 to regulate the supply to the ICs, to the complete controller circuit for that matter, and only supply the higher voltage to the MOSFET.

You could require a higher current, which is only limited by Q1, L1 and C6. A higher rated Q1 needs a low RDS(ON) (Drain/Source Resistance), low VGS (Voltage across Gate and Source) and can handle a VDSO (Voltage across Drain and Source Open voltage) of more than 40V, or more than the supply voltage.

One last comment: ZD2 clamps any voltage spikes, such as those that occur when a large current flow ceases, causing a large magnetic field to be left in the inductor. You should select ZD2 according to the output voltage you need. For 5V output, use a 5.6V Zener diode, for example.

SMPS INDUCTORS

An SMPS can be designed and built based on a traditional transformer, or inductor, recognising that the frequency must be kept to within the frequency range of the transformer. However, SMPSs tend to use ferrite toroid inductors, or perhaps iron powder toroid inductors if the frequency is below 1kHz. Larger SMPS may even use “ribbon toroids” with cobolt steel core, but for the size of maker type power supplies, ferrites are the way to go.

Ferrite and iron powder are two technologies of recent development, although they’re several decades old now. Ferrite can be described as an “iron ceramic”, having a very dense magnetic structure, thus allowing higher permeability and power levels than sheet iron laminations. Ferrite is also a material with low iron losses, which causes iron transformers to heat up and waste energy.

INDUCTOR SIZE?

In an SMPS, the inductor is used to smooth the current, rather than a capacitor which smooths the voltage. Of course, both are often used to work together in smoothing the DC output.

Inductors store energy in a current flow, creating a magnetic field, which is proportional to the square of the current. The energy storage requirement is also proportional to the time it must be used to return energy. Therefore, as the frequency and current are increased, the size of the inductor is reduced.

Fig 4

Here we have a circuit containing an inductor controlled by a switch and diode [1], for the following graphs. The first circuit [1A] shows us T(on), while the inductor is charged (i.e., stores energy), and the second [1B] shows the circuit during T(off) while the inductor discharges (i.e., returns it’s energy), to the load.

Trace [1C] shows that although T(on) and T(off) are typically different periods, the energy stored and returned, shown in the blue areas, are equal in the two periods.

Trace [1D] shows the current through the switch, and trace [1E] shows the current through the diode. Note the fast changing edges of the switched currents, which is known to cause arcing in mechanical switches.

Trace [1F] depicts the current flow through the load while trace [1G] shows the voltage across the load.

Calculating the inductance requires a calculation of the energy stored in one of these periods: T(on) or T(off). Energy in electrical circuits can be calculated from E = VIT, Voltage × Current × Time. Note however, that we’re only concerned with the changes in voltage and current, and only for one of the two periods, turn-on or turn-off.

We also know that the energy stored in an inductor can be calculated from E = 1/2LI2.

Therefore, we can combine these two formulae to become VIT = 1/2LI2, remembering that the values on the left side are changes in V and I, and the I2 on the right side is the load current. The formulae should reflect this:

dVdITon = 1/2LIL2

Rearranging gives us:

L = 2dVdITon/IL2.

Most manufacturers have a similar formula in their data sheets and a description on how to derive and apply the values to their circuit. Many now have a design suite of software that you can work through to calculate your circuit values without ever using a calculator. Home-builders sometimes try something much simpler. They choose an inductor they estimate to work, and fudge the value until they’re happy with the result.

DESIGNING AN INDUCTOR

Designing your own inductor is not as simple as selecting one from an electronics catalogue. Although you might be lucky enough to find a suitable pre-made inductor online or from a specialist supplier, you may be required to purchase 1000 of them!

Start out by selecting a toroid core. First you must know a few parameters: the calculated inductance, the DC current, and the ripple current. Remember the SMPS inductor is intended to convert a high frequency switched supply to DC, so you also need to know what frequency range the inductor has to work on.

Then you need to go online or to the data books, and choose a size and material for the toroid, making sure that it has enough space for the turns and diameter of wire it requires for the inductance you need.

The data sheet will provide a value (AL) for the inductance in milliHenrys or microHenrys for 100 turns wound upon that core.

The inductance formula – L = AL × N2 /100 – can be transposed to calculate the number of turns:

N = 100√ (L / AL)

For example, using a core that would have an inductance of 100uH per 100 turns, could be found to require

N = 100√(68 / 100) = 82 turns for 68 µH .

Note: The relationship is not linear due to the inductance being proportional to turns squared. For those interested, there are a few helpful links provided as “Reading & Resources”.

REALITY CHECK

This month we’ve tied up a few loose ends, as switch mode designs tend toward a central integrated circuit, and components from the application note. We have attempted to show how the parts work, so hopefully you’ll have a better idea when selecting or fault-finding a commercial power supply.

As you probably know, 3V3 and 5V switch mode regulators operating at much higher frequencies are available without the need for an inductor, and can be purchased in a simple package.

With continued applications for direct-powering of 3V3 and 5V microcontrollers, we expect to see the availability of these continue to increase, while the cost will probably continue to drop too. With all our Arduino and Raspberry Pi projects, that's probably a great thing too!

PART 1