Chapter 2

Building Power Supplies

IN THIS CHAPTER

check Looking at how power supplies work

check Stepping down the voltage

check Converting AC to DC

check Filtering wavy DC

check Making the voltage level more reliable through regulation

With very few exceptions, every electronic circuit requires a power supply of some sort. Although some projects run off of solar power or more exotic power sources such as wind turbines, fuel cells, or nuclear reactors, most of the projects you build will get their power from one of two sources: batteries or an electrical outlet.

So far in this book, I assume that all circuits get their power from batteries. In this chapter, you look at how you can get power from an electrical outlet instead. Electrical outlets have a compelling advantage over batteries: Unless there’s a power outage, electrical outlets don’t go dead like batteries do. However, electrical outlets have an equally compelling disadvantage over batteries: Unless you use really long extension cords, you can’t take a project powered from an electrical outlet very far from the outlet.

Most electronic circuits require a relatively low DC voltage, typically in the range of 3 to 12 V. It’s easy to get that range of voltage out of batteries. Since each battery provides about 1.5 V, you just team up two or more batteries to get the right voltage. For example, if your circuit needs 6 V, you can use four batteries connected in series.

Powering a project from an electrical outlet is a little more challenging. First, the 120 V provided at the electrical outlet is much more than most circuits require, so you have to step the voltage down to a more appropriate level. Second, electronic circuits usually require direct current — and the wall outlet provides alternating current — so you have to convert the AC to DC. And third, circuits that run directly on 120 VAC are inherently more dangerous than circuits that run on lower voltages because of the shock danger that accompanies higher voltages.

The circuit that converts 120 VAC to direct current at a lower voltage is called a power supply. In this chapter, you learn the basics of creating your own power supplies so you can power your projects from a wall outlet instead of from batteries.

Using a Power Adapter

Before I show you how to build your own power supply circuit, I want to let you know that you can probably purchase a preassembled power adapter that will provide the voltage you need for just a few dollars more than you could build the circuit yourself. A power adapter, also called a wall wart, is a self-contained power supply circuit that plugs into a wall outlet and provides a specified level of AC or DC voltage as its output. As long as the power adapter supplies the correct voltage, you can use the power adapter instead of batteries in just about any circuit.

When you purchase a power adapter, you need to check the specifications to make sure you’re purchasing the correct adapter. The specifications are usually printed on the adapter itself. Look for the following important specifications:

  • AC or DC: Not all power adapters supply direct current; some are made to power low-voltage AC devices. So make sure that you get an adapter that provides direct-current output.
  • Voltage level: Next, check the output voltage. Some power adapters have a switch that lets you choose from among several output voltages. If you use such an adapter, make sure you set the switch to the correct output level for your circuit.
  • Current capacity: Most power adapters will have a maximum current rating expressed in milliamps. Smaller adapters can handle a few hundred milliamps, whereas larger adapters may be able to handle an ampere or more. Make sure that the adapter you use can handle the current requirements of your project. (Although some power adapters can handle several amps, few can handle more than that.)
  • Polarity: Most power adapters use a barrel connector to plug the power adapter into the circuit. In nearly all modern power adapters, the center connection of the barrel connector is positive, and the outer connection is negative. However, some power adapters are wired just the opposite, with negative in the center and positive on the outside. The polarity of the connector should be printed on the adapter along with the voltage and current specifications.
  • Connector size: Unfortunately, there are far too many different sizes and styles of connectors used for power adapters. Once you’ve purchased a power adapter, you can go to a local electronics store such as RadioShack and purchase a jack that is compatible with the connector on the power adapter. Then, you can use the jack to connect the power adapter to your circuit. (Note that some power adapters have different interchangeable plugs in different sizes.)

tip Using a power adapter instead of building your own power supply can make your project safer to build and use. That’s because the part of your project that is potentially dangerous — the part that works directly with 120 VAC line voltage — is fully contained inside the preassembled power adapter.

However, as you’ll soon discover, you get what you pay for when it comes to power supplies. Inexpensive wall warts convert AC to DC and step down the voltage, but most do not provide power that is very clean (that is, a pure level of DC) or stable (that is, with a predictable voltage). Thus, even if you use a wall wart to power your project, you may still need to add circuitry that will improve the quality of the DC supplied by the wall wart.

Understanding What a Power Supply Does

If you want to add your own power supply circuit to a project to convert 120 VAC line voltage to a DC voltage that’s suitable for your circuit, you’ll have to design a power supply circuit that provides at least three distinct functions:

  • Voltage transformation: Reduces the 120 VAC line voltage to the voltage your circuit needs.
  • Rectification: Converts the reduced AC voltage to DC voltage. Note that the DC voltage produced by a rectifier circuit is technically direct current, but it isn’t steady direct current. Instead, a rectifier produces pulsating direct current in which the voltage fluctuates in sync with the 60 Hz alternating current that’s fed into it from the transformation stage.
  • Filtering: Smoothes out the ripples in the DC voltage produced by the rectification stage.

Transforming Voltage

You already know that a transformer is a device that uses the principal of electromagnetic induction to transfer voltage and current from one circuit to another. The transformer uses a primary coil that’s connected to line voltage and a secondary coil that provides the output voltage.

In most power supplies, the transformer reduces the voltage. The amount of the voltage reduction depends on the ratio of the number of turns in the primary coil versus the number of turns in the secondary coil. For example, if the secondary coil has half as many turns as the primary coil, the primary coil voltage will be cut in half at the secondary coil. In other words, if 120 VAC is applied to the primary coil, 60 VAC will be available at the secondary coil.

Common secondary voltages for transformers used in low-voltage power supplies range from 6 to 24 VAC. Note that because some voltage will be lost in the rectifier and filtering stages, you’ll want to choose a secondary coil voltage that’s a few volts higher than the final DC voltage your circuit actually needs. (Note, however, that the actual DC voltage level used for most circuits isn’t all that critical. So if you’re designing a power supply for a circuit that calls for 6 VDC and you use a transformer that provides 6 VAC in its secondary coil, the output from the power supply after it’s rectified to DC voltage will be closer to 5 VDC. Most likely, 5 VDC will be close enough, and the circuit will work just fine.

Note that many transformers have more than one tap in the secondary coil. A tap is simply a wire connected somewhere in the middle of a coil, effectively dividing a single coil into two smaller coils. Multiple taps let you access several different voltages in the secondary coil. The most common arrangement is a center-tapped transformer, which provides two voltages, as shown in Figure 2-1.

image

FIGURE 2-1: A center-tapped transformer provides two output voltages.

In a center-tapped transformer, the voltage measured across the two outer taps is double the voltage measured from the center tap to either one of the two outer taps. Thus, if the voltage across the two outer taps is 24 VAC, the voltage across the center tap and either of the outer taps is 12 VAC.

technicalstuff It’s important to note that when a transformer reduces voltage, it increases current. Thus, if a transformer cuts the voltage in half, the current will double. As a result, the overall power in the system (defined as the voltage multiplied by the current) remains the same.

If the current didn’t increase as the voltage decreased, the transformer would violate a basic law of physics — the one about conservation of energy, which says that energy can’t just disappear. That’s a good thing. You don’t want to be violating the laws of physics unless you know what you’re doing or you’re in a science fiction movie, in which case you can violate the laws of physics at will.

remember A transformer is strictly an alternating current device. That means:

  • Transformers work only when alternating current is applied to the primary coil. If you apply direct current to the primary coil, no voltage will appear across the secondary coil. (Actually, there will be a brief spike of voltage across the secondary coil the moment voltage is applied to the primary coil, but in most circuits this fleeting voltage is insignificant.)
  • A step-down transformer reduces the voltage from the primary to the secondary coils but doesn’t convert alternating current to direct current. The voltage at the secondary coil is always AC.
  • A transformer isolates the circuit attached from the secondary coil from the circuit connected to the primary coil. Thus, you can use a transformer to isolate your project from line voltage.

Turning AC into DC

The task of turning alternating current into direct current is called rectification, and the circuit that does the job is called a rectifier. The most common way to convert alternating current into direct current is to use one or more diodes, those handy electronic components that allow current to pass in one direction but not the other. Diodes are covered in detail in Book 2, Chapter 5. You may want to briefly review that chapter before reading further if the concept doesn’t sound familiar.

Although a rectifier converts alternating current to direct current, the resulting direct current isn’t a steady voltage. It would be more accurate to refer to it as “pulsating DC.” Although the pulsating DC current always moves in the same direction, the voltage level has a distinct ripple to it, rising and falling a bit in sync with the waveform of the AC voltage that’s fed into the rectifier. For many DC circuits, a significant amount of ripple in the power supply can cause the circuit to malfunction. Therefore, additional filtering is required to “flatten” the pulsating DC that comes from a rectifier to eliminate the ripple. (For more on filtering, see the section, “Filtering Rectified Current,” later in this chapter.)

There are three distinct types of rectifier circuits you can build: half-wave, full-wave, and bridge. The following sections describe each of these three rectifier types.

Half-wave rectifier

The simplest type of rectifier is made from a single diode, as shown in Figure 2-2. This type of rectifier is called a half-wave rectifier because it passes just half of the AC input voltage to the output. When the AC voltage is positive on the cathode side of the diode, the diode allows the current to pass through to the output. But when the AC current reverses direction and becomes negative on the cathode side of the diode, the diode blocks the current so that no voltage appears at the output.

image

FIGURE 2-2: A half-wave rectifier uses just one diode.

Half-wave rectifiers are simple enough to build but aren’t very efficient. That’s because the entire negative cycle of the AC input is blocked by a half-wave rectifier. As a result, output voltage is zero half of the time. This causes the average voltage at the output to be half of the input voltage.

technicalstuff Note the resistor marked RL in Figure 2-2. This resistor isn’t actually a part of the rectifier circuit. Instead, it represents the resistance imposed by the load that will ultimately be placed on the circuit when the power supply is put to use.

Full-wave rectifier

A full-wave rectifier uses two diodes, which enables it to pass both the positive and the negative side of the alternating current input. The diodes are connected to the transformer, as shown in Figure 2-3.

image

FIGURE 2-3: A full-wave rectifier uses two diodes.

Notice that the full-wave rectifier requires that you use a center-tapped transformer. The diodes are connected to the two outer taps, and the center tap is used as a common ground for the rectified DC voltage. The full-wave rectifier converts both halves of the AC sine wave to positive-voltage direct current. The result is DC voltage that pulses at twice the frequency of the input AC voltage. In other words, assuming the input is 60 Hz household current, the output will be DC pulsing at 120 Hz.

Bridge rectifier

The problem with a full-wave rectifier is that it requires a center-tapped transformer, so it produces DC that’s just half of the total output voltage of the transformer. A bridge rectifier, shown in Figure 2-4, overcomes this limitation by using four diodes instead of two. The diodes are arranged in a diamond pattern so that, on each half phase of the AC sine wave, two of the diodes pass the current to the positive and negative sides of the output, and the other two diodes block current. A bridge rectifier doesn’t require a center-tapped transformer.

image

FIGURE 2-4: A bridge rectifier uses four diodes.

The output from a bridge rectifier is pulsed DC, just like the output from a full-wave rectifier. However, the full voltage of the transformer’s secondary coil is used.

You can construct a bridge rectifier using four diodes, or you can use a bridge rectifier IC that contains the four diodes in the correct arrangement. A bridge rectifier IC has four pins: two for the AC input and two for the DC output.

Filtering Rectified Current

Although the output from a rectifier circuit is technically direct current because all the current flows in the same direction, it isn’t stable enough for most purposes. Even full-wave and bridge rectifiers produce direct current that pulses in rhythm with the 60 Hz AC sine wave that originates with the 120 VAC current that’s applied to the transformer. And that pulsing current isn’t suitable for most electronic circuits.

That’s where filtering comes in. The filtering stage of a power supply circuit smoothes out the ripples in the rectified DC to produce a smooth direct current that’s suitable for even the most sensitive of circuits.

Filtering is usually accomplished by introducing a capacitor into the power supply circuit, as shown in Figure 2-5. Here, the capacitor is simply placed across the DC output.

image

FIGURE 2-5: A capacitor can be used to filter the output from the rectifier.

As you learn in Book 2, Chapter 3, a capacitor has the useful characteristic of resisting changes in voltage. It accomplishes this magic feat by building up a charge across its plates when the input voltage is increasing. When the input voltage decreases, the voltage across the capacitor’s plates decreases as well, but more slowly than the input voltage decreases. This has the effect of leveling out the voltage ripple, as shown in Figure 2-6.

image

FIGURE 2-6: A filter circuit smooths the output voltage.

The difference between the minimum DC voltage and the maximum DC voltage in the filtering stage is called the voltage ripple, or just ripple, which is usually measured as a percentage of the average voltage. For example, a 10% ripple in a 5 V power supply means that the actual output voltage varies by 0.5 V.

The filter capacitor must usually be large to provide an acceptable level of filtering. For a typical 5 V power supply, a images electrolytic capacitor will do the job. The bigger the capacitor, the lower the resulting ripple voltage.

tip Don’t forget to watch the polarity on electrolytic capacitors. The positive side of the capacitor must be connected to the positive voltage output from the rectifier, and the negative side must be connected to ground.

One way to improve the filter circuit is to use two capacitors in combination with a resistor, as shown in Figure 2-7. In this circuit, the first capacitor acts like the capacitor in Figure 2-6, eliminating a large portion of the ripple voltage. The resistor and second capacitor work as an RC network that eliminates the ripple voltage even further.

image

FIGURE 2-7: Two capacitors and a resistor cut ripple voltage but also reduce the DC output voltage.

The advantages of this circuit are that the resulting DC has a smaller ripple voltage and the capacitors can be smaller. The disadvantage is that the resistor drops the DC output voltage. How much depends on the amount of current drawn by the load. For example, if you use a images resistor and the load draws 100 mA, the resistor will drop 10 V (images). Thus, to provide a final output of 5 V, the rectifier circuit must supply 15 V because of the 10 V drop introduced by the resistor.

You can also use an inductor in a filter circuit, as shown in Figure 2-8. Unlike a resistor-capacitor filter, an inductor-capacitor filter doesn’t significantly reduce the DC output voltage. Although inductor-capacitor filter circuits create the smallest ripple voltage, inductors in the range needed (typically 10 henrys) are large and relatively expensive. Thus, most filter circuits use a single capacitor or a pair of capacitors coupled with a resistor.

image

FIGURE 2-8: An inductor can be used in a filter circuit to minimize DC voltage loss.

Regulating Voltage

The purpose of a power supply is to provide power for an electronic circuit. There’s a basic formula for calculating the amount of power circuit uses:

images

Power, measured in watts, is equal to current measured in amperes times voltage measured in volts.

If you know any two of these three elements for a circuit, you can easily calculate the third. For example, if you know that the current is 0.5 A and the voltage is 10 V, you can calculate that the circuit consumes 5 W of power by multiplying 0.5 by 10.

For a given amount of power, there’s an inverse relationship between voltage and current. Whenever current increases, voltage must decrease, and whenever current decreases, voltage must increase. This simple fact, unfortunately, has an adverse effect on power supply circuits. When you connect a voltmeter to the output terminals of a power supply, the meter itself draws an almost insignificant amount of current, so the meter reads very close to the voltage you expect to obtain from the power supply.

However, if you connect a circuit that draws significant current from the power supply, the voltage from the power supply will drop in proportion to the current. Depending on the nature of the circuit you’re connecting to the power supply, this voltage drop may or may not be a bad thing. Some circuits designed for 12 VDC will work fine if only given 9 VDC. But other circuits are sensitive to the input voltage, so the power supply needs to work harder to make sure it delivers the desired voltage.

To maintain a steady voltage level regardless of the amount of current drawn from a power supply, the power supply can incorporate a voltage regulator circuit. The voltage regulator monitors the current drawn by the load and increases or decreases the voltage accordingly to keep the voltage level constant.

tip A power supply that incorporates a voltage regulator is called a regulated power supply.

You can, if you want, design your own voltage regulator circuit using a couple of transistors, some resistors, and a Zener diode. However, it’s far too easy to buy one of the many available integrated circuit voltage regulators. Voltage regulator ICs are inexpensive (under $2) and, with just three pins to connect, easy to incorporate into your circuits.

The most popular type of voltage regulator IC is the 78XX series, sometimes called the LM78XX series. These voltage regulators combine 17 transistors, three Zener diodes, and a handful of resistors into one handy package with three pins and a heat sink that helps dissipate the excess power consumed by the regulator as it compensates for increases or decreases in current draw to keep the voltage at a constant level.

The last two digits of the 78XX ID number indicate the output voltage regulated by the IC. The most popular models are:

Model

Voltage

7805

5

7806

6

7809

9

7810

10

7812

12

7815

15

7818

18

7824

24

Of these, the most common are the 7805 (5 V) and 7812 (12), which are available at most RadioShack stores.

To use a 78XX voltage regulator, you just insert it in series on the positive side of the power supply circuit and connect the ground lead to the negative side, as shown in Figure 2-9. As this figure shows, it’s also a good idea to place a small capacitor (typically images) after the regulator.

image

FIGURE 2-9: Using a 78XX voltage regulator.

You must supply a voltage regulator with about 3 V more than the regulated output voltage. Thus, for a 7805 regulator, you should give it at least 8 V. The maximum input voltage for a 7805 is 30 V. Remember that the diodes in a bridge rectifier will drop about 3 V from the transformer output, so you’ll need a transformer whose secondary delivers at least 11 V to produce 5 V of regulated output.

Eleven-volt transformers are rare, but 12 V transformers are readily available. Thus, a 5 V regulated power supply starts with a 12 VAC transformer that delivers 12 V to the bridge rectifier, which converts the AC to DC and drops the voltage down to about 9 V and then delivers the voltage to the filter circuit, which smoothes out the ripples and passes the voltage on to the 7805 voltage regulator, which holds the output voltage at 5 V.

Another popular voltage regulator IC is the LM317, which is an adjustable voltage regulator. An LM317 regulator works much like a 78XX regulator, except that instead of connecting the middle lead directly to ground, you connect it to a voltage divider built from a pair of resistors, as shown in Figure 2-10. The value of the resistors determines the regulated voltage. In Figure 2-10, I used a potentiometer so that the user can vary the output voltage by adjusting the potentiometer.

image

FIGURE 2-10: Using an LM317 adjustable voltage regulator.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.50.156