Chapter 3

Supplying Power for Your Electronics Projects

In This Chapter

arrow Looking at how power supplies work

arrow Buying preassembled power adaptors

arrow Understanding what happens inside a power supply

With very few exceptions, electronic circuits require a power supply of some sort. Although some projects run off solar power or more exotic power sources, such as wind turbines, fuel cells or nuclear reactors, most of the projects you build are going to get their power from one of two sources: batteries or an electrical outlet. (After a tiny incident, we’ve been asked not to build another nuclear reactor in our garage!)

Electrical outlets have the compelling advantage over batteries of not dying on you at an inopportune moment (barring a power cut), although unless you use really long extension cords, you can’t take your project very far from the outlet.

We show you how to employ power from an electrical outlet, and describe using power adaptors and how power supplies work.

Powering up from Your Electrical Outlet

Most electronic circuits require a relatively low direct current (DC) voltage, typically in the range of 3 to 12 volts (V). Getting that range of voltage out of batteries is easy; because 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 use four batteries connected in series.

Powering a project from an electrical outlet is a little more challenging than using a battery for a number of reasons:

check.png The 230 V provided at the electrical outlet is much more than most circuits require, and so you have to step-down the voltage to a more appropriate level.

check.png Circuits that run directly on 230 VAC are inherently more dangerous than circuits that run on lower voltages because of the shock danger that accompanies higher voltages.

check.png Electronic circuits usually require DC and the wall outlet provides alternating current (AC). Therefore, you have to convert the AC to DC.

remember.eps The circuit that converts 230 VAC to DC at a lower voltage is called a power supply. In the later section ‘Understanding the Power Supply’, we describe the basics of power supplies. Given the low cost of off-the-shelf power supplies and the dangers inherent in working with mains voltages, however, always buy an adapter rather than ever attempting to build your own.

Using Power Adapters

You can purchase a preassembled power adapter that provides the voltage you need for just a few pounds. A power adapter, also called an adaptor or 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. An adapter with a selectable output is sometimes referred to as a power-supply unit (PSU).

As long as the power adapter supplies the correct voltage, you can use it instead of batteries in just about any circuit.

remember.eps When you buy a power adapter, check the specifications carefully to ensure that you’re purchasing the correct one. The spec is usually printed on the adapter itself. Look for the following important details, commonly listed in this order:

check.png AC or DC: Not all power adapters supply DC; some are made to power low-voltage AC devices. So make sure that you get an adapter that provides DC output.

check.png Voltage level: 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, ensure that you set the switch to the correct output level for your circuit.

check.png Current capacity: Most power adapters have a maximum current rating expressed in milliamps (mA). Smaller adapters can handle a few hundred mA, 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.)

check.png Polarity: Most power adapters use a barrel connector to plug the power adapter into the circuit. In nearly all modern power adapters, the centre connection of the barrel connector is positive and the outer connection is negative. However, some power adapters are wired the opposite way round, with negative in the centre and positive on the outside. The polarity of the connector is usually printed on the adapter along with the voltage and current specifications.

check.png Connector size: Unfortunately, far too many different sizes and styles of connectors are used for power adapters. When you’ve purchased a power adapter, you can go to your local electronics shop and buy a jack that’s compatible with the connector on the power adapter. Then, you can use the jack to connect the power adapter to your circuit. (You can buy power adapters equipped with different interchangeable plugs in different sizes from electronics shops.)

tip.eps Using a power adapter instead of building your own power supply makes your project safer to build and use, because the potentially dangerous part of your project – the part that works directly with 230 VAC mains voltage – is fully contained inside the preassembled power adapter.

You soon discover that you get what you pay for as regards power supplies. Inexpensive power adapters convert AC to DC and step-down the voltage, but most don’t provide power that’s very clean (that is, a pure level of DC) or stable (that is, with a predictable voltage). Thus, even if you use a power adapter to power your project, you may still need to add circuitry that improves the quality of the DC supplied by the adapter.

Understanding the Power Supply

To convert 230 VAC mains voltage to a DC voltage that’s suitable for your circuit, a power-supply circuit has to perform at least three distinct functions:

check.png Voltage transformation: Reduces the 230 VAC mains voltage to what your circuit needs, as we explain in the following section ‘Transforming voltage’.

check.png Rectification: Converts the reduced AC voltage to DC voltage.

remember.eps The DC voltage produced by a rectifier circuit is technically DC, but it isn’t steady DC. Instead, a rectifier produces pulsating DC in which the voltage fluctuates in sync with the 50 hertz (Hz) AC that’s fed into it from the transformation stage (assuming that the household current is 50 Hz, as it is in the UK). Check out the later section ‘Turning AC into DC’ for more details.

check.png Filtering: Smoothes out the ripples in the DC voltage produced by the rectification stage. Read the ‘Filtering rectified current’ section later in this chapter.

warning_bomb.eps Never try to build your own power supply or to convert mains voltages. Always use a mains adaptor or power supply module instead.

Transforming voltage

As we discuss in Chapter 1 of this minibook, a transformer is a device that uses the principle of electromagnetic induction to transfer voltage and current from one circuit to another. The transformer uses a primary coil that’s connected to mains 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 is cut in half at the secondary coil. In other words, if 230 VAC is applied to the primary coil, 115 VAC is 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 is lost in the rectifier and filtering stages, the secondary coil voltage has to be a few volts higher than the final DC voltage your circuit requires.

tip.eps The precise DC voltage level used for most circuits, however, isn’t all that critical. A power supply for a circuit that calls for 6 VDC would use a transformer that provides 6 VAC in its secondary coil, the output from the power supply after it’s rectified to DC voltage is going to be closer to 5 VDC. Most likely, 5 VDC is close enough for the circuit to work just fine.

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 centre-tapped transformer, which provides two voltages as shown in Figure 3-1.

In a centre-tapped transformer, the voltage measured across the two outer taps is double the voltage measured from the centre 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 centre tap and either of the outer taps is 12 VAC.

9781118589717-fg040301.eps

Figure 3-1: A centre-tapped transformer provides two output voltages.

remember.eps When a transformer reduces voltage, it increases current. So if a transformer cuts the voltage in half, the current doubles. As a result, the overall power in the system (defined as the voltage multiplied by the current) remains the same.

A transformer is strictly an AC device, which means that:

check.png Transformers work only when AC is applied to the primary coil. If you apply DC to the primary coil, no voltage appears across the secondary coil.

technicalstuff.eps Strictly speaking, a brief spike of voltage does appear across the secondary coil the moment voltage is applied to the primary coil, but in most circuits this fleeting voltage is insignificant.

check.png A step-down transformer reduces the voltage from the primary to the secondary coils but doesn’t convert AC to DC. The voltage at the secondary coil is always AC.

check.png A transformer isolates the circuit attached to the secondary coil from the circuit connected to the primary coil.

Turning AC into DC

The task of turning AC into DC is called rectification and the circuit that does the job is called a rectifier. The most common way to convert AC into DC is to use one or more diodes, those handy electronic components that allow current to pass in one direction but not the other. We cover diodes in detail in Book II, Chapter 5, and so check out that chapter if the concept doesn’t sound familiar.

Although a rectifier converts AC to DC, the resulting DC isn’t a steady voltage; more accurately it’s ‘pulsating DC’. Although the pulsating DC 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.)

Rectifier circuits come in three distinct types: half-wave, full-wave and bridge. The following sections describe these three rectifier circuits.

Handling half-wave rectifiers

The simplest type of rectifier is made from a single diode, as Figure 3-2 shows. This kind 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 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.

9781118589717-fg040302.eps

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

Half-wave rectifiers are simple but aren’t very efficient, because they block the entire negative cycle of the AC input. As a result, output voltage is zero half of the time, which causes the average voltage at the output to be half of the input voltage.

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

Finding out about full-wave rectifiers

A full-wave rectifier uses two diodes, which enables it to pass the positive and the negative side of the AC input. The diodes are connected to the transformer, as Figure 3-3 illustrates.

9781118589717-fg040303.eps

Figure 3-3: A full-wave rectifier uses two diodes.

The full-wave rectifier requires a centre-tapped transformer (see the earlier section ‘Transforming voltage’). The diodes are connected to the two outer taps and the centre 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 DC. The result is DC voltage that pulses at twice the frequency of the input AC voltage. In other words, assuming that the input to the primary side of the transformer is 50 Hz household current, the output from the rectifier on the secondary side of the transformer is going to be DC pulsing at 100 Hz.

Understanding bridge rectifiers

The problem with a full-wave rectifier is that it requires a centre-tapped transformer, and so it produces DC that’s just half of the total output voltage of the transformer.

A bridge rectifier (see Figure 3-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 centre-tapped transformer.

9781118589717-fg040304.eps

Figure 3-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.

Filtering rectified current

Although the output from a rectifier circuit is technically DC, because all the current flows in the same direction, it isn’t stable enough for most purposes. Even full-wave and bridge rectifiers (which we describe in the two preceding sections) produce DC that pulses in rhythm with the 50 Hz AC sine wave that originates with the 230 VAC that’s applied to the transformer primary side.

That pulsing current isn’t suitable for most electronic circuits, of course, which is where filtering comes in. The filtering stage of a power-supply circuit smoothes out the ripples in the rectified DC to produce a smooth DC that’s suitable for even the most sensitive of circuits.

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

9781118589717-fg040305.eps

Figure 3-5: A capacitor can be used to filter the output from the rectifier.

As you discover in Book II, Chapter 3, a capacitor has the useful characteristic of resisting changes in voltage. It accomplishes this 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 levelling out the voltage ripple, as shown in Figure 3-6.

9781118589717-fg040306.eps

Figure 3-6: A filter circuit smoothes 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 usually has to be large to provide an acceptable level of filtering. For a typical 5 V power supply, a 2,200 μF electrolytic capacitor (which we describe in Book II, Chapter 3) does the job: the bigger the capacitor, the lower the resulting ripple voltage. With an electrolytic capacitor, the positive side must be connected to the positive voltage output from the rectifier and the negative side must be connected to ground.

Two capacitors in combination with a resistor, as shown in Figure 3-7, improves a filter circuit. In this circuit, the first capacitor acts like the capacitor in Figure 3-6, eliminating a large portion of the ripple voltage. The resistor and second capacitor work as a resistor-capacitor low pass filter network that eliminates the ripple voltage even further.

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: by how much depends on the amount of current the load draws. For example, with a 100 Ω resistor and the load drawing 100 mA, the resistor drops 10 V (100 × 0.1). Thus, to provide a final output of 5 V, the rectifier circuit needs to supply 15 V because of the 10 V drop introduced by the resistor.

9781118589717-fg040307.eps

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

A filter circuit can also use an inductor, as shown in Figure 3-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 required typical range of 10 henrys (a unit of measuring inductance that we discuss in Book II, Chapter 4) are large and relatively expensive. Thus, most filter circuits use a single capacitor or a pair of capacitors coupled with a resistor.

9781118589717-fg040308.eps

Figure 3-8: You can use an inductor in a filter circuit to minimise DC voltage loss.

Regulating voltage

The purpose of a power supply is to provide power for an electronic circuit, and as we explain in Book I, Chapter 2, a basic formula is available for calculating the amount of power that a circuit uses:

P = V × I

So, power is equal to voltage multiplied by current.

If you have 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 watts of power by multiplying 0.5 by 10.

For a given amount of power, an inverse relationship exists 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 a voltmeter is connected to the output terminals of a power supply, the meter itself draws an almost insignificant amount of current. As a result, it reads very close to the voltage you expect to obtain from the power supply. But when a circuit is connected that draws significant current from the power supply, the voltage from the power supply drops in proportion to the current. Depending on the nature of the circuit connected to the power supply, this voltage drop may or may not be important. Some circuits designed for 12 VDC work fine if given only 9 VDC. But other circuits are sensitive to the input voltage, and so the power supply needs to work harder to make sure that it delivers the desired voltage.

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

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

Voltage regulator circuits can be designed using a couple of transistors, some resistors and a Zener diode, but buying one of the many available IC voltage regulators is far easier. Voltage regulator ICs are inexpensive (they cost a few pounds) and, with just three pins to connect, they’re easy to incorporate into 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 V), which are available from most electronics component distributors.

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 we show in Figure 3-9. As you can see, placing a small capacitor (typically 1 μF) after the regulator is a good idea.

You have to supply a voltage regulator with about 3 V more than the regulated output voltage. Thus, for a 7805 regulator, you have to give it at least 8 V. The maximum input voltage for a 7805 is 35 V.

9781118589717-fg040309.eps

Figure 3-9: Using a 78XX voltage regulator.

remember.eps The four diodes in a bridge rectifier (see the earlier section ‘Understanding bridge rectifiers’ for details) each drop about 3 V from the transformer output, and so a transformer whose secondary coil delivers at least 11 V is required to produce 5 V of regulated output.

tip.eps The Mains to DC PSU section can be bought as a ready-made and relatively safe mains adaptor or PSU module; then you can add the DC-DC regulator electronics to get the output you want.

Eleven-volt transformers are rarer than shy reality-TV stars, 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. This filter 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. The LM317 regulator works much like a 78XX regulator, except that instead of connecting the middle lead directly to ground, it connects to a voltage divider built from a pair of resistors, as shown in Figure 3-10. The value of the resistors determines the regulated voltage. In Figure 3-10, we use a potentiometer so that the user can vary the output voltage (flip to Book II, Chapter 2, for more about using potentiometers).

9781118589717-fg040310.eps

Figure 3-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