Reading Analog Values With A MagSafe Port

The MagSafe adapter in MacBooks and MacBook Pros is probably the greatest single advancement in laptop technology in the last 10 years. Interestingly, the MagSafe port is also a an analog volt meter that can be read by the OS, and it’s not just limited to monitoring battery voltage; with the right software, you can turn a MagSafe port into a terrible and expensive analog sensor, letting scripts on the computer run based on analog values.

[Peter] created a voltmeter application for his mac after realizing the System Management Controller – the chip responsible for charging the battery – was accessible through low-level kernel calls. If you care enough to chop an Apple power adapter in half, the MagSafe port can read other analog inputs.

The SMC Voltmeter app [Peter] wrote samples the voltage every second and displays values on a graph. This app also allows you to run scripts. While you won’t be able to do much with an extremely expensive, very slow, one-channel data logger (the battery is going to run down eventually), we’re sure we’ll see something that’s held together with duct tape and prayer that uses this weird tool.

39 thoughts on “Reading Analog Values With A MagSafe Port

  1. The MagSafe adapter in MacBooks and MacBook Pros is probably a notable advancement in PROPRIETARY, CLOSED SOURCE laptop technology in the last 10 years.

    Fixed it for you.

      1. Patents expire. They NEVER become copyrights. Its like asking if when a fish dies it becomes a human. Copyright and patents are not even handled by the same governmental agency.

          1. USPTO only handles patents and trademarks. U.S. Copyright Office handles copyrights. In the U.S. anyways.

            Makes sense if you know what the differences are.

        1. The connector itself is well designed and what Peter did is also very neat. My irritation is more with the closed source nature of a product/invention and the site’s over the top hyperbole about it. It’s as if seatbelts were patented (which they were) but then only one brand offered them as a competitive advantage and then somebody invents a shopping bag holder that clips into this proprietary seatbelt and then HAD writes about how amazing this proprietary seatbelt tech is when most users whose brand of car lacks this feature are irritated that they don’t have seatbelts at all.

  2. magnetic plugs have been used for years … i had a laptop in 2003 with one … and i would say built in standard wifi is the biggest achievement in the past 10 years but that’s just me …

        1. I’ve been looking for something like this! I was convinced it didn’t exist and I was going to have to invent something myself!

          I tried to order from their website, but they only seem to accept orders from Europe. How did you order yours?

        2. That is brilliant. If only they had versions with the magnet on the other end for quick charging stations. An no, I don’t care in the slightest if it sticks out of my phone a little bit.

          1. Aside from the Cabin linked to by Peter, I can’t find any after-market adapters that are *just* the plug. I don’t need a case, just a tiny slim little dongle. Not only would it be cheaper to make, but the same form factor would work on a LOT more phone without any changes. Oh well.

            Note: I did find a *lot* of links for the Sony Xperia line, but unfortulately that’s just a proprietary connector built into the phone itself.

      1. It’s use apears to be the difference here. I have a popcorn machine and a deep fryer with a magnetic plug like that. Not a “smart” device but the concept is there.

  3. Quick tip for those of you who are learning their new Mac: don’t freak out if it starts going slow sometimes. It’s 100% annoying 100% of the time, but most of them can be easily fixed unlike Windows. I switched because of the functionality that Apple offers. There’s free software available on that will make it run like new again and maintain it. Just stay on top of that clutter!

      1. Salesmen never seem to get it when you tell them you’re installing Linux. They still try to sell you various software that they will install in-store for outrageous amounts of money.

    1. probably because they couldn’t figure out how to create proper stress relief for the plug. they all get the ‘turtleneck sweater,’ start fraying the wires internally, and either go open or dead short– all from absolutely normal use. you better hope they just go open. I’ve seen ones that went dead short get hot enough to melt themselves, and/or fry the laptop’s charging circuit.

      the funny part is they got it right with the first magsafe revision on the non-unibody and very early unibody macbook pros. I’ve never seen one of those chargers fail. the second and third plug design revisions, however, are put under a lot of shear stresses for the sake of looks, and apple refused to compensate with meaningful stress relief. stupid design compromises like that color 99.999999999% of apple’s engineering department.

      the last lasting, reliable thing they made was the 4th gen grayscale ipod.

  4. Is it just me, or is chopping up an expensive proprietary adapter that is no longer manufactured in order to pipe unknown voltages into a two thousand dollar piece of kit a *really bad idea*?

    I’m all for bad ideas in the context of hacks. It makes sense to test the limits of what can be done, and try things that are stupid just for the perverse pleasure of it. But, the suggestion that somebody else is going to do the same thing and make it useful? Just buy a voltimeter for $10 from the nearest hardware store, instead of risking a few thousand dollars.

    If you like to waste money, why don’t you mail it to me instead of frying macbooks; I’d be happy to take it. Or, I dunno, start using dollar bills as toilet paper or kindling?

    1. You’re totally right – this hack is rarely going to be of any practical purpose. That’s why it took me a year to write the GUI version. Part of this was to inspire people to try hacking the SMC system-on-chip, and my code is written with that in mind: please tweak it and release similar hacks with other low-level functions!

      I already own a pocket multimeter, which fits in my pencil case. I tested every voltage carefully before plugging it into my Mac! I also have AppleCare (I hope this didn’t void my warranty >_<).

      I also didn't need to chop up the adaptor – I found a frayed MagSafe adaptor for free in a scrapyard, and saved the cable. Half-cables are sold for under $10 on eBay though, so it's no big deal really.

      Why is this still slightly useful? My physical voltmeter can't log to a file or trigger scripts. I also have a LaunchControl setting to run the command-line tool to save the input voltage to a file every minute. I leave my laptop online and plugged in all the time. If there's a power cut when I'm away fro my keyboard (very common in India, where I was living for 5 months last year), I can know when the power went out, and I can trigger my own scripts to run as a result.

  5. Lol.. 10 years and the best thing is the magnetic power plug?

    Ohkaaaay… I guess you would be happy with 1 hour battery life, a 150 degree hot lap, a 1024×768 pixel screen, a 2″ thick 15lb brick, bulky 200mb hard drives, slow ram limited to 256mb… And the other trappings of a common 2004 era laptop..

    The best thing mac has done is lower their prices… And switch to intel..

    Their magnetic plug barely registers as an ‘improvement’, considering it came with the proprietary, expensive, still fail-prone power adapter..

    I guess I kinda like it also.. But i would call the apple retina screen their only meaningful contribution to laptop culture. That and maybe the unibody designs.. But those are then held together with double stick tape, nice as they look when assembled the first time.

    1. >Lol.. 10 years and the best thing is the magnetic power plug?
      >Ohkaaaay… I guess you would be happy with 1 hour battery life, a 150 degree hot lap, a 1024×768 pixel screen, a >2″ thick 15lb brick, bulky 200mb hard drives, slow ram limited to 256mb… And the other trappings of a common >2004 era laptop..

      Sounds like revisionism to me. How about this? 3h battery time, just above room temperature, a 1024×768 screen (but in a 12″ form factor), 0.7″ 2.6lbs, 30GB HDD (1.8″), 512MiB RAM. In 2002!

      IMHO the best things for notebook computers in the last 10 years are Intel releasing the core 2 duo (2006) and Nvidia releasing the mobile 7900 GPU. Why? Because both of those delivered close to desktop performance while still being usable in notebook computers! But not only that but (IMHO) that was the start of real optimization of components for mobile solutions – earlier notebook processors/GPUs was older technology with a few optimizations applied afterwards to decrease power use.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.