Tuesday, December 21, 2010

Regulators, mount up!

On the heels of a few tweets regarding linear voltage regulators that I passed with a friend yesterday, I think I'll do a couple of posts on voltage regulation.

First, the general concept: voltage regulation is the creation of a stable, low-impedance DC voltage source from an unregulated DC voltage source.  Examples of unregulated DC voltage sources are batteries, "wall wart" type AC/DC converters (even though many of these create very good voltages (these days, anyway), you should always assume that you (or someone else) will plug a different supply in), car cigarette lighter sockets, rectified and filtered transformer outputs, solar panels, fuel cells, dynamos, and fruit with pieces of zinc and copper in.  In fact, pretty much anything other than a locally generated voltage from a well-designed regulator circuit should be treated as an unregulated source (for design purposes, at least).

This first post will concentrate on linear voltage regulators.  Sometimes you'll hear these carelessly referred to as "LDOs", although the LDO (low dropout) regulator is really a subclass of linear voltage regulators, and not all linear regulators count as "low" dropout.

Pictured above is a typical linear regulation circuit.  V1 is the unregulated source; D1 prevents a reverse-connected power supply from destroying the circuit, and should be a large enough power rating that it won't be in danger of damage when the circuit is energized (the 1N4001 is not a bad choice for this, although at higher currents it has a fairly high forward voltage drop).  If the voltage drop from a diode is unacceptable, there are linear regulators available that have built-in reverse voltage protection (the LM2931 is a good example of this), and there is a trick that can be played with a PMOSFET which provides good coverage at the expense of increased cost (I'll not cover that here- maybe in a future post).

The capacitors are where the real work comes in, so to speak.  Every different type of linear regulator will want to have different capacitors on the input and output- some will be happy with no, or minimal capacitance, while others will want a large "bucket" capacitor to provide current during surge periods.  Some need a minimum amount of ESR (equivalent series resistance) to avoid oscillatory behavior while others are fine with a low ESR tantalum electrolytic or ceramic on the output.  There are three things that need to be said here:  first, ALWAYS check the datasheet for the part you're planning to use.  The manufacturer will typically specify on the front page, in bold lettering, quotated, underlined, with a little drawing, what they expect in the way of capacitors and whether low ESR caps are expected/accepted.  Second, the bucket capacitor on the input (C1 above) is much less important in most cases than a decoupling cap and output capacitors, UNLESS there's a significant distance between the unregulated supply and the regulator (i.e., a long wire running from a wall wart calls for an input cap, but a battery a couple of inches away likely doesn't).  Third, you should derate the capacitor voltages by a factor of  (at least) two- if you expect to see 12V on the input, use 25V or better capacitors.  Ceramic capacitors are quite tolerant of at or near spec voltages, while aluminum electrolytics will suffer from prolonged near-spec voltages and tantalum electrolytics will freak out and die horribly with even small spikes above their rated voltage (seriously)(we're talking fire and brimstone freak outs, here).

So, now that you understand the circuitry, there are a couple of other key concepts to understand: quiescent current, dropout voltage, and power dissipation.  Quiescent current is the current the regulator "wastes" in the business of doing its job.  This is another look-it-up-on-the-datasheet value; the quiescent current will vary based on the cost of the regulator and the momentary load current (usually the Iq vs Iload spec is shown by a graph on the datasheet).  Some regulators will have very low quiescent currents (<10uA); it rarely ranges above a few mA.  The variation across load currents is usually not huge in absolute terms; for instance, the LM2931 mentioned above is from 1-10mA across its specified current range.

Dropout voltage is the minimum voltage difference between the input and the output.  The dropout voltage will increase as the load current goes up, and as the temperature of the device increases (we'll talk more about this in the power dissipation section).  If the input voltage is not greater than the output by at least the dropout voltage spec, the regulator will not perform as specified.  Typically, the output voltage will begin to sag, and will remain at a level of approximately Vin - Vdo; as Vin sags further, so will Vout.  Other characteristics will suffer too, such as noise rejection and surge current response.  Cheap regulators like the ubiquitous 7805 may have a dropout voltage exceeding 1V for even fairly light loads; fancier regulators may have dropout voltages well below .1V for light loads.

Power dissipation is the big bugaboo with linear regulators, and the limiting factor in their use.  The standard EE equation of P = I*V is applicable here; as the output current increases, the power dissipation of the linear regulator increases, as well.  The actual equation should look more like this:
P = Iq*Vin + Iload*(Vin-Vout)

This leads us to a couple of observations:  first, the greater the Vin/Vout delta, the more energy is wasted.  This is an important data point, because, while running a 5V system off a 9V battery with a cheap 7805 regulator may seem like a no-brainer, you're going to waste a tremendous amount of the battery's capacity.  An Arduino doing not too much pulls about 70mA; at that rate, you're going to deplete a 9V battery to 6V (which is probably about as low as you want to go before you start to eat into the margin of dropout voltage plus protection diode voltage) in something like 8 hours.  Add an Xbee module and you're going to end up below half of that time.

Second, the greater the Vin/Vout delta, the hotter your regulator is going to get.  With a fresh battery, the regulator on your Arduino is going to be dissipating close to 300mW, BEFORE you add additional load.  Again, the datasheet will give you some idea of what you can get away with here: typically, there will be parameters for Vin max, Vin - Vout max (more important with adjustable regulators), Iout max and Pmax, and typically there will be multiple values for each depending on the selected package and whether or not the device is provided with a heatsink (either in the form of an actual chunk of metal or a solid connection to a large pour of copper).  You'll need to comply with the most restrictive combination- if your 5V regulator specifies 20V maximum input, 100mA maximum output current, and 500mW maximum power dissipation, you obviously can't expect it to source 100mA with a 20V input level without melting.  In fact, if that 500mW dissipation is depending on a big fat heatsink and forced air cooling, you might not even be able to reach that without destroying your part.

So, now, the question that started this all:  If I'm running a 3.3V regulator and a 5V regulator off a 9V battery, am I better off dropping the 5V to 3.3V or conneting the 3.3V regulator directly to the 9V supply?  The answer is, it depends.

Going from 5V to 3.3V is going to result in the 3.3V regulator dissipating less power (because the voltage delta is smaller); that may mean you can use a smaller regulator, or a regulator that can't tolerate the full 9V input supply.  However, that power dissipation gets moved from the 3.3V part to the 5V part, so there's no free lunch in terms of reducing total power consumption.  Maybe that's okay, because the 5V load is light, or because the 5V regulator can handle the greater power dissipation better than the 3.3V part could have.  It may also enable you to use the output capacitors from the 5V regulator as input capacitors on the 3.3V supply, or obviate the need for input capacitors on the 3.3V supply at all.

Connecting them in parallel has the benefit of spreading the power dissipation between the two devices; it also means that a brownout on the 5V supply won't bring down the 3.3V supply (which could be good or bad).

The driving forces behind the decision, then, become your selection of the regulators to be used and the load on each regulator.

Lastly, I'll say that, despite the seemingly great amount of detail here, there's a lot I've left out.  I didn't cover adjustable regulators at all (typically, they use a voltage divider to set the voltage at a pin, from which the output voltage is derived), or regulators with enable pins (generally used for power supply sequencing or disabling parts of the circuit when necessary), or multiple output regulators (pretty much the same as single output, but you'll need to sum the power dissipation of each output rail to calculate the total power dissipation of the package).  Most of that stuff is refinements of the information here, and this is a good practical primer on the topic (or so I hope).

I've got a few more posts on the topic- switched capacitor supplies, inductive switching supplies, batteries, and maybe more on other types of unregulated supplies.

1 comment:

  1. Voltage regulators are used to control and maintain a continual but constant amount of voltage flowing in any electrical circuit or device. In short these regulator keep the right amount of power or electricity going to the right places at all times. Without them electrical devices would not work properly.