Electronic – 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:
Switching Buck Converter based on ATTiny84a

Best Answer

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.

Think about your requirements, calculate all the losses, design in some protections and come back with rev. 2.