Showing posts with label teardown. Show all posts
Showing posts with label teardown. Show all posts

Apple iPhone charger teardown: quality in a tiny expensive package

This article is now available in Vietnamese Bộ sạc iPhone của Apple.
Disassembling Apple's diminutive inch-cube iPhone charger reveals a technologically advanced flyback switching power supply that goes beyond the typical charger. It simply takes AC input (anything between 100 and 240 volts) and produce 5 watts of smooth 5 volt power, but the circuit to do this is surprisingly complex and innovative.

Inside the Apple iPhone charger. The two circuit boards and the USB jack are visible. The AC connection is at the back.

How it works

The iPhone power adapter is a switching power supply, where the input power is switched on and off about 70,000 times a second in order to get the exact output voltage required. Because of their design, switching power supplies are generally compact and efficient and generate little waste heat compared to simpler linear power supplies.

In more detail, the AC line power is first converted to high voltage DC[1] by a diode bridge. The DC is switched on and off by a transistor controlled by a power supply controller IC. The chopped DC is fed into a flyback[2] transformer which converts it into low voltage AC. Finally, this AC is converted into DC which is filtered to obtain smooth power free of interference, and this power is output through the USB jack. A feedback circuit measures the output voltage and sends a signal to the controller IC, which adjusts the switching frequency to obtain the desired voltage.

Apple iPhone charger, showing the fusible resistor (striped), inductor (green) and Y capacitor (blue). The two electrolytic filter capacitors are behind (black)

The side view above shows some of the larger components. The charger consists of two circuit boards, slightly under one inch square each.[3] The top board is the primary, which has the high voltage circuitry, and the bottom board, the secondary, has the low voltage output circuitry. The input AC first passes through a fusible resistor (striped), which will break the circuit if there is a catastrophic overload. The input AC is converted to high-voltage DC, which is smoothed by the two large electrolytic capacitors (black with white text and stripe) and the inductor (green).

Inside the iPhone charger. Switching transistors, filter capacitor, and fusible resistor are on top. USB connector on bottom. Transformer wires were cut for disassembly.

Next, the high voltage DC is chopped at high frequency by a MOSFET switching transistor, which is the large three-pinned component in the upper left. (The second transistor clamps voltage spikes, as will be explained below.) The chopped DC goes to the flyback transformer (yellow, barely visible behind the transistors), which has low voltage output wires going to the secondary board below. (These wires were cut during disassembly.) The secondary board converts the low voltage from the transformer to DC, filters it, and then feeds it out through the USB connector (the silver rectangle in the lower left). The gray ribbon cable (just barely visible on the lower right under the capacitor) provides feedback from the secondary board to the controller IC to keep the voltage regulated.

Inside the iPhone charger: input inductor (green), Y capacitor (blue), flyback transformer (yellow), USB connector (silver). The primary circuit board is on top and the secondary board on the bottom.

The picture above shows the flyback transformer (yellow) more clearly, above the USB jack. The large blue component is a special "Y" capacitor[4] to reduce interference. The controller IC is visible above the transformer on the top of the primary board.[5]

The circuit in detail

The primary

Apple iPhone charger, showing the primary circuit board with some components removed

The primary circuit board is packed with surface mounted components on both sides. The inner side (diagram above) holds the large components while the outer side (diagram below) has the controller IC. (The large components were removed in the diagrams, and are indicated in italics.) Input power is connected to the corners of the board, goes through the 10Ω fusible resistor, and is rectified to DC by the four diodes. Two R-C snubber circuits absorb EMI interference created by the bridge.[6] The DC is filtered by the two large electrolytic capacitors and the inductor, producing 125-340V DC. Note the thickness of the circuit board traces connecting these capacitors and other high-current components compared to the thin control traces.

The power supply is controlled by an 8-pin STMicrosystems L6565 quasi-resonant SMPS controller chip.[7] The controller IC drives the MOSFET switching transistor which chops the high voltage DC and feeds it into the primary winding of the flyback transformer. The controller IC takes a variety of inputs (secondary voltage feedback, input DC voltage, transformer primary current, and transformer demagnetization sensing) and adjusts the switching frequency and timing to control the output voltage through complex internal circuitry. The current sense resistors let the IC know how much current is flowing through the primary, which controls when the transistor should be turned off.

The second switching transistor, along with some capacitors and diodes, is part of a resonant clamp circuit that absorbs voltage spikes on the transformer. This unusual and innovative circuit is patented by Flextronics.[8][9]

The controller IC needs DC power to run; this is provided by an auxiliary power circuit consisting of a separate auxiliary winding on the transformer, a diode, and filter capacitors. Since the controller IC needs to be powered up before the transformer can start generating power, you might wonder how this chicken-and-egg problem gets solved. The solution is the high-voltage DC is dropped to a low level through startup power resistors to provide the initial power to the IC until the transformer starts up. The auxiliary winding is also used by the IC to sense transformer demagnitization, which indicates when to turn on the switching transistor.[7]

Primary circuit board from Apple iPhone charger, showing the L6565 controller IC

The secondary

On the secondary board, the low voltage AC from the transformer is rectified by the high-speed Schottky diode, filtered by the inductor and capacitors, and connected to the USB output. The tantalum filter capacitors provide high capacitance in a small package.

The USB output also has specific resistances connected to the data pins to indicate to the iPhone how much current the charger can supply, through a proprietary Apple protocol.[10] An iPhone displays the message "Charging is not supported with this accessory" if the charger has the wrong resistances here.

Secondary circuit board from the iPhone charger. Optocouplers are in the upper left. Feedback circuitry is in the lower left. Filter inductor (1R5), capacitor (330), and diode (SCD 34) provide output

The secondary board contains a standard switching power supply feedback circuit that monitors the output voltage with a TL431 regulator and provides feedback to the controller IC through the optocoupler. A second feedback circuit shuts down the charger for protection if the charger overheats or the output voltage is too high.[11] A ribbon cable provides this feedback to the primary board.

Isolation

Because the power supply can have up to 340V DC internally, safety is an important issue. Strict regulations govern the separation between the dangerous line voltage and the safe output voltage, which are isolated by a combination of distance (called creepage and clearance), and insulation. The standards[12] are somewhat incomprehensible, but roughly 4mm of distance is required between the two circuits. (As I discuss in Tiny, cheap, dangerous: Inside a (fake) iPhone charger, cheap chargers totally ignore these safety rules.)

You might expect the primary board to have the dangerous voltages and the secondary board to have the safe voltages, but the secondary board consists of two areas: the hazardous area connected to the primary board, and the low-voltage area. The isolation boundary between these areas is about 6mm in the Apple charger and can be seen in the above diagram. This isolation boundary ensures that dangerous voltages cannot reach the output.

There are three types of components that cross the isolation boundary, and they must be specially designed for safety. The key component is the transformer, which provides a way for electrical power to reach the output without a direct electrical connection. Internally, the transformer is extensively insulated, as will be shown below. The second component type is the optocouplers, which send the feedback signal from the secondary to the primary. Internally, the optocoupler contains a LED and a photo-transistor, so the two sides are connected only by light, not by an electrical circuit. (Note the silicone insulation on the secondary side of the optocouplers to provide extra safety.) Finally, the Y capacitor is a special type of capacitor[4] that lets EMI (electromagnetic interference) escape between the high-voltage primary and the low-voltage secondary.

The secondary (left) and primary (right) circuit boards of the Apple iPhone charger. Note the The flyback transformer (yellow), Y capacitor (blue), filter capacitors (black cylinders), and USB connector (silver on left)

The above picture shows some of the isolation techniques. The secondary board (left) has the blue Y capacitor. Note the lack of components in the middle of the secondary board, forming an isolation boundary. The components on the right of the secondary board are connected to the primary board by the gray ribbon cable so they are at potentially high voltages. The other connection between the boards is the pair of wires from the flyback transformer (yellow) delivering the output power to the secondary board; these were cut to separate the boards.

Schematic

I've put together an approximate schematic showing the charger circuit.[13] Click for a larger version.

Schematic for the Apple iPhone charger

These circuits are very small

Looking at these pictures, it's easy to lose track of how very small these components are, and how the charger crams all this complexity into one inch. The following slightly magnified picture shows a quarter, a grain of rice, and a mustard seed to give a size comparison. Most of the components are surface-mount devices which are soldered directly to the printed circuit board. The smallest components, such as the resistor pointed out in the picture, are known as "0402" size since they are .04 inches by .02 inches. The larger resistors to the left of the mustard seed handle more power and are known as "0805" size since they are .08 x .05 inches.

Apple iPhone charger circuit board compared to a mustard seed, grain of rice, and quarter.

Transformer teardown

The flyback transformer is the key component of the charger, the largest component, and probably the most expensive.[14] But what's inside? I took apart the transformer to find out.

The transformer measures roughly 1/2" by 1/2" by 1/3". Inside, the transformer has three windings: a high voltage primary input winding, a low voltage auxiliary winding to provide power to the control circuits, and a high-current low voltage output winding. The output winding is connected to the black and white wires coming out of the transformer, while the other windings are connected to the pins attached to the bottom of the transformer.

The outside of the transformer has a couple layers of insulating tape. The second line appears to start with "FLEX", for Flextronics. Two grounded strands of wire are wrapped around the outside of the transformer to provide shielding.

Flyback transformer from Apple iPhone charger.

After removing the shielding and the tape, the two halves of the ferrite core can be removed from the windings. Ferrite is a rather brittle ceramic material, so the core broke during removal. The core surrounds the windings and contains the magnetic fields. Each core piece is roughly 6mm x 11mm x 4mm; this style of core is known as EQ. The circular center section is very slightly shorter than the ends, creating a small air gap when the core pieces are put together. This 0.28mm air gap stores the magnetic energy for the flyback transformer.

EQ Ferrite cores and windings from Apple iPhone charger.

Underneath the next two layers of tape is a 17-turn winding of thin varnished wire, which I think is another shield winding to return stray interference to ground.

Shield winding from Apple iPhone charger

Underneath the shield and another two layers of tape is the 6-turn secondary output winding that is connected to the black and white wires. Note that this winding is heavy-gauge wire, since it is feeding the 1A output. Also note that the winding is triple-insulated, which is a UL safety requirement to ensure that the high voltage primary remains isolated from the output. This is one place where cheap chargers cheat - they just use regular wire instead of triple-insulated, and also skimp on the tape. The result is there's not much protecting you from high voltage if there's an insulation flaw or power surge.

Secondary output winding from iPhone charger flyback transformer

Under the next double layer of tape is the 11-turn heavy gauge primary power winding, that powers the controller IC. Since this winding is on the primary side, it doesn't need to be triple insulated. It's just insulated with a thin layer of varnish.

Auxiliary winding from iPhone charger flyback transformer

Under the final double layer of tape is the primary input winding, which is 4 layers of approximately 23 turns each. This winding receives the high voltage input. Since the current is very low, the wire can be very thin. Because the primary has about 15 times as many turns as the secondary winding, the secondary voltage will be 1/15 the primary voltage, but 15 times the current. Thus, the transformer converts the high voltage input to low voltage, high current output.

Primary winding from iPhone charger flyback transformer

The final picture shows all the components of the transformer; left to right shows the layers from the outside tape to the innermost winding and bobbin.

Complete disassembly of iPhone charger flyback transformer

Apple's huge profit margins

I was surprised to realize how enormous Apple's profit margins must be on these chargers. These chargers sell for about $30 (if not counterfeit), but that must be almost all profit. Samsung sells a very similar cube charger for about $6-$10, which I also disassembled (and will write up details later). The Apple charger is higher quality and I estimate has about a dollar's worth of additional components inside.[14] But it sells for $20 more.

Apple's 2008 charger safety recall

Designed by Apple in California. Model No A1265 Made in China. Input: 100-240V 50/60 Hz 0.15A. Output 5V 1A.  54PT. E233466 ITE.  UL listed Power Supply Flextronics.  Apple Japan. CAUTION: For use with information technology equipment. Marked with green dot.

In 2008, Apple recalled the iPhone chargers due to a defect that the AC prongs could fall off the charger and get stuck in an outlet.[15] The faulty chargers had the prongs attached with what was described as little more than glue and "wishful thinking".[15] Apple replaced the chargers with a redesigned model indicated by the green dot marking shown above (which counterfeit chargers inevitably imitate).

I decided to see what safety improvements Apple made in the replacement charger, and compare with other similar chargers. I tried pulling out the prongs of the Apple charger, a Samsung charger, and a counterfeit charger. The counterfeit prongs came out with a tug with pliers, as there's basically nothing anchoring them but friction. The Samsung prongs took a lot of pulling and twisting with pliers, since they have little metal tabs holding them in place, but eventually they came out.

When I moved on to the Apple charger, the prongs didn't budge, even with my hardest pulling with pliers, so I got out the Dremel and ground through the case to find out what was holding the prongs. They have large metal flanges embedded in the plastic of the case, so there's no way a prong can come loose short of the destruction of the charger. The photo shows the Apple plug (note the thickness of plastic removed from the right half), the prong from the counterfeit charger held in only by friction, and the Samsung prong held in by small but sturdy metal tabs.

AC prongs of iPhone charger, counterfeit charger, and Samsung charger, showing the large embedded flange holding the Apple prongs in place for safety

I'm impressed with the effort Apple put into making the charger more safe after the recall. They didn't just improve the prongs slightly to make them more secure; clearly someone was told to do whatever it takes to make sure there's absolutely no way the prongs could possibly come loose again under any circumstances.

What makes Apple's iPhone charger special

Apple's power adapter is clearly a high-quality power supply designed to produce carefully filtered power. Apple has obviously gone to extra effort to reduce EMI interference, probably to keep the charger from interfering with the touchscreen.[16] When I opened the charger up, I expected to find a standard design, but I've compared the charger to the Samsung charger and several other high-quality industry designs,[17] and Apple goes beyond these designs in several ways.

The input AC is filtered thorugh a tiny ferrite ring on the plastic case (see photo below). The diode bridge output is filtered by two large capacitors and an inductor. Two other R-C snubbers filter the diode bridge, which I've only seen elsewhere in audio power supplies to prevent 60Hz hum;[6] perhaps this enhances the iTunes listening experience. Other chargers I disassembled don't use a ferrite ring and usually only a single filter capacitor. The primary circuit board has a grounded metal shield over the high-frequency components (see photo), which I haven't seen elsewhere. The transformer includes a shield winding to absorb EMI. The output circuit uses three capacitors including two relatively expensive tantalum ones[14] and an inductor for filtering, when many supplies just use one capacitor. The Y capacitor is usually omitted from other designs. The resonant clamp circuit is highly innovative.[9]

Apple's design provides extra safety in a few ways that were discussed earlier: the super-strong AC prongs, and the complex over-temperature / over-voltage shutdown circuit. Apple's isolation distance between primary and secondary appears to go beyond the regulations.

iPhone charger circuit removed from case. Behind is the AC input, filtered by a tiny toroidal filter inductor. Note the metal shield over the high-frequency switching circuit.

Conclusions

Apple's iPhone charger crams a lot of technology into a small space. Apple went to extra effort to provide higher quality and safety than other name-brand chargers, but this quality comes at a high cost.

If you're interested in power supplies, please take a look at my other articles: tiny, cheap, dangerous: Inside a (fake) iPhone charger, where I disassemble a $2.79 iPhone charger and discover that it violates many safety rules; don't buy one of these. Also take a look at Apple didn't revolutionize power supplies; new transistors did which examines the history of switching power supplies. To see Apple's adapter disassembled, check out videos created by scourtheearth and Ladyada. Finally, if you have an interesting charger lying around that you don't want, send it to me and maybe I'll write up a detailed teardown of it.

Also see comments on Hacker News.

Notes and references

[1] You might wonder why the DC voltage inside the power supply is so much higher than the line voltage. The DC voltage is approximately sqrt(2) times the AC voltage, since the diode charges the capacitor to the peak of the AC signal. Thus, the input of 100 to 240 volts AC is converted to a DC voltage of 145 to 345 volts internally. This isn't enough to be officially high voltage but I'll call it high voltage for convenience. According to standards, anything under 50 volts AC or 120 V dc is considered extra-low voltage and is considered safe under normal conditions. But I'll refer to the 5V output as low voltage for convenience.

[2] The Apple power supply uses a flyback design, where the transformer operates "backwards" from how you might expect. When a voltage pulse is sent into the transformer, the output diode blocks the output so there is no output - instead a magnetic field builds up. When the voltage input stops, the magnetic field collapses causing voltage output from the transformer. Flyback power supplies are very common for low-wattage power supplies.

[3] The primary board measures about 22.5mm by 20.0mm, while the secondary board is about 22.2mm by 20.2mm. [4] For more information on X and Y capacitors, see Kemet's presentation and Designing low leakage current power supplies.

[5] For clarity, some insulation was removed before taking the pictures in this article. The Y capacitor was covered with black heat shrink tubing, there was tape around the side of the circuit, the fusible resistor was covered with black heat shrink tubing, and there was a black insulating cover over the USB connector.

[6] Snubber circuits can be used to reduce 60 Hz hum generated by the diode bridge in audio power supplies. A detailed reference on R-C snubbers for audio power supply diodes is Calculating Optimum Snubbers, and a sample design is An Audio Amplifier Power Supply Design.

[7] The power supply is controlled by the L6565 quasi-resonant SMPS (switched-mode power supply) controller chip (datasheet). (To be sure, the chip could be something else, but the circuit exactly matches the L6565 and no other chip I examined.)

To improve efficiency and reduce interference, the chip uses a technique known as quasi-resonance, which was first developed in the 1980s. The output circuit is designed so when the power is switched off, the transformer voltage will oscillate. When the voltage hits zero, the transistor switches back on. This is known as Zero Voltage Switching because the transistor is switched when there is essentially no voltage across it, minimizing wasted power and interference during switching. The circuit remains on for a variable time (depending on the power required), and then switches back off, repeating the process. (See Exploring quasi-resonant converters for power supplies for more information.)

One interesting consequence of quasi-resonance is the switching frequency varies depending on the load (with 70kHz as a typical value). Early power supplies such as the Apple II power supply used simple variable-frequency circuits to regulate the power. But in the 1980s, these circuits were replaced by controller ICs that switched at a fixed frequency, but varied the width of the pulses (known as PWM). Now, advanced controller ICs have gone back to variable frequency controls. But in addition, super-cheap knockoff power supplies use variable frequency circuits almost identical to the Apple II. So both high-end and low-end chargers are now back to variable frequency.

It took me a long time to realize that the "FLEX01" marking on the controller IC indicates Flextronics, and the X on the chip was from the Flextronics logo: Flextronics logo. I assume the chip has these markings because it is being manufactured for Flextronics. The "EB936" marking on the chip could be Flextronics' own part number, or a date code.

[8] I thought Flextronics was just an electronics assembler and I was surprised to learn that Flextronics does a lot of innovative development and has literally thousands of patents. I think Flextronics should get more credit for their designs. (Note that Flextronics is a different company than Foxconn, which manufactures iPads and iPhones and has the controversy over working conditions).

Compact USB charger from Flextronics patent 7978489

The picture above is from Flextronics Patent 7,978,489: Integrated Power Converters describes an adapter that looks just like the iPhone charger. The patent itself is a grab bag of 63 assorted claims (spring contacts, EMI shields, thermal potting material), most of which are not actually relevant to the iPhone charger.

[9] Flextronics Patent 7,924,578: Two Terminals Quasi Resonant Tank Circuit describes the resonance circuit used in the iPhone charger, which is shown in the following diagram. Transistor Q2 drives the transformer. Transistor Q1 is the clamp transistor, which directs the voltage spike from the transformer into resonance capacitor C13. The innovative part of this circuit is that Q1 doesn't need special drive circuitry like other active clamp circuits; it is self-powered via the capacitors and diodes. Most charger power supplies, by contrast, use a simple resistor-capacitor-diode clamp which dissipates the energy in the resistor.[18]

Quasi-resonant tank circuit used to clamp transformer voltage spikes in iPhone power adaptor

Later Flextronics patents extend the resonance circuit with even more diodes and capacitors: see patents 7,830,676, 7,760,519, and 8,000,112

[10] Apple indicates the charger type through a proprietary technique of resistances on the USB D+ and D- pins. For details on USB charging protocols, see my earlier references.

[11] One puzzling feature of the Apple charger is the second feedback circuit monitoring the temperature and output voltage. This circuit on the secondary board consists of a thermistor, a second 431 regulator, and a few other components to monitor the temperature and voltage. The output is connected through a second optocoupler to more circuitry on other side of the secondary board. Two transistors are wired in a SCR-like crowbar latch that will short out the auxiliary power and also shut down the controller IC. This circuit seems excessively complex for this task, especially since many controller ICs have this functionality built in. I could be misunderstanding this circuit, because it seems that Apple unnecessarily took up space and expensive components (maybe 25 cents worth) implementing this feature in such a complex way.

[12] Note the mysterious "For use with information technology equipment" on the outside of the charger. This indicates that the charger is covered by the safety standard UL 60950-1, which specifies the various isolation distances required. For a brief overview of isolation distances, see i-Spec Circuit Separation and some of my earlier references.

[13] Some notes on the components used: On the primary board, the JS4 package is two diodes in a single package. The input diodes labeled 1JLGE9 are 1J 600V 1A diodes. The switching transistors are 1HNK60 600V 1A N-channel MOSFETs. The values of many of the resistors and capacitors are indicated through standard SMD three-digit markings (two digits and then a power of ten, giving ohms or picofarads).

On the secondary board, the "330 j90" capacitor is a Sanyo POSCAP tantalum polymer 300mF 6.3V capacitor (j indicates 6.3V and 90 is a date code). 1R5 indicates a 1.5uH inductor. GB9 is a AS431I low cathode current adjustable precision shunt regulator, and 431 is a regular TL431 regulator. SCD34 is a 3A 40V schottky rectifier. YCW is an unidentified NPN transistor and GYW is an unidentified PNP transistor. The Y capacitor labeled "MC B221K X1 400V Y1 250V" is a 220pF Y capacitor. The "107A" capacitor is a 100 µF 10V tantalum capacitor (A indicates 10V). The optocouplers are PS2801-1. (All these component identifications should be considered tentative, along with the schematic.)

[14] In order to get a rough idea of how much the components in the charger cost, I looked up the prices of some components on octopart.com. These prices are the best prices I could find after a brief search, in quantities of 1000, attempting to match the parts accurately. I have to assume Apple's prices are considerably better than these prices.

ComponentPrice
0402 SMD resistor$0.002
0805 SMD capacitor$0.007
SMD transistor$0.02
fusible resistor$0.03
1A 600V (1J) diode$0.06
thermistor$0.07
Y capacitor$0.08
3.3uF 400V electrolytic capacitor$0.10
TL431$0.10
1.5uH inductor$0.12
SCD 34 diode$0.13
2801 optocoupler$0.16
1HNK60 transistor$0.22
USB jack$0.33
100uF tantalum capacitor$0.34
L6565 IC$0.55
330uF tantalum polymer capacitor
(Sanyo POSCAP)
$0.98
flyback transformer$1.36

A few notes. Flyback transformers are generally custom and prices are all over the place, so I don't have much confidence in that price. I think the POSCAP price is high because I was looking for the exact manufacturer, but tantalum capacitors are fairly expensive in general. It's surprising how cheap SMD resistors and capacitors are: a fraction of a penny.

[15] Apple's safety recall of chargers was announced in 2008. Blog reports showed that the prongs on the charger were attached only by 1/8" of metal and some glue. Apple Recalls iPhone 3G Power Adapters in Wired provides more details.

[16] Low-quality chargers interfere with touchscreens, and this is described in detail in Noise Wars: Projected capacitance strikes back. (Customers also report touchscreen problems from cheap chargers on Amazon and other sites.)

[17] There are many industry designs for USB AC/DC converters in the 5W range. Sample designs are available from iWatt, Fairchild, STMicroelectronics, Texas Instruments, ON Semiconductor, and Maxim.

[18] When a diode or transistor switches, it creates a voltage spike, which can be controlled by a snubber or clamp circuit. For a lot of information on snubbers and clamps, see Passive Lossless Snubbers for High Frequency PWM Conversion and Switchmode Power Supply Reference Manual.

Tiny, cheap, and dangerous: Inside a (fake) iPhone charger


Thoughts on the death of Ma Ailun

According to reports, a woman in China was tragically electrocuted using her iPhone while it was charging. This seems technically plausible to me if she were using a cheap or counterfeit charger like I describe below. There's 340 volts DC inside the charger, which is enough to kill. In a cheap charger, there can be less than a millimeter separating this voltage from the output, a fraction of the recommended safe distance. These charger sometimes short out (picture), which could send lethal voltage through the USB cable. If the user closes the circuit by standing on a damp floor or touching a grounded metal surface, electrocution is a possibility. If moisture condenses in the charger (e.g. in a humid bathroom), shorting becomes even more likely. Genuine Apple chargers (and other brand-name chargers) follow strict safety regulations (teardown) so I would be surprised if this electrocution happened with a name-brand charger. Since counterfeits look just like real chargers, I'll wait for an expert to determine if a genuine Apple charger was involved or not. I've read suggestions that the house wiring might have been to blame, but since chargers are typically ungrounded I don't see how faulty house wiring would play a role. I should point out that since there are few details at this point, this is all speculation; it's possible the phone and charger weren't involved at all.
I recently wrote a popular article on the history of computer power supplies, which led to speculation on what's inside those amazingly small one-inch cube USB chargers sold by Apple, Samsung, RIM, and other companies. In the interest of science, I bought a cheap no-name cube charger off eBay for $2.79, and took it apart. It's amazing that manufacturers can build and sell a complex charger for just a few dollars. It looks a lot like a genuine Apple charger and cost a lot less. But looking inside, I found that important safety corners were cut, which could lead to a 340 volt surprise. In addition, the interference from a cheap charger like this can cause touchscreen malfunctions. Thus, I recommend spending a few dollars more to get a brand-name charger.
A one-inch USB charger designed for the iphone4
The no-name charger I bought is just over an inch in length, excluding the Eurpopean-style plug. The charger is labeled "FOR iphone4. Input 110-240V 50/60Hz Output 5.2V 1000mA, Made in China." There are no other markings (manufacturer, serial number, or safety certifications). I opened up the charger with a bit of Dremel-ing. One surprise is how much empty space is inside for a charger that's so small. Apparently the charger circuit is designed for a smaller US-style plug, and the extra space with a European plug is unused. Since the charger accepts 110 to 240V input, the same circuit can be used worldwide.[1]
Inside a USB phone charger
The power supply itself is slightly smaller than one cubic inch. The picture below shows the main components. On the left is the standard USB connector. Note how much room it takes up - it's not surprising devices are moving to micro-USB connectors. The flyback transformer is the black and yellow component; it converts the high-voltage input to the 5V output. In front of it is the switching transistor. Next to the transistor is a component that looks like a resistor but is an inductor filtering the AC input. On the underside, you can see the capacitors that filter the output and input.
Internals of a USB phone charger
The power supply is a simple flyback switching power supply. The input AC is converted to high-voltage DC by a diode, chopped into pulses by the power transistor and fed into the transformer. The transformer output is converted to low voltage DC by a diode, filtered, and fed out through the USB port. A feedback circuit regulates the output voltage at 5 volts by controlling the chopping frequency.

Detailed explanation

In more detail, the power supply is a self-oscillating flyback converter, also known as a ringing choke converter.[2] Unlike most flyback power supplies, which use a IC to control the oscillation, this power supply oscillates on its own through a feedback winding on the transformer. This reduces the component count and minimizes cost. A 75 cent controller IC[3] would be a huge expense for a $2.79 power supply, so they used a minimal circuit instead.
The circuit board inside a tiny USB charger
The above picture shows the circuit components; the red boxes and italics indicate components on the other side. (Click for a larger picture.) Note that most of the components are tiny surface-mounted devices (SMD) and are dwarfed by the capacitors. The green wires supply the input AC, which is filtered through the inductor. The high-voltage 1N4007 (M7) input diode and the 4.7µF input capacitor convert the AC input to 340 volts DC.[4] The MJE13003 power transistor switches the power to the transformer at a variable frequency (probably about 50kHz). The transformer has two primary windings (the power winding and a feedback winding), and a secondary winding. (The transformer and inductor are also known as "the magnetics".)

On the secondary (output) side, the high-speed SS14 Schottky diode rectifies the transformer output to DC, which is filtered by the 470µF output capacitor before providing the desired 5V to the USB port. The two center pins of the USB port (the data pins) are shorted together with a blob of solder, as will be explained below.

A simple feedback circuit regulates the voltage. The output voltage is divided in half by a resistor divider and compared against 2.5V by the common 431 voltage reference device. The feedback is passed to the primary side through the 817B optoisolator. On the primary side, the feedback oscillation from the feedback transformer winding and the voltage feedback from the optoisolator are combined in the 2SC2411 control transistor. This transistor then drives the power transistor, closing the loop. (A very similar power supply circuit is described by Delta.[5])

Isolation and safety

For safety reasons, AC power supplies must maintain strict isolation between the AC input and the output. The circuit is divided into a primary side - connected to AC, and a secondary side - connected to the output. There can be no direct electrical connection between the two sides, or else someone touching the output could get a shock. Any connection between the two sides must go through a transformer or optoisolator. In this power supply, the transformer provides isolation of the main power, and the optoisolator provides isolation of the feedback of the secondary voltage.

If you look at the picture, you can see the isolation boundary indicated as a white line on the circuit board crossing the circuit board roughly horizontally, with the primary side on top and the secondary side below. (This line is printed on the board; I didn't add it to the picture.) The circles on the line that look like holes are, in fact, holes. These provide additional isolation between the two sides.

The UL has complex safety specifications on how much distance (known as "creepage" and "clearance") there must be between the primary and secondary sides to prevent a shock hazard.[6] The rules are complicated and I'm no expert, but I think at least 3 or 4 mm is required. On this power supply, the average distance is about 1 millimeter. The clearance distance below R8 on the right is somewhat less than one millimeter (notice that white line crosses the PCB trace to the left of R8).

I wondered how this power supply could have met the UL standards with clearance less than 1 mm. Looking at the charger case more closely, I noticed that it didn't list any safety certifications, or even a manufacturer. I suddenly realized that purchasing the cheapest possible charger on eBay from an unknown manufacturer in China could actually be a safety hazard. Note that this sub-millimeter gap is all that's protecting you and your phone from potentially-lethal 340 volts. I also took the transformer apart and found only single layers of insulating tape between the windings, rather than the double layers required by the UL. After looking inside this charger, my recommendation is to spend a bit more on a charger, and get one that has UL approval and a name-brand manufacturer.

Another issue with super-cheap chargers is they produce poor-quality electrical output with a lot of noise that can interfere with the operation of your phone. Low-cost ringing choke adapters are known to cause touchscreen malfunctions because the screen picks up the electrical interference.[7] In noticed several cost-saving design decisions that will increase interference. The charger uses a single diode to rectify the input, rather than a four-diode bridge, which will produce more interference. The input and output filtering are minimal compared to other designs.[8][9] There's also no fuse on the AC input, which is a bit worrying.

USB charging protocols

You might think USB chargers are interchangeable and plugging a USB device into a charger is straightforward, but it turns out that it's a mess of multiple USB charging standards,[10][11][12] devices that break the rules,[13] and proprietary protocols used by Sony and Apple.[14][15][16] The underlying problem is that a standard USB port can provide up to 500mA, so how do chargers provide 1A or more for faster charging? To oversimplify, a charger indicates that it's a charger by shorting together the two middle USB pins (D+ and D-). Proprietary chargers instead connect different resistances to the D+ and D- pins to indicate how much current they can provide. Note that there are a few unused resistor spots (R2, R3, R8, R10) connected to the USB port on the circuit above; the manufacturer can add the appropriate resistors to emulate other types of chargers.

Advances in AC power adapters

Early power adapters were just an AC transformer producing low-voltage AC, or add diodes to produce DC. In the mid 1990s, switching power supplies became more popular, because they are more compact and more efficient.[17] However, the growing popularity of AC adapters along with their tendency to waste a few watts when left plugged in ended up costing the United States billions of dollars in wasted electricity every year.[3] New Energy Star standards[18] encouraged "green" designs that use milliwatts rather than watts of power when idle. These efficient controllers can stop switching when unloaded, with intermittent bursts to get just enough power to keep running.[19] One power supply design actually achieves zero standby power usage, by running off a "supercapacitor" while idle.[20]

The semiconductor industry continues to improve switching power supplies through advances in controller ICs and switching transistors. For simple power supplies, some manufacturers combine the controller IC and the switching transistor into a single component with only 4 or 5 pins. Another technology for charger control is CC/CV, which provides constant current until the battery is charged and then constant voltage to keep it charged. To minimize electromagnetic interference (EMI), some controllers continuously vary the switching frequency to spread out the interference across a "spread spectrum".[21] Controllers can also include safety features such as overload protection, under voltage lockout, and thermal shutdown to protect against overheating,

Conclusions

Stay away from super-cheap AC adapters built by mystery manufacturers. Spend the extra few dollars to get a brand-name AC adapter. It will be safer, produce less interference, and your device's touchscreen will perform better.
Inside a inch cube cellphone charger

Notes and references

[1] Switching power supplies often take a "universal" input of 110V to 240V at 50/60 Hz, which allows the same supply to conveniently work on worldwide voltages. Because a switching power supply chops up the input into variable slices, the output voltage can be independent of the input voltage over a wide range. (This also makes switching power supplies more resistant to power brownouts.) Of course, designing the circuit to handle a wide voltage range is harder, especially for power supplies that must be very efficient across a wide range of voltages. To simplify the design of early PC power supplies, they often used a switch to select 120V or 240V input. Through a very clever doubler circuit, this switch converted the input bridge into a voltage doubler for 120V input, so the rest of the circuit could be designed for a single voltage. Modern power supplies, however, are usually designed to handle the whole voltage range which both avoids the expense of an extra switch, and ensures that users don't put the switch in the wrong position and destroy something.
[2] A comic-style explanation of flyback converters and ringing choke converters is at TDK Power Electronics World.
[3] The cost of idle AC adapters is given as $3.5 billion to $5.4 billion for 45 TWhour of wasted electricity in the US. The article discusses solutions, and mentions that an efficient controller IC costs 75 cents. (Note that this is a huge cost for an adapter that sells for $2.79.) Dry up avoidable leakage, EDN, Feb 1999, p96-99
[4] The DC voltage is approximately sqrt(2) times the AC voltage, since the diode charges the capacitor to the peak of the AC signal. Thus, a 240V AC input will result in approximately 340V DC inside the power supply. Because of this usage of the AC peak, only a small portion of the AC input is used, resulting in inefficiency, known as a bad power factor. For larger power supplies, power factor correction (PFC) is used to improve the power factor.
[5] The schematic of a ringing choke converter similar to the one I examined is in Analysis and Design of Self-Oscillating Flyback Converter, Delta Products Corporation.
[6] Safety Considerations in Power Supply Design, Texas Instruments, provides a detailed discussion of safety requirements for power supplies. Also see Calculating Creepage and Clearance Early Avoids Design Problems Later, Compliance Engineering. An online calculator for the UL 60950-1 clearance and creepage requirements is www.creepage.com.
[7] Cypress Semiconductor compared flyback converters and ringing choke converters; and ringing choke converters are significantly cheaper but very noisy electrically. Poor touchscreen performance is blamed on noisy aftermarket low cost chargers. Noise Wars: Projected Capacitance Strikes Back, Cypress Semiconductor, Sept 2011.
[8] Power Integrations has multiple designs and schematics for Cell Phone Charger and Adapter Applications.
[9] Power Integrations has a detailed design for a 5W cube charger based on the LinkSwitch-II controller. This circuit fits two circuit boards into the inch cube, which is pretty impressive. 5 W Cube Charger Using LinkSwitch-II and PR14 Core
[10] The official USB charging specification is Battery Charging v1.2 Spec.
[11] The updated USB standards that allow high-current charging are described in USB battery-charger designs meet new industry standards, EDN, Feb, 2008. In summary, a charger shorts D+ and D- to indicate that it can provide 1A, compared to a regular USB port that provides up to 500mA.
[12] An up-to-date discussion of USB charging is given in The Basics of USB Battery Charging: a Survival Guide, Maxim Application Note 4803, Dec 2010. This discusses the USB Battery Charging Specification, and how USB detects different power sources: SDP (standard computer USB ports), CDP (high-current computer USB ports with up to 1.5A), and DCP (power adapters).
[13] A guide to USB power that discusses the difference between what the USB standard says and what is actually done is "What your mom didn't tell you about USB" in Charging Batteries Using USB Power, Maxim Application Note 3241, June 2004. In particular, USB ports do not limit current to 500mA, and might provide up to 2A. Also, USB ports generally provide power even without any enumeration.
[14] Ladyada reverse-engineered Apple chargers to determine how the voltages on the USB D+ and D- pins controls the charging current. Minty Boost: The mysteries of Apple device charging. Also of note is the picture of the internals of a official Apple iPhone 3Gs charger, which is somewhat more complex than the charger I disassembled, using two circuit boards.
[15] Maxim MAX14578E/MAX14578AE USB Battery Charger Detectors. This datasheet has details on the proprietary D+/D- protocols used by Apple and Sony chargers, as well as standard USB protocols.
[16] Developing cost-effective USB-based battery chargers for automotive applications, EE Times, Feb 2011. This article describes the different types of USB charging ports and how to implement them. It mentions that Blackberry uses the USB Battery Charging 1.0 spec, Motoroloa uses the 1.1 spec, phones in China use the YDT-1591 spec, and Apple uses a proprietary protocol.
[17] Power supply technologies, Journal of Electronic Engineering, 1995, p41 reported AC adapters and chargers for portable computers, cameras, and video equipment are moving from "dropper" transformers to switching supplies.
[18] Energy Star added star ratings in 2010 for no-load power consumption, randing from 0 stars for chargers that use more than .5W idle power, to 5 stars for chargers that use under 30mW. The article also discusses constant-current/constant-voltage (CC/CV) chargers that provide constant current while charging the battery and then constant voltage to keep the battery charged. Meeting 30 mW standby in mobile phone chargers.
[19] A green power AC adapter design driven by power requirements, EDN Power Technology, Aug 2004, p25-26. This article describes how to build a highly-efficient AC adapter using "burst mode" during low load, and minimizing EMI interference through spread spectrum techniques.
[20] Watt Saver for a Cell Phone AC Adaptor describes an AC adapter reference design that uses a 1 Farad super capacitor to power the controller without any AC usage when there is no load.
[21] The Fairchild FAN103 PWM controller is designed for charger applications. It uses frequency hopping to spread out the EMI spectrum - the switching frequency varies betwen 46kHz and 54kHz. When there's no load, the controller switches into "Deep Green" mode, dropping the switching frequency to 370Hz, getting just enough power to keep running.

Fixing my Concertmate MG-1 Synth

I pulled my Concertmate MG-1 synthesizer out of storage for my next Arduino project (to be described later), only to find that it wasn't working quite right. This posting briefly describes how I fixed it, in case anyone else has a similar problem.
Concertmate MG-1 Synthesizer
The main problem with the MG-1 was a loud click (a bit like a kick drum) when I pressed or released a key. It sounded suspiciously like a DC signal being applied to a speaker. The second problem was that when I set the contour for an attack and decay, the note got louder and softer, but as the note got softer it was replaced with a buzz at the frequency of oscillator 1.

Conveniently, the Service Manual is available online. I studied it and the schematic, and my first guess was that there was a DC offset going into the CA3080 amplifier, resulting in an amplified DC signal in the output. The CA3080 is not a normal amplifier but an operational transconductance amplifier, an unusual amplifier where the current on a control input controls the amplification of the input signal (more info). In this case, it is used as a voltage-controlled amplifier, allowing the contour signal to control the output.

In the schematic below, op-amps U10A and U10B feed the differential output signal into the 38080 amplifier. Pin 5 of the 3080 receives the contour signal to provide the attack and decay when you press a key. This signal controls how much the inputs are amplified. The output goes into the master volume control, and then to the synthesizer outputs. If there's a DC offset between the input pins 2 and 3, there will be an amplified DC offset at the output.
MG-1 Output Schematic
Fortunately, there is a VCA Balance Trim adjustment to trim any DC offset, and the manual describes how to adjust this. I opened up the MG-1 and adjusted this, but unfortunately it made no difference at all.

Next, I stared at the schematic for the contour generator that feeds into the CA3080 amplifier, but couldn't see how that could be going wrong. I measured the inputs to the CA3080 with an oscilloscope and found they all seemed normal. However, the output showed a 3.75V DC jump when the key turned on, which explained the click. In addition, the contour input showed it was picking up some crosstalk from the oscillator 1 trace that runs next to it, and this was being amplified into the buzzing noise.

All signs pointed to a problem with the CA3080 amplifier chip, which was somehow amplifying a big DC signal. Unfortunately, the CA3080 is no longer being manufactured and is hard to obtain. Fortunately, by some bizarre twist of fate, I happened to have one in my rather small box of parts.

The picture below shows the two main circuit boards. The upper board is the sound generation, filtering, and amplification, while the lower board has the power supply, keyboard, control, and polyphonic sound.
MG-1 internals
I removed the circuit board, soldered in the new CA3080, got the switches centered just right so the circuit board could be replaced, and put it back together. Unfortunately, I didn't get any output at all. I was afraid I'd somehow destroyed my rare CA3080 chip, but fortunately discovered that if the switches are in intermediate positions, you don't get any signal. I returned the switches to their proper positions and all was well.

In conclusion, I succeeded in fixing my MG-1 and getting that lovely, rich Moog sound.