In the last installment of Circuit VR, we walked around a simplified buck converter. The main simplification was using a constant PWM signal. The result is that the output voltage is a fixed fraction of the input voltage. For a regulator, the pulse width will need to depend on the output voltage so that any changes in the output are self-correcting. So this time, we’ll make a regulator, although we’ll still use a few Spice elements you’d have to replace in a practical design. In particular, we’ll assume you can generate a triangle wave, which is easy enough, and produce a stable 2.5 V reference.
The idea is to take a voltage reference and compare it to the output. We’ll think of the difference between the two as an error voltage, and use a comparator combined with a triangle wave generator to produce a PWM signal that is proportional to the error, and thus works to hold the output voltage constant.
Playing the Triangle
If you need a refresher on how the triangle wave and a comparator generate PWM, check back in the last post. As a refresher, here’s the architecture I settled on.
Once again, I took a junkbox approach — you could probably select better components if you had specific goals in mind and thought about it. I just grabbed likely parts and wanted to make them work, just as I do sifting through my physical junk box.
The only thing I took the easy way out on was the triangle wave generator. If you look for a specific triangle wave generator in Spice, you’ll be disappointed. But the PULSE block can do it. I set the parameters to the following:
V2 N006 0 PULSE(15 0 0 .0000005 .0000005 0 .000001)
Of course, you’ll want to use the LTSpice GUI to enter that. The VInitial is 15 V, The rise time is 500 nS and the fall time is also 500 nS. The period is 1 uS. Think about that for a second. Since the rise time is half the period and the fall time is the other half of the period, the result is always rising and falling.
Inside the Circuit
You can find the files on GitHub, as usual.
I started the supply voltage (V1) at 15 V. M1, D1, L1, C1, and RL are essentially the same as the basic buck circuit seen last time. The difference is that R2 and R3 form a voltage divider that splits the voltage in half and sends it to U2. U2 is a differential amplifier comparing the voltage to V3 which is a 2.5 V reference. In a real circuit, you should make that reference voltage a good one, since the accuracy of the supply won’t be any better than the reference.
Obviously, you don’t have to have a 2.5 V reference. You can set the voltage divider ratio to convert any higher voltage to any lower reference you happen to have. The output of V2 is the triangle wave and U1 is a comparator that produces the PWM drive signal (R1 is just a pull up and, depending on U1, may not be necessary).
I’m cheating a little because I’m not driving the gate with a higher voltage which may cost me some efficiency. In a real system, you’d probably want a bypass capacitor near M1’s input side as well, to reduce noise going back into the power supply which isn’t a big concern here. I also didn’t show any series resistance for V1, V2, or V3, although if you add a little you’ll see it doesn’t really make any difference.
Performance
If you run the simulation and probe the junction of L1 and RL you’ll see about 5V come out eventually with some ripple.
The ripple isn’t bad at all and the voltage is steady after about 15 ms.
I changed the input voltage to step between three values, and to quit plotting the first bit — before 25 ms — so we can focus on the operating area.
The output looks very ripply until you look at the left-hand scale.
The top trace is with the 10 V input, the middle trace is for the 15 V input, and the bottom trace shows the 20 V input. Not too bad for a handful of components. Sure, you could get better with a linear pass regulator, but those dissipate a lot of heat and usually have a fairly narrow input voltage range.
Keep in mind, too, that there are more sophisticated architectures that can optimize for different criteria like minimizing ripple or achieving maximum efficiency. This circuit is about as simple as you can get and offers a good starting point for digging into other kinds of switching power supplies.
Real Triangles
The one place I didn’t provide a detailed design was for the triangle or ramp generator. The reason is — as I mentioned in the first post — in real life, you probably shouldn’t be doing all this anyway. Just buy a switch mode power supply controller from your favorite vendor and copy the design from their data sheet. You’ll spend hours building a circuit as complex as the one you can get for a buck or two in an IC package. Still, you might like to understand what is happening inside that controller even if you don’t have to build it.

If you did want to generate a triangle wave, there are many ways to do it. A constant current source will produce a nice straight line when charging a capacitor. A constant current sink can discharge the capacitor in a straight line, too. Usually, a circuit like that will have a flip-flop to pick between the source and the sink.
The other way to do it is to integrate a square wave. If you think of an integral as the area under a curve, that makes sense. The area gets bigger until the square wave goes negative. Then the area reduces at the same rate until the square wave goes positive again. Here’s an online simulation of the circuit.
If you probe the output of U1 you’ll see a nice square wave. The output of U2 will be the integral of that square wave.
Going Forward
If you are feeling brave, you might try to replace the ramp generator with a variation on the triangle wave circuit. There are many other changes you might try, such as replacing the diode with another FET that you drive out of phase with the first FET.
It wasn’t long ago [Julian] posted a video about the efficiency difference between a silicon diode, a Schottky diode, and a FET. Might be interesting to see how simulation agrees with his real-world results. If you want to see another worked out example which includes Spice modeling, [K. C. Lee] has a really detailed project over on Hackaday.io.
In the end, though, there are two things to remember. First, simulations are great, but the real world is going to be different. Real input sources aren’t perfect. All components exhibit behavior you wish they didn’t. Some of that you can model (ESR in the output capacitor, for example) but you can’t get it all.
The other thing to remember is that this is really to help understand what’s happening. Sure, you can build an opamp out of a handful of transistors, but why? Just buy an opamp. Same thing here. I’m not suggesting your roll your own buck converter for a commercial design. Just go buy a controller — there are plenty around. But having an understanding of what’s going on will help you make better design choices and should help, too, if you have trouble getting one of those controllers to work the way that you want.



No comments:
Post a Comment