Home‎ > ‎

AC-DC Power Supplies - Using Wall Warts

This article was originally published on Digital-DIY and is an original work by Jon Chandler. It is licensed under a Creative Commons 3.0 BY SA agreement.
Featured on Hack-A-Day.

One thing all of our projects need is a power supply.  Sometimes batteries are the best answer, but often a AC line-power - DC supply is the right answer.  Linear power supplies are easy to build but a "wall wart" is usually cheaper and easier to use.  Wall warts come in a confusing array of shapes and sizes.  This article will cover some power supply basics and provide guidance for selecting and using these useful power supplies.

Background

In order to select an appropriate power supply, several factors must be considered.

The first consideration in selecting a power supply is whether the board you're powering has a voltage regulator.  If you designed the board, you should know :)  If you're working with a dev board, the acceptable supply voltage should be specified in the documentation.  Using mrbasher's board as an example, if the board has a regulator, it will usually be located near the power connector and look something like the photo below.  Not all voltage regulators use this TO-220 package shown but it is quite common.

The next consideration is what voltage the parts on the board actually need.  Many PIC circuits require 5 volts but 3.3 volts is becoming common too.  If the board does not have an on-board regulator (the TAP-28 board is a prime example), we'll need a regulated power supply of the correct voltage.  If there is a regulator on the board, the power supply will have to supply a voltage higher than the regulator voltage + the regulator dropout voltage.  Some details follow.

The next consideration is how much current the board draws.  This is the current to power the chips, light the LEDs, power  anything attached to the board and to support any pull-up or pull-down resistors on the board.  LEDs and other things attached to the board are probably the biggest draw.  Still using mrbasher's board as an example, the resistors look to be 270 ohms, and a typical green LED has a voltage drop of 2.1 volts, so

$I_L_E_D = \frac{(V_S_u_p_p_l_y - V_f_ _L_E_D)}{R} = \frac{(5v - 2.1v)}{270\Omega} = 10.7 mA$

We'll call it 11 mA per LED x 8 LEDs = 88 mA when all the LEDs are illuminated.  The current for the PIC and the 74HC595 shift register won't add much, so our power budget is around 100 mA.

Our power supply has to supply at least 100 mA, but more current is ok..  The circuit draws only the current it needs to operate.  If the power supply is rated for say 1000 mA, it's going to be perfectly happy loafing along  supplying 100 mA or less.

Back to the question of what voltage is needed.  Assume the voltage regulator is an LM7805.  The dropout voltage for a LM7805 is 2 volts.  Think of this as the overhead it needs to work.  The maximum voltage an LM7805 can handle is 35 volts.  So any voltage between 7 volts (Vreg + Vdropout) and 35 volts (the maximum voltage) will provide a 5 volt output from the regulator.  Piece of cake.... Unfortunately, it's not quite this simple.  LDOs (low dropout) regulators are available that reduce the needed overhead voltage.

The LM7805 is a linear regulator (the following applies to all linear regulators).  The current into the regulator is the same as the current out of the regulator.  Our circuit uses about 500 mW maximum (5 volts x 100 mA = 500 mW).  If we supply 35 volts to the regulator, a total of 30 volts is dropped or lost across the regulator.  30 volts x 100 mA = 3 watts.  Where does this energy go?  Heat.  Have you ever burned your finger on a night light bulb?  They draw 4 watts.  Our regulator isn't going to be too happy dissipating this much power.

The voltage supplied to the regulator should be close to the voltage it needs to work to minimize power dissipation.  What happens if we supply it with 9 volts?  The drop  across the regulator is 4 volts, so the power is 400 mW.  This change drops the power dissipation by a factor of 10 and now our regulator is happy.  How high a voltage level is acceptable depends on the current draw of the circuit.  If the current draw is high, the voltage should be close to the voltage needed by the regulator.  If the current draw is low, there's more latitude.  The maximum allowable voltage depends on the actual regulator used.  The equation below is the power dissipated by the regulator:

$P_r_e_g_u_l_a_t_o_r = (V_s_u_p_p_l_y - V_r_e_g_u_l_a_t_o_r)I_l_o_a_d$

Summarizing:

Current must be greater than the maximum draw of the circuit being powered but anything larger is ok

Voltage for a board without a regulator must be regulated at the voltage required

Voltage for a board with a regulator must be greater than Vreg + Vdropout but not too much higher

Linear Supplies

A linear power supply is pretty simple.  A few principles will help in understanding how to use wall warts.  A transformer reduces line-level AC to a lower voltage.  The low voltage is converted to pulsing DC using either half or full-wave rectification as shown below.  Half-wave rectification uses only one side of the AC power; full-wave rectification "flips over" the negative part of the sine wave so it uses the full potential of the AC power.  The pulses vary in level between 0 volts and √2 x the RMS voltage of the transformer.  As an example, the peak voltage from a 12 volt RMS transformer is almost 17 volts.  The illustrations below neglect the voltage drop across the rectifier diodes, which is a function of diode type and the current through the diode.

The magenta lines above show the resulting waveforms.  This pulsating voltage isn't too useful for powering circuits.  A large value filter capacitor must be added to the basic circuit to provide a DC voltage.  The capacitor charges to the peak value when the pulsating wave is at the peak and discharges through the load until the next cycle of the sine wave as shown below.

The ripple voltage depends on the value of the capacitor and the load current.  Drawing more current increases the ripple.  A larger value of filter capacitance reduces ripple.

The load current effects the RMS level of the transformer and the voltage drop across the rectifier diodes .  As the load increases, the voltage falls.

Without a regulator, the output voltage and ripple are dependent on load current.

Regulated Supplies

Adding voltage regulation to a basic linear supply is simple, often requiring nothing more than a regulator and a couple capacitors, as shown below.  You may wonder about the input capacitor in parallel with the filter capacitor.  Since they just add together, adding a tiny amount of capacitance to the large filter capacitor doesn't seem to accomplish anything.  The smaller capacitor reacts better to high frequency transients.

They circuits are included here to aid in understanding how to use wall wart power supplies.  These basic circuits are functional but improvements can be made for specific applications.

Switching Power Supplies

A detailed description of switching power supplies is beyond the scope of this article.  Wikipedia has a nice explanation of their operation.  A key feature for our discussion is that the output voltage of switching power supplies is most often regulated although some switching power supplies are designed for other purposes, such as being a constant-current supply for driving LEDs.

Wall Warts

Wall warts are those ubiquitous power supply modules that come with cell phones and many other electronics products.  Wall warts that are intended to power electronics are well designed power supplies and can be useful for many different applications, including powering development boards and finished projects.  Some wall warts that are built to run electric razors and charge batteries of cheap devices may not be suitable for our applications.

Wall warts fall into three basic types:

AC Output:  these are essentially just the transformer shown in the examples above and provide low-voltage AC power.  The receiving device must have the rectifiers and rest of the circuitry shown above.  These are not too useful for our intended purpose.

Linear DC Supplies:  These units have a transformer, rectification circuit and usually filter capacitors shown in the circuits above.  Rarely do they include voltage regulators, so the output voltage is a function of load current.  These are ideal for devices with on-board voltage regulators, but should not be used with devices requiring a regulated voltage.

Switch mode DC Supplies:  These units use switch mode technology to convert line-voltage AC to regulated DC.  A supply of this type of the correct voltage may be used to power a circuit requiring regulated voltage or may be used to power a circuit that includes a regulator as long as its output voltage is greater than the regulator operating voltage.

In order to demonstrate the differences between linear and switch mode supplies, I've tested a number of supplies to show how they react to output current.  The first group of supplies tested includes a total of 7 linear supplies and switchers rated at 12 volts and between 1 & 1.6 amps output.  The photo below shows the collection of power supplies.  Photos and ratings of each supply follow.  As you can see, they come in many shapes and sizes.  Wall warts are available across the voltage and current range; these 7 wall warts were selected because they have similar specifications.  Supplies of other voltages will behave in the same way.  Clicking on the ratings or plot links for each wall wart will bring up detailed rating information and test data.

 Supply E Manufacturer: Delta Electronics Model:  ADP 17 FB A Input Voltage:  100 - 240 Output Voltage:  12 Output Current:  1.42 Amps Type:  Switcher Weight:  94 grams Density: 0.18 watts/gram Links: Ratings    Plot Comments:

 Supply H Manufacturer: DVE Model:  DSA-18W-12 US1 120180 Input Voltage:  100 - 240 Output Voltage:  12 Output Current:  1.5 Amps Type:  Switcher Weight:   121 grams Density:  0.15 watts/gram Links:    Ratings    Plot Comments:

 Supply D Manufacturer: Panasonic Model:  BZ-K2898B put Voltage:  120 Output Voltage:  12 Output Current:  1.5 Amps Type:  Linear Weight:   746 grams Density: 0.024 watts/gram Links:    Ratings    Plot Comments:

 Supply L Manufacturer: unknown Model:  E-AWB120-120A Input Voltage:  100 - 240 Output Voltage:  12 Output Current:  1 Amp Type:  Switcher Weight:   71 grams Density: 0.17 watts/gram Links:    Ratings    Plot Comments:

 Supply M Manufacturer: Danford - Best Connectivity Model:  SWP 15 -1216 Input Voltage:  100 - 240 Output Voltage:  12 Output Current:  1.6 Amp Type:  Switcher Weight:   140 grams Density: 0.14 watts/gram Links:    Ratings    Plot Comments:

 Supply N Manufacturer: unknown Model:  E-AWB120-120A Input Voltage:  100 - 240 Output Voltage:  12 Output Current:  1 Amp Type:  Linear Weight:   450 grams Density: 0.027 watts/gram Links:   Ratings    Plot Comments:

 Supply O Manufacturer: unknown Model:  E-AWB120-120A Input Voltage:  100 - 240 Output Voltage:  12 Output Current:  1 Amp Type:  Linear Weight:   440 grams Density: 0.027 watts/gram Links:   Ratings      Plot Comments:

Measurements were made of output voltage vs load current in 10% steps from 0% (no load) to 130% of rated load.  Results for the group are shown on the plot below.  Data for individual supplies may be seen by clicking on the plot link in the table above.

The results clearly break down into two groups: 1) those that maintain the desired voltage over the load range and 2) those whose output voltage varies widely with load current.  One of the supplies puts out nearly 17 volts when it's unloaded.  That would be bad news if our circuit was expecting a regulated 12V supply!

If you compare the above measurements to the details of each supply above, you'll see that all of the measurements that vary widely from our target of 12 volts come from linear supplies.  The group that is close to our target of 12 volts contains the switching power supplies.

The Linear Supplies

Let's look at the linear supplies in more detail.  The graph below shows that at light load, the voltage is higher than the rated voltage.  The output voltage is near the rated value only when the full load is drawn.  This is exactly what's expected from the basic DC supplies without regulators discussed above.  Linear wall warts seldom if ever include voltage regulation, usually consisting of a transformer, rectifiers and filter capacitors.

Since linear supplies usually do not include voltage regulation, they are only useful for supplying circuits that have an integrated voltage regulator.  Keep in mind that the power supply voltage must be greater  than Vreg + Vdropout.  If the regulator is a standard dropout type, correct operation of the regulator with a 12 volt supply like these shown is only ensured for a maximum regulated voltage of 10 volts.

The Switching Supplies

In contrast to the linear supplies, the switching power supplies tested maintain their voltage across the load range.  In fact, from 0 to 100%, the supplies tested are within 3% of the target voltage.

The switching supplies are suitable for both boards requiring regulated voltage or having an integrated regulator if the output voltage is greater than the regulator's operating voltage.

Practical Aspects of Using Wall Wart Power Supplies

Now that we know a little about what's needed in a power supply and the output characteristics of some representative units, let's consider the practical aspects of putting them to use.

The first question, why a wall wart over alternatives?  If you're testing a circuit on the bench, a lab power supply is a nice option.  You can adjust the voltage to what you need and even examine the affects of changing the voltage.  Some supplies include metering to keep an eye on current draw.  A PICkit 2 or PICkit 3 is great for powering microcontroller circuits too.

At some point you'll want to deploy your device in the real world or you may want to keep your circuit running while you use for lab supply for something else.  Options include powering by batteries which works great for 3.3 volt chips like the PIC18F25K20 but this isn't a practical solution for a device that's going to run full time.  If a line-powered supply is desired, you could build one as shown near the start of this article, but transformers aren't cheap and you'll need a bunch of other parts and an enclosure.  Often, using a wall wart is the cost-effective, expeditious answer.  You may have some leftover from long-ago replaced cell phones and other electronics, but if not, most thrift shops and computer recyclers have dozens to choose from in many different voltages and current ranges.

For a couple bucks, you can get a high quality, UL or CSA rated supply and have no worries about hazardous voltages.  This is cheaper than the postage to buy the parts to build your own.

Identifying Supply Type

Based on the discussion above, determine the best type of supply for your needs, the voltage needed and the minimum current needed.  Keep in mind that a larger current rating won't have any impact on powering your circuit.

So how do we know if a wall wart is a linear or switcher supply?  Here are some typical characteristics:
Linear Supply
• Input voltage will be a single value or a small range (e.g., 120 VAC or 110 - 120 VAC)
• Supply will be roughly an equal-sided cube shape
• Supply will be heavy for the size

A liner supply has a transformer similar to the photo at left.  The transformer has an iron core (the gray laminations in the photo) with copper wire wound around it (the paper-covered part with the leads sticking out) so it's fairly heavy.  The housing will be roughly cube shaped to allow room for the transformer with a little extra room for the rectifiers and filter capacitors.  The picture at right shows the transformer, 4 rectifier diodes in a bridge arrangement and a filter capacitor.

Notice that the filter capacitor shown is relatively small.  Some linear supplies skimp on filtering, which will result in larger ripple levels.  With some supplies, additional filter capacitors prior to the voltage regulator will be needed.

(photos courtesy Wikipedia)

Switching Supply
• Input voltage usually covers a wide range, typically 100 - 240 VAC
• Enclosure will be sleekly shaped
• Supply will be light

A switching power supply uses a much smaller transformer, possible because it's operating at a high frequency (several kHz or higher), so this type of supply will be smaller, lighter and not constrained to a cube shape.  The photo below (from hackedgadgets.com) shows a typical switching power supply.  Note the small transformer, surrounded by additional components.  Switching power supplies are also able to handle a wide range of input voltage and are often designed to be compatible with power systems around the world.

If you refer back to the power supply details above, you'll see these characteristics.  Particularly note the "energy density" which is rated output power (watts) per gram.  The switching supplies output about ten times more power per gram.  If you click the rates link next to each supply, you can see the ratings for each supply.

Checking Out a Candidate Power Supply

Wall warts are designed for many purposes and it's often not possible to tell from the nameplate if there are any unique features that could interfere with our re-purposing.  Therefore, I would suggest a quick check with a voltmeter before connecting an unknown supply to a circuit.  Some switching supplies of older designs don't work properly at no load which our simple testing will also check.

A variety of connectors are used on wall warts.  "Standard" coaxial connectors (which are anything but standard), proprietary cell phone connectors and USB connectors of several types are some of the possibilities you may find.  A successful "shopping trip" to the local thrift stores may turn up exactly the supply you want (right output and connector) but don't worry too much if you can't find a supply with the desired ratings and the correct connector.  Connections to dev boards are often made using screw terminals, so the connector isn't a concern.  If your target board has a

connector but you can't find a supply with the correct ratings and a mating connector, you might buy two wall warts - one with the correct output ratings and a second with the correct connector.  If you do find a supply with the correct size of connector, be sure to check the polarity  as well.  There is no standard arrangement.  Polarity is often marked on the enclosure.

Two parameters are important to coaxial power connectors in addition to polarity.  The OD (outer diameter) and ID (inner diameter) of the plug must match the socket.  If the OD is too large or the ID is too small, the connector simply won't fit.  A worse situation is when the OD is correct but the ID is too large.  The connector will appear to fit, but the clearance between the inner sleeve of the plug and the pin of the socket can be so large that they don't touch at all and no connection will be made.

Something to watch out for is reversed coaxial connectors.  Rather than a hole (sleeve) in the middle, there's a pin.  These are used on some computer power supplies; there's actually a third contact on the inside of the connector for data communication to validate the supply.

If the connector is wrong or not needed, cut it off; you may wish to leave some length of cable on the connector just in case it turns out to be the right size for something else.  Strip the jacket to expose the conductors.  You'll probably find one of three situations:  1) the cable is zip cord and the 2 conductors can easily be separated, 2) the supply has a round cable with 2 conductors inside or 3) the supply has a round cable with a insulated center conductor and outer shield.  If your supply has more than 2 conductors, it may be a multi-voltage supply or it may contain additional circuitry to charge batteries or for some other function.

The photos above show two types of cables that may be found.  The color of the conductors may or may not indicate polarity.  It's always safest to check since mistakes may damage your dev board or circuit.

Measure the DC voltage from the supply, paying attention to polarity.  If the color code is not something like red (positive) and black (negative) as is the case in the left picture, it's a good idea to label the cable to avoid problems later.  Also note the voltage.  If you have a regulated switching supply, it should measure approximately the value shown on the nameplate.  If this is the case, the supply should be ready to use with no minimum load required.  If the supply is a linear unit, it may measure up to √2 x the nameplate voltage.  For a 12-volt rated supply:

Using A Wall Wart

Once the voltage and polarity is verified, the power supply can be connected to the dev board or other circuit.  If the connection is made using a terminal block, connect the leads ensuring correct polarity.  If the supply has the mating connector for the circuit, plug it in.  If the connector on the power supply doesn't fit, a new one can be installed.  A new connector might be soldered on to the cable or a connector salvaged from another power supply.  If splicing on a salvaged connector, a Western Union splice covered with heat shrink tubing is an excellent way of making the connection.

A Brief Look at 5 Volt Supplies

The above comparison of 12 volt supplies is a good summary and illustrates the differences between linear and switching supplies.  Since many of our circuits require a 5 volt supply and there are some unique features with 5 volt supplies, I've tested a small sample of these as well.  This collection only includes regulated 5 volt switchers as there are few if any linear wall wart supplies in this category.  Cell phone chargers are easy to find which supply 500 mA or more.

Two unique types of power supplies in this group are USB power modules (supplies J & K above) which have a connector for a USB cable and supplies that have a cable fitted with a USB connector.  This is handy for powering a board that has a USB connector, such as the TAP-28 board.  Be aware however that USB connectors come in several sized and types; a good eye may be necessary to select the desired connector.

 Supply K Manufacturer: Flextronics Model: 09500043-210 Input Voltage:  100 - 240 Output Voltage:  4.9 Output Current:  0.85 Amps Type:  Switcher Weight:   22 grams Density: 0.19 watts/gram Links:     Ratings    Plot Comments:

 Supply J Manufacturer: Belkin Model: UTC001C Input Voltage:  100 - 240 Output Voltage:  5 Output Current:  1 Amps Type:  Switcher Weight:   43 grams Density:  0.12 watts/gram Links:     Ratings    Plot Comments:

 Supply B Manufacturer: Samsung Model: TAD037JBE Input Voltage:  100 - 240 Output Voltage:  5.0 Output Current:  0.7 Amps Type:  Switcher Weight:   48 grams Density: 0.07 watts/gram Links:     Ratings    Plot Comments:

 Supply P Manufacturer: Phihong Model: PSM11R-50 Input Voltage:  100 - 240 Output Voltage:  5.0 Output Current:  2 Amps Type:  Switcher Weight:   grams Density: Links:     Ratings    Plot Comments:

 Supply Q Manufacturer: Motorola Model: FMP5185B Input Voltage:  100 - 240 Output Voltage:  5.0 Output Current:  0.55 Amps Type:  Switcher Weight:   grams Density: Links:     Ratings    Plot Comments:

Output voltage vs percentage load for the group of 5 volt supplies is shown below.  The plot shows an interesting feature of some switching supplies - the output is self-limiting in the event of overload to prevent damage to either the supply or whatever is connected to it.  The dashed vertical magenta line is the rated output level.  If the current draw is in excess of the rated load, the voltage falls dramatically, limiting power dissipated in the supply.

Conclusions

We've covered some basics of power supplies in this article to aid in understanding wall wart performance, learned how to determine what voltage a dev or application board requires and considered linear vs switching power supply applications.  We can make the following conclusions about wall wart power supplies:

• Linear power supplies rarely include voltage regulation so they should only be used to power boards that contain a voltage regulator.  The output voltage at less than full load will exceed the rated voltage by as much as a factor of √2. Filter capacitors in some supplies are on the small side, so additional filtering may be needed..
• Switching power supplies will operate at close to their rated voltage over the load range, so they may be used to supply boards requiring regulated voltage.  Switching power supplies may also be used to power boards which have an integrated voltage regulator as long as the voltage is greater than the regulator operating voltage (i.e., Vreg + Vdropout)
• Voltage supplied to a board with an integrated linear regulator should not be too much greater than the regulator operating voltage (i.e., Vreg + Vdropout) to limit power dissipation and heating in the regulator.
• The current rating of a power supply must be greater than the current drawn by the circuit being powered but the circuit will draw no more power than it needs from the supply.

Wall warts provide an easy, cost effective means of powering microcontroller boards.