Clone this wiki locally
The power supply architecture I developed for my project is designed to allow the costume to be powered from a battery and hopefully to minimize wasted power overall to improve battery life. Below is a block diagram of the power architecture for the costume.
The mobile power source is a 9V battery. The microcontroller and LEDs are powered by 5V from an LM7805 voltage regulator fed from the battery. The accelerometer requires 3.3V and is fed from a separate 3.3V regulator - the MPC1702. The 9V battery was selected because it offers enough voltage overhead to power the 5V rail even after a significant amount of power is drained from the battery and because it provides that voltage in a single easy-to-use package (compare that to 6 AA batteries - bulky and difficult to use). The microcontroller is powered by 5V to allow it to use higher clock speeds. The LEDs are powered from 5V (and not in this case 3.3V) because the green LED has a forward voltage drop of 3V. The 5V source allows a litle more wiggle room than the 3.3V source would. The accelerometer is a 3.3V device and requires that voltage to operate.
Despite all of my justifications this architecture is not a very good one. My main issue with is is that I have too many voltage sources - 9V, 5V and 3.3V. If you're doing a design for manufacture you don't want all of those extra parts especially if they're unnecessary. Extra parts means more cost - very bad. Extra parts also mean more points of failure - more things to go wrong. This architecture needs to be simplified. My plan for the next revision of the board is to remove the 5V rail. Currently it's only powering the microcontroller and LEDs. The only reason to use 5V to power the microcontroller is to allow higher operating frequencies but that's sort of a moot point - this isn't a very high-performance system so I doubt I need a 20MHz clock. If I drop the microcontroller down to 3.3V I also don't have to worry about interfacing the accelerometer to it. Currently the two use incompatible voltages. It's not a problem for this revision of the board because they interface via A/D converter and there's no control lines going to the accelerometer. I eventually want to change that in the next revision - use an I2C interface and be able to control the accelerometer from the microcontroller. By putting both of them on the same supply voltage I eliminate issues from my design. The LEDs can't really be switched to 3.3V because of the reasons I discussed earlier, but they can be driven from the 9V battery directly if the current limiting resistors are modified to support the new voltage.
5V and 3.3V Sources
I'm going to handle the description of the 5V and 3.3V sources together because they are largely the same in a design decision sense. The design problem that caused the selection of the two voltage regulators providing the 5V and 3.3V rails was a simple and timeless one: I had 9V but I needed 5V and 3.3V instead. This problem is easily solved by utilizing voltage regulators to produce the needed voltages from the 9V source. A voltage regulator produces a specific voltage actively. This means that it utilizes feedback to attempt to keep its output voltage at the specified voltage despite any changes in the output current or input voltage. There are a great number of 'standard' regulators that I could use that I feel the need to explain the thinking behind this decision.
The inputs into the decision of which voltage regulator to use include the following criteria:
- Output voltage
- Input voltage
- Desired current
- Efficiency/Heat Dissipation
- Line/Load Regulation
- Voltage precision
- Cleanness of the output voltage
- Ease of use
Here's a breakdown of why each item in that list is important to the decision of what voltage regulator to use:
This one is obvious: what voltage do you need? If you can't answer this question you haven't done enough design yet.
Most voltage regulators have a defined range of voltages they can work from to produce their output voltage. This range is often smaller than you might think - the LM7805 can only work from an input voltage source of up to 35V. This seems like a lot but someday you're going to have a circuit you'll try to run off of three car batteries in series (36V) and you won't be able to use the regulator you've been used to. While it's not as likely to cause you issues, definitely keep an eye on the maximum input voltage of a regulator.
All regulators have a current limit beyond which they will cease to function or destroy themselves with heat. Most digital applications require surprisingly low amounts of current. For example, the only device on the 3.3V rail is the accelerometer which under normal conditions uses less than 1mA of current. That's not a difficult requirement at all. On the other hand each set of LEDs requires up to 600mA of current to light them. This uses more than half of the 1A current capacity of the LM7805 which I selected as the 5V source which drives the LEDs. Typically, current limits can be increased if you use heat dissipation strategies like heatsinks but this doesn't always hold true. Make sure that you respect the current limits for your regulators.
Efficiency of a regulator is determined by the equation (Power Out)/(Power In). Ideally these numbers would be the same and the efficiency of every regulator would be 100%, but in the real world this is not possible. Higher efficiencies mean less wasted power and also less dissipated heat - all the 'wasted' power has do something doesn't it? Turns out it heats the air around your regulator. Unless this is desired behavior you should attempt to use the most efficient regulator you can to minimize power loss and heat dissipation. If you can't, you may need to utilize any number of heat dissipation strategies such as heatsinks.
Line and load regulation are measurements of how well your regulator copes with change. For example, let's say you're powering a 5V motor that is humming along without a care in the world and is consuming 100mA. Suddenly, your motor needs a lot of torque (perhaps your robot got stuck in a ditch). Now the motor goes from consuming a small amount of current to a very large amount (2A) for a short time. If you have a regulator with poor load regulation it will deliver the current the motor needs but will also drop its output voltage below 5V - perhaps to 3V or so. This limits the amount of power delivered to your motor among other things and is generally considered undesirable. A regulator will good load regulation won't display this voltage drop.
Line regulation is a measure of how well the regulator adapts to changes in the input voltage. Consider a typical voltage divider circuit with a ratio of 1:3. If I put 3V on the input of the divider I get 1V out. Some people use voltage dividers instead of voltage regulators - they figure 'Hey, I've got a 9V battery, I need 3.3V, so why not create a resistor divider with a ration of 3.3:9 instead of a fancy regulator IC and save myself some money?' This is an okay idea until the battery starts to die. The battery voltage will go from 9V to 8V to 7V and further down until it's all completely empty. Similarly, the output of the voltage divider will start at 3.3V but then progress down to 3V, then down to 2.6V while the battery empties itself. The voltage out of the divider is poorly regulated - it can't compensate for changes in the input voltage because it has poor line regulation. Voltage regulator ICs contain feedback that mitigate changes in the output voltage as a result of changes in the input voltage - this is line regulation.
As you might expect, some regulators are better than others at both types of regulation. The regulators that are better are, of course, more expensive as well.
Your design says that it needs 5V but is 4.95V okay? How about 4.5V? While changing load and/or source conditions may affect the output voltage, the native precision of the regulator is important too. Linear regulators typically use a voltage reference to help generate the output voltage and as with most things higher precision requires more money. The LM7805, for example, will provide a voltage between 4.8V and 5.2V. Other linear regulators may be worse.
Cleanness of the output
This is a somewhat subjective criteria but a still important one. Some regulators produce 'dirty' or noisy output as a result of the methods they use to regulate their output voltage. Noise is very undesirable for many electronic systems - particularly those which rely on sensitive voltage measurements. Switching regulators, for example, produce a more noisy output than linear regulators because their regulation method employs quickly turning high current loads on and off. Linear regulators don't use this approach and produce much cleaner outputs. There are always methods to minimize noise but you should be aware of this issue when selecting a regulator.
Ease of Use
Some regulators require external components in their design while some are monolithic. External components increase the complexity of circuit design and layout. They also introduce more places for mistakes to be made. I'm a guy who makes lots of mistakes so I'm afraid of regulators that are difficult to use.
As a circuit designer you have to take into consideration all of the above factors when choosing the voltage regulator you'll use for a circuit. Obviously some are more important than others: the output voltage and current are typically written in stone for a given application leaving you to determine which of the remaining factors are most important when choosing your regulator.
For this design the voltages of 5V and 3.3V were essentially set in stone (despite my admission above that it was a poor choice). The current required for the 3.3V source is minuscule, but the current needed on the 5V line is roughly 600mA but I should give myself some overhead so I'd prefer something that will deliver 1A. Those two requirements give me a good basis to start.
The first major design decision is whether to choose a linear regulator or a switching regulator. Below is a quick description of each along with their advantages and disadvantages.
Linear regulators utilize linear elements to regulator voltage. This is vague because there are a wide variety of methods and configuration of linear regulators available. You can learn all about how they work internally by reading the Wikipedia article about them. From a circuits perspective linear regulators generally follow the circuit diagram below:
The main issue with linear regulators compared to switching regulators is that linear regulators have lower efficiency. This is due to the voltage Vd across the regulator. The output voltage (VOut) is maintained at the output by the regulator, but the input voltage (VIn) can vary up to the maximum allowed voltage for the regulator. For example, if I'm using an LM7805 at its maximum operating voltage of 35V and drawing 1A, the voltage Vd across the regulator is 30V and the current through the regulator is 1A. This means that the regulator is dissipating 30V1A = 30W and the power being delivered to the load is 5V1A = 5W. Iq is much smaller than the load current and isn't really significant in this calculation. Given these numbers, the efficiency of the regulator is 5W/30W = 1/6 ~16%. That's not great at all. This can be mitigated by lowering the input voltage (if possible) but linear regulators are limited by the fact that the input current is equal to the output current. Switching regulators do not have this limitation - they transform power, not voltage. For them, power in is equal to power out (minus efficiency losses).
Vd (also called dropout voltage) is important for linear regulators for another reason: there is a dropout voltage below which the regulator will not function. For the LM7805 the minimum dropout voltage is 2V. Thus, if your input voltage drops below 5V + 2V = 7V then the regulator will stop working.
Another facet of linear regulators inefficiency is their quiescent current - Iq. This is a current that is necessary for the regulator to operate but is not delivered to the load at all. Thus, if you hook up a regulator with no load it will still draw current - the quiescent current. This is not unique to linear regulators - switching regulators have this issue as well.
Switching regulators utilize the unique properties of inductors to produce regulated voltages. The voltage across an inductor is dependent on the current flowing through it. In a switching regulator, current is run through an inductor and then quickly turned off. This causes the voltage across the inductor to quickly jump and causes it to act as a current source for the rest of the circuit. The voltage will eventually decay but when that happens you can just start running current through it again to bring it back up. This continual switching between charge and discharge cycles is controlled to provide a consistent output voltage - a switching voltage regulator. Switching regulators differ from linear regulators in that current in is not equal to current out. Instead, power in is (roughly) equal to power out minus efficiency losses.
There are several advantages to using switching regulators as well as several disadvantages.
Switching regulator advantages:
Input voltage range - Switching regulators can take nearly any input voltage above a certain minimum voltage (determined, essentially, by physics) and produce the output voltage you need. Switching regulators that lower input voltages are called buck regulators. Those regulators that have higher output voltage than input voltage are called boost regulators. You can also have combination buck/boost regulators that can perform both. These are useful for battery-powered circuits which vary their voltage as the battery drains.
Efficiency - Switching regulators are power converters, not voltage converters. They can have efficiencies in the mid 90% region. This means that despite the input voltage, output voltage or output current very little power is dissipated in the regulator and very little heat is produced. It also means that more power is saved to be delivered to the load and not wasted. This is also very important for battery-circuits.
Switching regulator disadvantages:
Cost - A drop-in switching replacement for the LM7805 (drop-in meaning no additional effort) will cost roughly $8 where the LM7805 itself will cost $.67 or $1.67 if you want to avoid lead.
Complexity - You could save on cost by only buying the controller and then adding your own external components, but this gets complex. You tend to have lots of choices and much more room for confusion when doing it this way not to mention extra board and circuit design to perform.
Noise - Switching regulators are noisy and disperse this noise throughout your circuit. There are mitigation strategies of course but these incur more complexity and are not always effective. For this reason lab supplies are generally linear regulators.
These are quite a few issues to consider just for the selection of a voltage regulator. For this project my main concerns were ease of use and meeting the requirements of my system: 5V/3.3V output with 1A current output on the 5V line and 100mA current output on the 3.3V line. Both of these have to be sourced from a 9V battery. Efficiency is a concern in this application considering the fact that it's operated from a battery. However, the efficiency of a linear 5V regulator at load will be roughly 80% which is not too bad efficiency wise. The extra 15% efficiency or so from a switching regulator isn't worth the extra complexity or cost required for a switching regulator. Also, regulator noise is a concern in this application because the accelerometer is an analog output device so we need nice clean measurements. Ease of use is always important.
Given all of this my final choice was for the 5V and 3.3V regulators were two linear regulators: the LM7805 for the 5V rail and the MCP1702 for the 3.3V rail. These are both pretty basic linear regulators - the LM7805 is essentially the go to regulator to produce 5V. I'l focus on the LM7805.
The output voltage is correct (5V) and the precision is acceptable (+/-.2V). The output current is sufficient (600mA required vs. 1A capability). As I said before, the efficiency will be about 80% which is not terrible at all. The line and load regulation are not really an issue for this application because we won't be switching high current loads or changing the input voltage quickly. Since it's a linear regulator it introduces no extra noise.
That's a lot of text to justify buying the same regulator that most engineers would buy without a second thought.