Creating a voltage switching "safe" power supply (like Apple MagSafe)

Confession: I would like to use an existing MagSafe adapter (male/female pair) and rewire my HP laptop to use it. The MagSafe adapter has a built-in safety system which keeps the output voltage low until it senses a resistor between the positive/negative terminals on the MagSafe connector. Obviously I'm not trying to make a commercial product because Apple vigorously defends their MagSafe patents.

The 45W "Magsafe 2" Apple charger provides 14.85V instead of the 19V I need on the HP. The 85W Apple charger will provide 20V, but does a weird "step-up" from 16V based on current draw. I want to avoid an under-voltage situation, so my plan is to splice the MagSafe adapter/leads from an 85W apple charger to my existing HP 45W charger.

My goal is to implement a circuit that provides a very low voltage/current (less than 5v) to the MagSafe plug until it is attached to the laptop, at which point it waits a second for recognition on the laptop side and then switches to the full voltage/current. I expect that I could use an Arduino board strapped to my DC power supply, along with what is most likely a MOSFET to control voltage/current output.

The way Apple does this is to "sense" a resistor on the low voltage output. If there is a short, like a paper clip got stuck in the connector, it does nothing. However, if it senses a specific resistance, then it waits a second, most likely continuously testing to ensure that the plug is fully seated, and then switches the output to a high voltage. I suspect that when it senses the current draw drop significantly below a maintenance level, it switches back to the "low voltage" output mode.

On the laptop side, I should have enough space to squeeze in the MagSafe receptacle and a small resistor.

My thought was to use an an ACS723 current sensor IC to measure the current, and a MOSFET to adjust the current/voltage.

On the laptop side, I would want some type of "cutoff" circuit or IC so that the laptop doesn't get powered on until the voltage reaches a minimum (18V?) to be determined later. This would hopefully allow for an accurate measurement by the ACS723 chip. It is possible that the laptop already has undervoltage protection.

By testing the ACS723 values while connected / removed from the small resistor, the arduino would know whether or not the laptop is plugged in or not. I could program the a LED to blink or change color like Apple did on the MagSafe plug to help debug this.

Any thoughts on feasibility? Suggestions for the "undervoltage cutoff circuit" ?

I'd think that there exist battery charger chips that can do what you want.

The output typcially is pulsed, at least in idle state, so that the current flowing during the short ON time allows to detect presence of a load or short.

I guess you can provide a voltage divider to put about 5V on the output, and sense when this
voltage drops due to the load resistor to the right value, then switch on the high-side pFET.
You'd need to ensure the voltage sensing is protected from higher voltages with a zener or similar.

On the laptop side a simple comparator circuit could switch another pFET I guess.

Thanks for the advice, DrDiettrich and MarkT!

DrDiettrich, I'll look harder for battery charger ICs. That would be a much cleaner solution! I didn't need to reinvent the wheel, and even the smallest arduino on a board would be a tight squeeze (or a big bump) on an existing AC adapter.

MarkT - I think your solution is a very elegant alternative to using the MOSFET, and I'm sure it is more efficient than the MOSFET. I only need to provide "limited" and "full throttle" so there is no need to be able to vary the current more than that. If I can't find a battery IC that does what I want, I'll go with yours. I'll go research pFETs!

A pFET is a p-channel MOSFET. p-channel devices are used for high-side switching, n-channel for
low-side (ground) switching - usually high side switching has less problems and hence I specified a
pFET explicitly.