Circuit Needed for Unlocking Power Supply Safety Mechanism

Thread Starter

SnowCrash

Joined Apr 6, 2016
31
Hi Everyone,

Background:

I'd like to use my Mac's Magsafe 2 charger as a power supply for a project I'm currently working on.

Having sorted out the issue of making the mechanical connections between the charger and a custom power connector, I discovered that Magsafe chargers incorporate a safety mechanism (which I actually like very much!) that prevents them from supplying significant power unless a very specific procedure is followed upon the initial contact with any power connector.

Therefore, my custom power connector requires a compatible circuit that can unlock the charger's safety mechanism.

It's worth noting that I could potentially get this done with a micro-controller, but I was hoping the electronic wizards on this forum would be able to help me realize this 'unlocking' circuit using only elementary components (transistors/resistors/caps/etc.) in order to reduce complexity, footprint and costs.

Description of the Problem:

Here is a short description of the procedure that unlocks the charger's safety mechanism:

(The info below comes mainly from Ken Shirriff's excellent writeup on the Magsafe connector which can be found here)

(1) Initially, the charger provides very low power on the power line (~3VDC/100µA).

(2) When first hooked-up to the charger, the power connector needs to pull the said power line even further down to around 1.7V with a resistive load measuring 39.41KΩ (or similar) for a duration of 1 second (or as close to that time period as possible).

(3) If the charger detects that the power line has been pulled down in this exact manner, it starts working in full capacity providing 14.85-20VDC/3-6A on the power line (depending on the model of the charger).

Summary of Needed Solution:
Use of elementary components only (if possible) to make a circuit that can pull down a given power line from 3V to 1.7V for 1 second, and then be able to transmit the full power that subsequently comes in on that same power line (14-20VDC/3-6A).

Many thanks in advance for your help :)

SnowCrash
 

wayneh

Joined Sep 9, 2010
17,498
The first thing I would do is test the proposed process by hand and see if it works. In other words, try pulling that pin down with a 39k resistor and see if full power is then applied in a second. I think you can test this by hand because I don't think the pull-down timing is critical. It'd be great to confirm the voltage that appears during the pulldown and maybe verify a range that works. Is it 1.7±0.1V or 1.7±0.5V? That way you can design to hit the middle of that range.

If that test actually works, it should be fairly easy to build a circuit to simulate it.

My Magsafe connector is only working when oriented in one direction, not in both directions. I wish I knew an easy fix for that but I suspect it's inside my MacBook. Not worth opening it for such a small annoyance.
 

dendad

Joined Feb 20, 2016
4,476
What actual voltage and current do you require?
To my mind, it will be better to get another plugpack or switch mode power supply to run your project, other that a MagSafe one.
If for some reason you pop the Apple one, you will be up for a lot more $$$ than the price of a generic power supply.
Why not get a 24V power supply, like...
24V5APS.jpg
http://www.ebay.com/itm/DC-24V-5A-R...bf4e40b3adf3f6cec28edc&pid=100643&rk=1&rkt=1&
Boy, they are big URLs!
 

wayneh

Joined Sep 9, 2010
17,498
You can also buy a MagSafe-type connector you could add to any power supply, if that would meet your needs.
 

Thread Starter

SnowCrash

Joined Apr 6, 2016
31
The first thing I would do is test the proposed process by hand and see if it works. In other words, try pulling that pin down with a 39k resistor and see if full power is then applied in a second. I think you can test this by hand because I don't think the pull-down timing is critical. It'd be great to confirm the voltage that appears during the pulldown and maybe verify a range that works. Is it 1.7±0.1V or 1.7±0.5V? That way you can design to hit the middle of that range.
That's great advice! Thanks for not letting me get ahead of myself, wayneh!

I tested the charger as suggested and indeed there were differences between what I found and the description I originally relied upon.

Here's a summary of my results:

(1) My Magsafe2 charger initially outputs ~670mV on the power line.
(2) When a 39.4K resistor is connected between the power line and ground, the power line climbs up to the full 15V over a period of 1 second.
(3) The power line then stays at that level (15V) for at least 10 seconds (maybe indefinitely, I can't really say), during which time I can switch to another load and the power line stays stable (in this particular case, I simply used a LED with 1K series resistor and it lit up very nicely :).

Unfortunately, I can only provide info about the voltage levels as I have no way of measuring the currents. Nevertheless, I assume that in the initial stage, the charger supplies just a few mA, and only makes it's full power available after the 'unlocking' procedure is done.

If that test actually works, it should be fairly easy to build a circuit to simulate it.
Cool! given the above, could you please instruct me on what's the best way to go about it?

What actual voltage and current do you require?
Hi dendad! I'm looking for anything between 14-20VDC / 3A which I believe all Magsafe 2 charger models are capable of providing.

To my mind, it will be better to get another plugpack or switch mode power supply to run your project, other that a MagSafe one.
If for some reason you pop the Apple one, you will be up for a lot more $$$ than the price of a generic power supply.
I see where you're coming from and I can't argue with your reasoning. And yet I can't help myself. I've got the charger right there on my desk all the time and I want to be able to pop it out of my mac and hook it up to my circuit when needed and then pop it back again. I know common sense is on your side, but in this case I'm willing to take the risk in order to keep my pedantic inner geek happy :)

You can also buy a MagSafe-type connector you could add to any power supply, if that would meet your needs.
Hi wayneh! Yeah, I know and actually I did buy one of these cables to play around with.
I also thought about using a separate power supply with it, but decided against it for two reasons:
(1) For one thing, I wouldn't have the safety mechanism which - like I said in the original post - I actually like very much. I think it's a very good idea that the charger doesn't put out it's full capacity from the outset just in case the connector shorts at some point when not connected to a device (for example, the risk of shorting with the mac case when attempting to connect the charger to it).
(2) Moreover, I would have two Magsafe connectors on my desk (one for my mac and the one under discussion here) and no way of telling them apart. If I hooked up the wrong connector to my mac it might be problematic...

Nonetheless, thanks for the suggestion!
 

Thread Starter

SnowCrash

Joined Apr 6, 2016
31
Did you then remove the 39K pull-down, or did it remain connected after the 15V was reached?
Hi Alec_t!

I removed the 39.4K resistor after 15VDC where reached (i.e. after 1 second of being connected between the power line and ground).

In more detail, my testing setup was very simple. I used a latching SPDT switch with the input terminal connected to the power line. One of the switch's output terminals was connected to the said 39.4K resistor (the other end of the resistor to ground). The other output terminal was connected to a LED with 1K series resistor (and the LED's cathode connected to ground).

The switch was originally on the LED terminal. I connected the charger and the LED remained off. I then flipped the switch to the resistor terminal and saw the voltage go up to 15V over a period of 1 second. After that, I flipped the switch back to the LED side and now it was lit and the voltage stayed at 15V.

Hope this helps.
 

Alec_t

Joined Sep 17, 2013
14,313
It would simplify the circuit needed to do what you want if the resistor could remain connected indefinitely. Have you tried that?
 

Thread Starter

SnowCrash

Joined Apr 6, 2016
31
It would simplify the circuit needed to do what you want if the resistor could remain connected indefinitely. Have you tried that?
Hi Alec_t!
Thanks for the suggestion!
I haven't tried that before, but from the quick test I've done this evening it looks like there's no problem with leaving the 39.4K resistor connected. The voltage goes up to 15V and stays that way.
Another thing I've tried is to connect the said resistor in parallel with the LED+series resistor and sure enough the LED lit up after 1 second and stayed on for some time now so I'm assuming it'll continue to do so indefinitely. I suspect this worked because the LED is drawing very little current and this wouldn't work for the entire circuit so some kind of setup which limits the current draw to almost nothing for the first second is still necessary, but there doesn't seem to be any conflict with the 39.4K resistor remaining connected while all this is happening.

This leaves me with two open questions:
(1) How to get this done?
(2) Wouldn't leaving the 39.4K resistor connected in this way be somewhat wasteful (or is the current draw in this case so minimal it doesn't really matter)?
 

Alec_t

Joined Sep 17, 2013
14,313
Here's one possibility.
MagsafeTrigger.PNG
C1 provides a path for an initial current pulse through the 39k resistor, to initiate the Magsafe output. When the voltage rises sufficiently Q1 switches on (via R3) to provide a continuous current path.
At power-down, R2 discharges C1.
The R1 current is only about 0.4mA: trivial compared to the main current from the supply.

Here's a simpler possibility, which effectively disconnects the 39k after an initial current pulse :-
MagsafeTrigger2.PNG
 
Last edited:

Thread Starter

SnowCrash

Joined Apr 6, 2016
31
Here's one possibility.
C1 provides a path for an initial current pulse through the 39k resistor, to initiate the Magsafe output. When the voltage rises sufficiently Q1 switches on (via R3) to provide a continuous current path.
At power-down, R2 discharges C1.
The R1 current is only about 0.4mA: trivial compared to the main current from the supply.

Here's a simpler possibility, which effectively disconnects the 39k after an initial current pulse :-
Thanks, Alec_t!

I've tried out both circuits, but unfortunately only managed to achieve limited success in both cases (the 2 circuits seemed to behave identically - at least during testing - so I'll refer to them in the singular below).

To test the circuit, I hooked up a 120mm fan (0.19A) to the positive and negative rails. This setup didn't work initially, that is, the fan wouldn't even start. Upon connecting the magsafe charger, the voltage in the circuit would go up to 0.8V more or less and fluctuate thereabout (+/-0.2-0.3V). Only after adding a 10uF electrolytic capacitor between the positive and negative rails, did the circuit work and the fan start spinning - however, this was the only occasion I managed to get things to work as I'll describe below.

Next, I replaced that fan with the fan I actually intend to use (this fan is also 120mm, but much heavier and more powerful. It's rated: 24V/0.27A, although I suspect it draws much more current at the startup stage). Although I didn't change anything else in the circuit, this fan wouldn't start. I tried various capacitor values (22uF, 47uF, 100uF, 270uF, 470uF instead of 10uF), but the fan wouldn't start. As before, when the magsafe is connected to the circuit, the voltage goes up to around 0.8V and stays there more or less.

I should note that I didn't have a 47nF ceramic capacitor on hand, so instead I used 2 x 100nF caps in series (giving 50nF) but I think 3nF shouldn't make much of a difference here, no?

I also tried using an N-channel mosfet instead of the transistor but saw no difference in the observed behavior.

Any idea what goes wrong here and how to fix it?
 

Thread Starter

SnowCrash

Joined Apr 6, 2016
31
Forgot to mention a couple of things:
(1) I've tried several regular 120mm 12V pc fans instead of the 2 fans mentioned above. However, none would start spinning. Surprisingly, the single fan that did work (with the 10uF capacitor) was not the lowest rated one in terms of power consumption.

(2) Another problem I encountered is that if I connected a fly-back diode (1N4004) in reverse-parallel with the fan, even the one that worked, wouldn't spin up with the diode (with the fly-back diode installed, the voltage settled on approx. 0.8V as in the other instances)

Atm, I'm completely stumped :-@
 

Thread Starter

SnowCrash

Joined Apr 6, 2016
31
Ok. Go back to grounding the 39k manually for 1 sec only, but this time with a fan as the load. Does that work?
Thanks Alec_t! Your help & patience in this are very much appreciated!

I followed your suggestion and got good results as I'll describe momentarily.

However, before that and just to make sure we're on the same page, here is the setup I was working with:

mag_test.png

(all the voltage measurements mentioned below were taken at the MagSafe connector entry points)

(1) Initially, the switch was in POS A and the MagSafe charger unconnected.

(2) Upon connecting the MagSage connector, the voltage level in the circuit went up to ~0.3V-0.8V (depending on the fan model) and the fan didn't spin up as expected.

(3) Then, when the switch was moved to POS B - thereby grounding the 39K4 resistor - the voltage went up to 15V in about 1 second time frame, and remained at that level (seemingly) indefinitely.

(4) Finally, when the switch was moved back to POS A - after 1 second or more - the voltage level remained at 15V and the fan started spinning.

(In light of this, notice that there seems to be a minimum time period to allow the voltage to go up, but no maximum time limit for switching between the grounded 39K resistor to the actual current-drawing stage).

I've tested this procedure with several different 120mm fans - including the 24V fan I plan on using - and it worked every time (that is, the fan started working after grounding the resistor for at least 1 second and then going back to grounding the fan's negative terminal).

Does this help?

Thanks again,
SnowCrash
 

wayneh

Joined Sep 9, 2010
17,498
Nice experiments. I would have left the resistor connected continuously but you discovered that it stays on even after the brief time when you're switching from resistor to fan. I wonder how long it would stay on with no load?
 

Thread Starter

SnowCrash

Joined Apr 6, 2016
31
Thanks, wayneh!

I would have left the resistor connected continuously but you discovered that it stays on even after the brief time when you're switching from resistor to fan.
Not sure I understand what you mean by the resistor 'staying on' in this context. In the tests I described above, when the circuit is switched from the 39K4 resistor to the load (a fan in this case), no current flows through the resistor anymore as its ground has been disconnected.

Nevertheless, your comment got me thinking about the possibility of leaving the resistor permanently connected (a scenario which the said test didn't cover as it only switched from resistor to load).

So I revised the setup as follows:

mag_test_2.png

(1) When the MagSafe charger is connected, the voltage level goes up to 15V after 1 second (and stays there until either a load is added or the resistor is disconnected).

The fan obviously doesn't run as it has no connection to ground.

(2) Then if the switch is moved to POS B, the fan gets grounded and starts spinning. This happens regardless of the fact that the resistor remained connected.

I've tried this setup with all my fans and it worked every time.

To me this confirms that it is indeed possible to leave the resistor connected permanently.

In other words, the only thing needed to overcome the safety mechanism of the Magsafe2 charger is to make sure that the load isn't introduced before at least 1 second has elapsed from the point at which the circuit has been powered up.

I wonder how long it would stay on with no load?
From what I've seen, it looks like the resistor brings the voltage level on the power line up to 15V in 1 second and then that voltage level is maintained indefinitely as long as the resistor is still connected (if the resistor is simply disconnected with no alternative load being introduced, the voltage level goes back down to ~0.3-0.8V).
 

wayneh

Joined Sep 9, 2010
17,498
I was only wondering how long the voltage stays high after the resistor is removed. Obviously it's long enough for your switch to break and then make.

Cool info. I can recall testing my voltage and being upset that it looked like the adapter was dead. Now I know why, and how to get around it.
 

Alec_t

Joined Sep 17, 2013
14,313
In other words, the only thing needed to overcome the safety mechanism of the Magsafe2 charger is to make sure that the load isn't introduced before at least 1 second has elapsed from the point at which the circuit has been powered up.
So, perhaps something like this?
MagsafeTrigger3.PNG
You would need to tweak R2, depending on the gate threshold voltage of the FET.
 

wayneh

Joined Sep 9, 2010
17,498
So, perhaps something like this?
View attachment 129073
You would need to tweak R2, depending on the gate threshold voltage of the FET.
I like it but I think I'd add a lot more resistance to R2 (and then R4), so that:
1) the cap C1 could be smaller and cheaper, and
2) the initial resistive load seen by the Magsafe is more dependent on R1 and very little changed by whether R2 is conducting or not. As drawn, the initial load would be R2 in parallel with R1 and this would be a lot less than 39K.
 
Top