Teardown and exploration of Apple's Magsafe connector

Have you ever wondered what's inside a Mac's Magsafe connector? What controls the light? How does the Mac know what kind of charger it is? This article looks inside the Magsafe connector and answers those questions.

The Magsafe connector (introduced by Apple in 2006) is very convenient. It snaps on magnetically and disconnects if you pull on it. In addition it is symmetrical so you don't need to worry about what side is up. A small LED on the connector changes color to indicate the charging status.

The picture below shows the newer Magsafe 2 connector, which is slimmer. Note how the pins are arranged symmetrically; this allows the connector to be plugged in with either side on top. The charger and computer communicate through the adapter sense pin (also called the charge control pin), which this article will explain in detail below. The two ground pins are slightly longer than the others so they make contact first when you plug in the connector (the same as USB).

The pins of a Magsafe 2 connector. The pins are arranged symmetrically, so the connector can be plugged in either way.

The pins of a Magsafe 2 connector. The pins are arranged symmetrically, so the connector can be plugged in either way.

Magsafe connector teardown

I had a Magsafe cable that malfunctioned, burning the power pins as you can see in the photo below, so I figured I'd tear it down and see what's inside. The connector below is an older Magsafe; notice the slightly different shape compared to the Magsafe 2 above. Also note that the middle adapter sense pin is much smaller than the pins, unlike the Magsafe 2.

A Magsafe connector with burnt pins.

Removing the outer plastic shell reveals a block of soft waxy plastic, maybe polyethylene, that helps diffuse the light from the LEDs and protects the circuit underneath.

A Magsafe connector with the plastic case removed. In front is the metal holder of the pins. Behind it is the circuit board encased in plastic. The power cable exits from the back.

Cutting through the soft plastic block reveals a circuit board, protected by a thin clear plastic coating. The charger wires are soldered onto the back of this board. Only two wires - power and ground - go to the charger unit. There is no data communication via the adapter sense pin with the charger unit itself.

After removing more plastic, the circuit board inside a Magsafe connector is visible. The power cable is soldered onto the board.

Disassembling the connector shows the spring-loaded "Pogo pins" that form the physical connection to the Mac. The plastic pieces hold the pins in place. The block of metal on the left is not magnetized, but is attracted by the strong magnet in the Mac's connector.

The spring-loaded 'pogo pins' inside a Magsafe connector.

The circuit board inside the Magsafe connector is very small, as you can see below. In the middle are two LEDs, orange/red and green. Two identical LEDs are on the other side. The tiny chip on the left is a DS2413 1-Wire Dual Channel Addressable Switch. This chip has two functions. It switches the status LEDs on and off (that's the "dual channel switch" part). It also provides the ID value to the Mac indicating the charger specifications and serial number.

The circuit board inside a Magsafe connector is very small. There are two LEDs on each side. The chip is a DS2413 1-Wire switch.

The chip uses the 1-Wire protocol, which is a clever system for connecting low-speed devices through a single wire (plus ground). The 1-Wire system is convenient here since the Mac can communicate with the Magsafe through the single adapter sense pin.

Understanding the charger's ID code

You can easily pull up the charger information on a Mac (Go to "About this Mac", "More Info...", "System Report...", "Power"), but much of the information is puzzling. The wattage and serial number make sense, but what about the ID, Revision, and Family? It turns out that these are part of the 1-Wire protocol used by the chip inside the connector.

Every chip in the 1-Wire family has a unique 64-bit ID that is individually laser-programmed into the chip. In the 1-Wire standard, the 64-bit ID consists of an 8-bit family code identifying the type of 1-Wire device, a 48-bit unique serial number, and an 8-bit non-cryptographic CRC checksum that verifies the ID number is correct. Companies (such as Apple) can customize the ID numbers: the top 12 bits of the serial number are used as a customer ID, the next 12 bits are data specified by the customer, and the remaining 24 bits are the serial number.

With this information, the Mac's AC charger information now makes sense and the diagram below shows how the 64-bit ID maps onto the charger information. The ID field 100 is the customer ID indicating Apple. The wattage and revision are in the 12 bits of customer data (hex 3C is 60 decimal, indicating 60 watts). The Family code BA is the 1-Wire family code for the DS2413 chip. Thus, much of the AC charger information presented by the Mac is actually low-level information about the 1-Wire chip.

The 1-Wire chip inside a Magsafe connector has a 64-bit ID code. This ID maps directly onto the charger properties displayed under 'About this Mac'.

The 1-Wire chip inside a Magsafe connector has a 64-bit ID code. This ID maps directly onto the charger properties displayed under 'About this Mac'.

There are a few complications as the diagram below shows. Later chargers use the family code 85 for some reason. This doesn't indicate an 85 watt charger. It also doesn't indicate the family of the 1-Wire device, so it may be an arbitrary number. For Magsafe 2 chargers, the customer ID is 7A1 for a 45 watt charger, 921 for a 60 watt charger, and AA1 for an 85 watt charger. It's strange to use separate customer IDs for the different models. Even stranger, for an 85 watt charger the wattage field in the ID contains 60 (3C hex) not 85, even though 85 watts shows up on the info screen. The Revision is also dropped from the info screen for later chargers.

In a Magsafe 2 connector, the 64-bit ID maps onto the charger properties displayed under 'About this Mac'. For some reason, the 'Customer data' gives a lower wattage.

In a Magsafe 2 connector, the 64-bit ID maps onto the charger properties displayed under 'About this Mac'. For some reason, the 'Customer data' gives a lower wattage.

How to read the ID number

It's very easy to read the ID number from a Magsafe connector using an Arduino board and a single 2K pullup resistor, along with Paul Stoffregen's Arduino 1-Wire library and a simple Arduino program.

The circuit to access a 1-Wire chip from an Arduino is trivial - just a 2K pullup resistor.

The circuit to access a 1-Wire chip from an Arduino is trivial - just a 2K pullup resistor.

Touching the ground wire to an outer ground pin of the Magsafe connector and the data wire to the inner adapter sense pin will let the Arduino immediately read and display the 64-bit ID number. The charger does not need to be plugged in to the wall - and in fact I recommend not plugging it in - since one interesting feature of the 1-Wire protocol is the device can power itself parasitically off the data wire, without a separate power source.

The 64-bit ID can be read out of a Magsafe connector by probing the outer pin with ground, and the middle pin with the 1-Wire data line.

The 64-bit ID can be read out of a Magsafe connector by probing the outer pin with ground, and the middle pin with the 1-Wire data line.

To make things more convenient, the serial number can be displayed on an LCD display. The circuit looks complicated, but it's just a tangle of wires connecting the LCD display. Using a simple program, the 64-bit ID number is displayed on the bottom line of the display. The top line is a legend indicating the components of the code: "cc" CRC check, "id." customer id, "ww" wattage, "r" revision, "serial" serial number, and "ff" family. The number below corresponds to an 85 watt charger (55 hex = 85 decimal).

A 1-Wire ID reader with LCD display. Touching the wires to the contacts of the Magsafe connector displays the ID code on the bottom line of the display. The top line indicates the components of the code: CRC check, customer id, wattage, revision, serial number, and family.

A 1-Wire ID reader with LCD display. Touching the wires to the contacts of the Magsafe connector displays the ID code on the bottom line of the display. The top line indicates the components of the code: CRC check, customer id, wattage, revision, serial number, and family.

Controlling the Magsafe status light

The Mac controls the status light in the Magsafe connector by sending commands through the adapter sense pin to the 1-Wire DS2413 switch IC to turn the two pairs of LEDs on or off. By sending the appropriate commands to the IC through the adapter sense pin, an Arduino can control the LEDs as desired.

The picture below demonstrates the setup. The same simple resistor circuit as before is used to communicate with the chip, along with a simple Arduino program that sends commands via the 1-Wire protocol. These commands are described in the DS2413 datasheet but should be obvious from the program code.

I used a cable removed from a dead charger for simplicity. The LEDs are normally powered by the charger's voltage, which I simulated with two 9-volt batteries. To hook the Arduino to the connector, this time I used a Mac DC input board that I got on eBay; this is the board in a Mac that the Magsafe connector plugs into. The only purpose of the board here is to give me a safer way to attach the wires than poking at the pins.

The connector contains a pair of orange/red LEDs and a pair of green LEDs, which can be switched on and off independently. When both pairs are lit, the resulting color is yellow. Thus, the connector can display three colors. The Arduino program cycles through the three colors and off, as you can see from the pictures above.

The charger startup process

When the Magsafe connector is plugged into a Mac, a lot more happens than you might expect. I believe the following steps take place:
  1. The charger provides a very low current (about 100 µA) 6 volt signal on the power pins (3 volts for Magsafe 2).
  2. When the Magsafe connector is plugged into the Mac, the Mac applies a resistive load (e.g. 39.41KΩ), pulling the power input low to about 1.7 volts.
  3. The charger detects the power input has been pulled low, but not too low. (A short or a significant load will not enable the charger.) After exactly one second, the charger switches to full voltage (14.85 to 20 volts depending on model and wattage). There's a 16-bit microprocessor inside the charger to control this and other charger functions.
  4. The Mac detects the full voltage on the power input and reads the charger ID using the 1-Wire protocol.
  5. If the Mac is happy with the charger ID, it switches the power input to the internal power conversion circuit and starts using the input power. The Mac switches on the appropriate LED on the connector using the 1-Wire protocol.

This process explains why there is a delay of a second after you connect the charger before the light turns on and the computer indicates the battery is charging. It also explains why if you measure the charger output with a voltmeter, you don't find much voltage.

The complex sequence of steps provides more safety than a typical charger. Because the charger is providing extremeley low current at first, there is less risk of shorting something out while attaching the connector. Since the charger waits a full second before powering up, the Magsafe connector is likely to be firmly attached by the time full power is applied. The safety feature are not foolproof, though, as the burnt-up connector I tore apart shows.

Don't try this at home

Warning: I recommend you don't try any of these experiments. 85 watts is enough to do lots of damage: blow out your Mac's DC input board, send flames out of a component, blow fuses, or vaporize PC traces, and that's just the things I've had happen to me. The Mac and charger both have various protection mechanisms, but they won't take care of everything. Poking at your charger while it's plugged in is a high-risk activity.

Reading your charger's ID by probing the pins while it's not plugged in is considerably safer, but I can't guarantee it. If you mess up your charger, computer or Arduino you're on your own.

Conclusions

There's more to the Magsafe charger connector than you might expect. The center pin of the connector - the adapter sense pin - controls a tiny chip that both identifies the charger and controls the status LED. It is part of a complex interaction between the charger and the Mac. Using an Arduino microcontroller, this chip can be accessed and controlled using the 1-Wire protocol. Is this useful? Not really, but hopefully you found it interesting.

31 comments:

João Fernandes said...

hi! great post.
I've got curious and explored for a while that wattage difference, and for now i got the idea that the chargers id's are hardcoded per model, so when IOPSCopyExternalPowerAdapterDetails is called, the key kIOPSPowerAdapterWattsKey haves the right value.

Will look further with more time

Anonymous said...

Great information, thanks! I had been looking for information on the MagSage connector for a while because I could never get an external/portable battery charging my Mac.

Anonymous said...

Very Intresting! Thank you!

Musashi Aharon said...

How did you identify the chip? I don't see DS2413 printed on it anywhere.

Ken Shirriff said...

Hi Musashi! Identifying the chip was hard. I assumed it was a custom 1-wire protocol chip, so I sent it random 1-wire commands to see if I could figure it out, without success.

Then I looked at the datasheets for some existing 1-wire chips to figure out what style of commands they used. When I looked at the DS2413 chip, I thought Doh! that's the obvious chip to use to control 2 LEDs, since it has two switches. When I sent the DS2413 commands to the chip, it responded just like a DS2413, which makes it pretty clear that the chip is a DS2413.

Then, I found that chips with custom IDs add hex 80 to the family code, so the charger's family code of BF is really hex 3F, which you can look up on the 1-wire family code list, and 3F is the DS2413's family code. If I realized that originally, I could have saved myself a lot of originally.

Samuel Darmento said...

Interesting article, I didn't know what MagSafe means until now!

Anonymous said...

very neat investigation.
now I wonder those who sell hyperjuice stuff - are they aware of this complex magsafe protocol when offering car adapters?
By the way, if I take the magsafe cord from the busted power brick and attach it to the 18V/4A car adaper - will it be working?

jock mctavish said...

Your post is most illuminating. Thanks. You show the complexity I supposed. I had the odd problem that my original power unit had a weak pin and so was getting very very hot. I got a new one which suddenly refused to light or charge. The old one saved me from complete discharge. But your article indicated the possibility of serial number registration. yup. Rebooted the machine and it sees the new one again.

Big Guy said...

I didn't get, have you reverse-engineered the plug board?
Should there be a direct connection between the spring-loaded pins and the two wires that go to the brick?
I have two broken adapters - 60W and 85W and trying to undertand if it is a bad soldering joint, a dead cable, or a dead power brick...

Big Guy said...

all this means that apple can just block the old chargers at any time via simple software update?

DJ Ghostmare said...

@Big Guy

Other way around: Apple has provided firmware updates so that older model MacBooks and MacBook Pros would functions with newer adapters. SMC Firmware Update 1.4 is the most relevant example.

Brian said...

Hi, I was wondering if you have documented what happens when the MagSafe is disconnected from the laptop. I notice that the LED (which is powered from the charger's voltage) goes out immediately, so I'd assume the charger actively detects if the plug has been disconnected?

I ask because I recently bought a MagSafe charger online (it's identical to the original one physically), and noticed that the LED remains on for a couple of seconds after disconnecting - something that never happens with genuine chargers - leading me to believe it is probably a knockoff.

Anonymous said...

Fantastic work! Very impressed... Thank you for sharing!

Duke said...

Hi Great information thanks! Here is a guy who looked into the communication signal (info in Japanese).
http://hirakawa-jp.sblo.jp/category/2083226-1.html

How did you identify the resistive load (39.41KΩ)? How is it applied?

My macbook has a problem and the Magsafe LED goes green but every 0.5 sec goes off for a very short time and the machine does not start.

It would be extremely helpful for "repair" peoples, if you could provide much detailed technology on the Magsafe-logicboard communication.

Anonymous said...

Thanks for this info. I'm on a power adaptor crash course at the moment....

I know this is not a support forum but this might also be of interest to "Big Guy' in tracking down the issues in his faulty units. Any advice appreciated :)

My macbook 13" T-adaptor plug has been dying for about a year. Often there is no LED (or very dim), even when it is charging OK.

But increasingly it has either not registered as plugged in at all, switching my mac to battery power...... or has registered as plugged in but given me the status of "Not charging, power source : power adaptor".

Previous to this the cable wore out next to the brick, which I repaired. So I assumed the cable had now also worn out next to the LED plug (due to pulling it out of my macbook). Wiggling the cable in this area certainly helped to get the power flowing again (although only temporarily).

But after cutting out 5" segment of cable (which looked fine) the problem persisted, so cleaned the pins on plug and macbook. They weren't dirty, anyway, and it made no difference.

So I then dissected the plug thinking the wires must have come loose from the mini circuit board. Again all looked well, with no obvious heat damage, and they look tightly soldered on. So I didn't touch them.

But I noticed the circuit board moves very slightly allowing a slight gap to appear between it and where the 'pogo pins' connect to it.

One of the pins also fell out (is that supposed to happen?) .... so I put a tiny bit of solder onto the pin and pushed it down its hole again, pushing it with the tip of the soldering iron so it would heat up and (hopefully) solder itself to the circuit board to make a solid connection and stop the wiggling.

It seemed to work OK with the adaptor and LEDs functioning normally too. But when running CPU hungry apps (ones that get the cooling fan running constantly) the plug reverts back to its old problems, cutting out, dim/ blinking LED's and "Battery is not charging" status.

Very annoying!

Pushing the plug firmly into the macbook does help a bit, which supports the theory that it is the pins not connecting to the board properly....

Some questions (any thoughts appreciated!)

1. Is it possible the connection is so weak that the extra current drawn to run hungry apps (and the mac's fan) would cause it to malfunction?

2. How could I improve the connections? My soldering skills are not great and I'm afraid of shorting the board with lots of solder.

3. Should I try putting more solder onto the pins (if I can get them out again) and pushing them down with heat to make them stick?

Any other suggestions welcome. It's driving me crazy! As soon as I run any CPU hungry software the power adaptor quits on me.

PS system profiler says battery is OK, although it's obviously not getting any younger (2008).

I will check back.. thanks.

Anonymous said...

Great review.
Thank you :)

elias.baez said...

I am building a charger for my macbook pro. Does this mean I can't power my mac without a magsafe plug? I am designing a charging system that won't infringe on their patents, but it needs to be useable, will it be useable?

Peter said...

Great job! I have been working hard with my son (13) to figure out why the Macbook of my other son (11) does not charge the battery.
With your information and the circuit diagram of the Macbook we will keep on working.
Now we are confident that the problem is the missing communication between the Macbook and this tiny Maxim IC: no green LED, no orange LED and no charging, no information about the charger visible at the Macbook.
Do you have a clue what could cause such a "communication breakdown" between the charger and the Macbook?
The charger itself works just fine (in fact right now at our other Macbook).
Thanks!

EASA FM said...

Hello Ken!

I recently read this article on wired:

http://www.wired.com/gadgetlab/2013/09/laptop-battery/?cid=12494134


It says to not leave your computer charged to 100% all the time. On the other hand if you are working at home often with your portable, you are using up load cycles of your battery for no good reason.

Apple recommends to store your battery for long time storage charged at 50% for maximum live span:

http://www.apple.com/batteries/notebooks.html

So would it be possible to extend your battery life when working at home by charging it to 50% and then stopping the process by blocking the middle pin on the magsafe with for example an electric isolation tape?

i tried to do it and it worked, the computer got power from the adaptor but the battery level stayed the same. i dont know if it is healthy for the machine as there might be an error in my logic?

i would be curious to hear your opinion.

Ray Ray said...

Hello, btw Nice Post, i wonder why this didnt come before when i goggled it.. and thank you for such wonderful detailed reverse engineering, because, i knew this was a hidden fact not just a reverse polarity lighting to color charging port LED stating what its doing.

my reply here is regards to a Anonymous on soldering :)

soldering have several type of solder and rasin core mixture... materials you use also relates to type of quality soldering gun in hand plus the ambient room temerature effects your soldering results.. ( i mention this part is by experience, realizing i was having a hell of a time with small sodering tool & softer solder material...so if you try to do this in a garage vs not doing it in door room then add this ambient temp as factor of your failed attempts... ie...cold-solder )

avoid preheating with lighter fluid of the sonder tool tip to cheat time

in between soldering cycles, refresh tip of the soldering tool with proper material provided by the package of your soldering gun


hands-on skill instruction on soldering:

0. tools neede, stonger solder
material will be recommended if wire tends to flex alot for application this will harden and lasts longer.

1. at all possible time AVOID contact with fresh cut of the wiring conductor

2. if #1 failed, cut off, repeat until you succeed

3. preheat wire-conductor with soldering tool just for a few sec immediately add solder in 3-way position where contact of wire conductor meets your soldering tool tip heated ready which will transfer the conductor heat into solder , instant bonding of solder will submerge together

4. apply circuit board trace conductor same approach as you succeeded in pre-solder the wire-conductor

5. applied the beautiful soldered wire-conductor tip you just made final step to circuit board surace where both will become a perfection in bonding

Martin said...

Thanks Ken, very helpful. Between this and rlanceread's equally thorough You Tube tutorial I had no trouble taking apart my defunct Magsafe 1 head.

The problem having been, as so many other people have found, that some of the pogo-pin springs were no longer strong enough to push all 5 pins out through that thin white plastic block. So, with the block removed, I VERY carefully applied silicone adhesive to the base of all 5 pins (about 1/16" deep) using a magnifying glass and a toothpick; silicone being an excellent insulator when cured, I should add! I then reinstalled the block, and used small needle nosed pliers to make sure that all 5 pins were pulled-out as far as they would go. Finally, I gently cleaned the pins and the block with some Q tips, one end dry, the other damp with soapy water.

After waiting the recommended 24 hrs for the silicone to cure, I reassembled the head, and -- TA-DA!! -- on came that reassuring little green...then amber... light. No way of knowing how long it will hold up, but at least long enough, to get a back-up head, I'm hoping. Though I plan to splice it onto the existing cord rather than going through the hassle of prying open the power supply and soldering the 2 contacts (also on You Tube).

Let's just hope that Apple manage to finally resolve this ongoing and extremely frustrating problem with Magsafe 3!

Justin Adie said...

For what it is worth the data pin does not seem necessary to power the laptop.
The magsafe jack on a couple of my chargers had failed in the last couple of months and it seemed in both cases that there was no longer a faithful connection between the pogos and the circuit board. Compression and more solder didn't help.

So I stripped off the circuit board and soldered to the contacts of the two V+ and GND pins of the magsafe jack. Then epoxyd it to a breadboard and broke out the pins to the charger itself (wires stripped to the shield and positive wore) with a 47kOhm resistor.

The laptop won't charge but is happily being powered which is enough for now.

In retrospect I wonder whether the pull-down resistor is necessary as I assume the macbook will apply the load anyway. But the bodge has gone back to the client for the next couple of weeks until a new cable arrives and I have time to assemble it.

Aksel Gustafsson said...

Is it possible to use an old Magsafe 1 power brick and replace the broken cable with a Magsafe 2 connector/cord?

Or does the first low voltage (3/6 volts) make a difference in the brick and connector and "confuses" the computer/chargeport?

I have a power brick with magsafe 1 and a replacement cord only cost 10 bucks so i figure to save some money and still have to chargers.

Oriental Sniper said...

Is there a way to bypass the 1wire communication to SMC, so I can power on a Macbook without entering power safe mode?

gluria said...

got curious of whats inside this 5 pins mac adapter, thats why im here. your blog showed on my google search. my sister's nasty mac is now having a hard time charging. i just removed the plastic cover of the 5 pins which was somewhat a bit melted. i also checked the pins one by one and i noticed that some of them loses the springy thing when pressed. i had one to be pulled by a long nose pliers because it got stuck when i pushed it in. and now whenever i try to connect it to the laptop it is just gonna need some pushing and just trying to get the green light indicator then orange. so yeah, the 5 pins are just the culprit. this is just my fix for the mac book pro. in youtube theres this two other fix that i might do if ever the situation got worse. opening the square charger (whis is hard btw), i was trying to open it because the wire near there are broken. but good thing though that i was still able to connect the wires there without opening (nice luck). the other fix is the one that you need to resolder the wires inside the 5 pins. i didnt go that far because i fixed my problem right at the 5 pins area. and the fact that it was hard also to pull the thing out(managed to pull the one with magnet but i broke the one connector plus i dont have tools). the youtube guy uses vice grip while i used nose pliers. using cutter(blade) to trace the connection also helped in loosening abit of the tightness of the magnet. and also the inside plastic (the one that holds the inside part was somewhat beginning to be destroyed if i continued getting it out so i just stopped. tested the laptop then it worked, after the pressing and nudging. well i didnt actually thought that the inside part was really needed to be resolder because it was located in a safe hard place. the tutorials says that overtime the wires loses the solder because of heat but i thought otherwise. IT WAS THE 5 PINS

Anonymous said...

Hi Sir
Thank you for your post.

I'm a DIYer come from Taiwan.
Would you please help me something about my powerbank project?

https://drive.google.com/file/d/0B1D07XqlLVzcRlV3Q2JUN0JVV1k/edit?usp=sharing

Thank you very much

My email address is
chunyan0001@gmail.com

Chunyan
2014.06.21

Richard Harrod said...

Hi,
I replaced the magsafe connector board on my macbook and the battery at the same time. Now it seems as if there is only a very weak connection to the battery.
If I pull the power connector from the computer while in use it shuts down.
If I pull the power connector from the computer while it is in sleep I can press the power button to wake it and it retains its state, as if waking from a deep sleep.
The battery is seen by the computer.
When I put in the new battery it took 8 hours to charge.
Re-installing the old battery shows the same symptoms.

So I'm thinking that The magsafe board is not telling the computer to switch to battery power. Is there any way to fix without switching logic board?

Dave George said...

Hi Ken
1344 charger IC134 reads T.Inst 3421.
It burned from dumb out-put short.
Any idea what the real part number is? I guessing it's a op amp.
Also IC102
rect. chip? S676303
and
IC108 driver 6679GM
Any idea what real part # those are too?

Ken Shirriff said...

Dave: Maybe a TI TPS3421 pushbutton reset timer? Your other part may be a AP6679GM power mosfet.

Anonymous said...

What sized magnet at a minimum would be needed to make it work?
I imagine the one on the laptop are large, but could you make it small enough to work with current mobile phones and not hinder the size of the handset?

I cant figure out the smallest strongest magnet would be used to make it work :/

lalit kumar said...

Great information and Thanks for sharing...
see : http://www.geeksonsite.co.nz/