Buck switching regulator based on ATtiny84a — please critique!

Here is an attempt at designing a buck regulator based on a ATtiny84a as the PWM controller. It should go from a 4S LiPo battery (12.8 - 16.8 volts in) to a reasonably regulated 12V output, used to drive servo motors that accept 10-14V inputs. 4S LiPo is slightly too high, and 3S LiPo is slightly too low, especially as I want the rated 12V torque. The design is intended to deliver 40 amps worst case (stalling out a majority of the motors.)

I can't buy one of these, because as soon as I leave the 10-15A range, all the DC DC converters are designed for industrial use and have heavy cases, are really expensive, require 24V input, or other such mis-matches with my present requirements.

The idea is to use the built-in analog comparator in the AVR to detect over/below target voltage, and generate a pulse of a definite duration when the under is detected.

I would build this on breadboard with 20 gauge wires soldered across the component leads for the high-power paths.

I know about keeping the "switching node" and feedback path as short as possible, when trying to do layout. I would also ground all breadboard traces that are not used, to make for a poor man's ground plane.

I've tried choosing a choke where the saturation current matches my max output current, and a buck inductor where the saturation current is higher than my max output.

The corner frequency of 94 uF and 3.3 uH is about 9 kHz, and I imagine the AVR will run much faster than that. I'm thinking a 5 us pulse each time under-voltage is detected, and then just go back to look for under-voltage again. That gives a max frequency (at close to 100% duty cycle) of 200 kHz.

And here's the schematic: http://watte.net/switch-converter.png

-
The PFET is upside-down, and where's your diode??? – Dave Tweed Dec 15 '12 at 4:57
The circuit completion diode is in the same place my IC de-coupling diode: Not there yet because I forgot to add them :-) – Jon Watte Dec 15 '12 at 6:31
And, yup, the P-fet is upside down, as you kindly noted. But, if I fix those things, and this circuit "just works" at 40A, I'd be amazed -- I've got to have forgotten something. Also, I didn't spec the capacitors (for ESR) yet. Starting from the top: Would the fixed on-time, varying off-time approach work alright? Are the inductors actually too big? Will the second LC filter do anything for me, or is it useless? – Jon Watte Dec 15 '12 at 6:33
And the input voltage for the analog comparator is too high for the AVR. Which brings up the next question: Is it a reasonable idea to use a resistor ladder for the voltage feedback here? Other things missing: Overcurrent sensing/protection, Overtemperature sensing/protection, Reverse power protection, Short circuit detection/protection. But one thing at a time. Perhaps I should just break this question into 8 questions ;-) – Jon Watte Dec 15 '12 at 6:45
Wouldn't the switch-off of the series PFET be terribly slow? – Wouter van Ooijen Dec 15 '12 at 7:45

In addtion to the concerns brought up in the comments (incorrect P-FET polarity, no catch diode/MOSFET), I have some at-a-quick-glance concerns:

• The microcontroller won't be able to drive the gate of Q1 very hard (usually GPIO pins can only source a few milliamps) so your turn-on and turn-off will be very slow. This will limit how well your high-side switch will behave.

• You don't have a gate-to-source resistor on Q1, so you're solely dependent on the GPIO keeping the MOSFET on or off. If the GPIO pin goes high-impedance, the MOSFET may turn itself on if the gate picks up a charge from the environment.

• If your 70R P-channel gate resistor is solidly on (if Q1 is saturated), it's going to burn

$D \cdot \dfrac{(16V)^2}{70 \Omega} = D \cdot 3.65W$

which is crazy high power since D is going to be high (input is close to output). Also, the 225mA or so that will flow will also be burned in Q1, which isn't healthy since it's a relatively small device.

(You need $V_{GS}$ of around 4V to draw ~400mA through Q1, and you need $V_{GS}$ of -7.5V for 40A in Q4).

• Your purely resistive feedback network is a bad idea. You really need some compensation and/or filtering. Your comparator will be hyper-fast and could react to switching noise, pickup, ripple, etc. - since you don't seem to be using an error amplifier with compensation to control the gain and phase, you're going to need some cap across R5 (and some luck).

• You don't have any current monitoring or over-current protection in your power train.

• You don't have any over-voltage protection in your power train.

• You don't have any over-temperature protection in your power train.

• You don't have input reverse-polarity protection and an input fuse in your power train. Big no-no, especially when the source is battery-based (big short-circuit sourcing capability).

This is a simpler project if you use an off-the-shelf analog synchronous buck controller. I don't understand why you would want to use the ATtiny for this.

That being said, this isn't a simple project by any stretch. Your schematic is largely incomplete and lacks basic safety protection that any power supply (especially ones that run at high power levels like yours) will need.

-
I would add you to my fan list man. Sir could you please take a look at this too. It sounds you have some much experience on designing SMPS. electronics.stackexchange.com/questions/51325/… and also here OP could use that chip TL494 , because it provides two error amplifiers which is ideal for this case. – Standard Sandun Dec 15 '12 at 17:20
I understand an error amp controlling gain... but phase? What phase control would be needed? – akohlsmith Dec 15 '12 at 18:30
Phase margin is the most important part of stability analysis. If you have negative feedback with 180 degrees of phase shift, your negative feedback becomes positive feedback and your power supply becomes an oscillator. – Adam Lawrence Dec 15 '12 at 18:48
Thanks for the comments! I already noted the safety pieces as missing in comments above. The phase sensitivity is important, and I'm actually not sure the AVR analog comparator is up for it. It works as the "error amplifier" and I don't know what the bandwidth gain product of that is. Burning 3W to regulate 480W isn't so bad. It saves components compared to driver ICs. And if I go driver, I might as well go all the way and use a high-side N-channel for the switch. – Jon Watte Dec 16 '12 at 1:29
The BS170 is rated at 500 mA, and I've driven it that hard before from the 4.8V out of the AVR. Also, the AVR output pins are rated up to 40 mA. Hence, the 100 Ohm current limiting resistor is actually a little bit aggressive. Similarly, Q4 gate will go to -16V which should be ample to drive it at 40A. Using a IRF4905, (40*40)*0.02 == 32 watts of power is burned on Q4. Yes, it needs heat sinking :-) – Jon Watte Dec 16 '12 at 1:34

You are designing a Buck regulator for:

• Vin of 12.8 to 16.8 Volts from a high capacity LiPo battery.
• Vout of 12V @ 40 Amps.
• Control technique is Constant on time, and variable off time.

Even after the good answer by Madmanguruman, there are additional things that should be noted. The main difficulty with this design will be the high current being processed. I'll pay attention mainly to the power processing components, power modulator, and filtering.

• Power FET is P channel. IRF4905: Rdson=0.02@25C, 0.034@150C; Ciss=3500pF. Conduction loss will be very high. For Vin=16.8V, Vo=12V, Iout=40A, Pcond = $\text{D } \text{Iout}^2 \text{Rds}$ = (.7)(1600)(0.034) = 38W. After considering the thermal resistance of the TO220 package and case to sink junction, a heatsink with 2C/W will be required to meet 150C junction with an ambient temp of 25C. It is much better to use N channel FETs for high current situations. An otherwise equivalent N channel FET will have 1/3 the Rdson as a P channel FET.

• Gate Drive. There is no adequate gate drive in this design. Especially for turn off. With 70 Ohm turning off a FET with Ciss of 3500pF, turn off time will be at least 500nSec. This will mean huge switching loss in the FET, probably at least 15W of additional loss in the FET. This design has to have a much better gate drive. Since the gate drive needs to be improved anyway; it would be very beneficial to change to an N channel switching FET, and use a matching synchronous rectifier with a gate drive IC (like IR2104 or LM5104 or some such).

• Hysteretic Control. There is no problem with constant on time, variable off time control. Hysteretic control can (if you are careful) work well, and have excellent transient response. But, the problem here is using the comparator in the uC. There needs to be access to the comparator to provide added hysteresis. So, a comparator with hysteresis, and with a response time less than 500nSec needs to be added. You would want to add hysteresis of about 100mV.

• Output filter. Good inductor, L1. At 40A plus ripple current it will be on the verge of saturation. It would be better to have a higher current part, but it is not a major concern. It looks like the output capacitors C1 and C2 are ceramic, which is a good choice, should be able to have a total ESR of less than 20 mOhms for a ripple voltage ~100mV. It is interesting, that the load resistance at maximum load (~0.3 Ohms) is very close to the characteristic impedance of the output filter (~0.2 Ohms). This is lucky, since it means that the filter is well damped, more about this later. If you are only driving motors with this supply there should be no need for the second stage filter (L2, C3).

There are some functions left out that need to be there:

• Current limit, there needs to be one, for your own safety if nothing else. With the amount of current being handled, surprises can come up in a hurry. You haven't lived until the top of the power switch explosively separates from the bottom and flies off to stick in the ceiling. Anyway, some kind of current limit, even if its just a fuse.

• Input filter. It is not clear about the rest of the system, but the input of this supply will be the source of huge amounts of EMI. Normally this would be a big problem.

Input impedance is also a concern here. Switching regulators have negative input impedance, and can make good oscillators (unfortunately). The source impedance, of the LiPo and distribution network have to be less than 1/2 the input impedance of the supply to prevent oscillation. I think high capacity LiPo batteries have impedance of about 20 mOhms (although this goes up with age). The input impedance at full load (40A) of this supply with it's current output filter (L1 with C1 and C2) has a minimum of about 100mOhms (at 9KHz), which looks good if the source distribution network impedance is kept low. But,remember the output filter damping that looked so good at the 40A load, well if the load drops to 10A damping is not so good. That means at load of 10A the input impedance minimum drops to about 50 mOhms (at 9KHz), which would make the source distribution really tight and problematic. What a paradox, for this to be a light load problem caused by variable output filter damping.

-
This is also a great answer, and the kind of feedback I was looking for to learn more about this area. As I note in my comments, a lot was left out, including overcurrent and overheating protection. The heat loss in the switching transistor is looking really bad, and I'd probably do well to go with N-channel -- or, even better, parallel N-channel -- devices. It's interesting you should mention the IR2104 -- I actually have a couple in the parts bin. I have always thought of it as a "H bridge driver" but you're right -- it's also a synchronous rectifier driver. – Jon Watte Dec 18 '12 at 5:49
Btw: with the IR2104, do I need a Schottky diode, or is any fast-recovery diode good enough? – Jon Watte Dec 18 '12 at 5:54
For the bootstrap diode, a fast recovery type should be fine. – gsills Dec 19 '12 at 3:42