Hackaday Prize Entry: Playing With USB Power Delivery

USB Power Delivery is the technology that’s able to pump 100 Watts down a USB cable. It’s been around for half a decade now, but only in the last few years have devices and power supplies supporting USB PD shown up on the market. This is a really interesting technology, and we can’t wait to see the outcome of people messing around with five amps flowing through a cable they picked up at the dollar store, but where are the DIY solutions to futz around with USB PD?

For his Hackaday Prize entry, [Clayton] is doing just that. He’s built a tiny little power jack for USB PD that has a USB type-C plug on one end and a pair of screw terminals on the other. It’s the USB PD Buddy Sink, and once we find some cheap 100 Watt USB power adapters, this is going to be an invaluable tool.

Getting 100 Watts out of a USB charger is a bit more complex than just soldering a few wires together. The power delivery must be negotiated, and for that [Clayton] is using a simple, cheap STM32F0 ARM microcontroller. Plugging into a USB bus is a bit more complicated, but luckily On Semi has a neat little programmable USB Type-C controller PHY that does all the work. Throw in a few MOSFETS and other ancillary parts, and you have a simple, small 100 Watt power supply that plugs right into your new fancy laptop charger.

The design of the USB PD Buddy Sink is complete, and [Clayton] has a bunch of these on hand. He’s selling them on Tindie, but it’s also a great entry to the Hackaday Prize.

29 thoughts on “Hackaday Prize Entry: Playing With USB Power Delivery

      1. Actually as a serious question, why did switch-moders take over the world completely at the time they did? There were switchers in the Apple ][ in the late 1970s, and there must’ve been in other things before. But still most home computer power supplies up through the early 1990s were linear. As were the “wall-wart” PSUs and chargers used for all sorts of things, all linear. Even a lot of early mobile phone chargers.

        Now there’s switchers in literally everything (except where the Chinese cheap out, cut really dangerous corners, and just stick a capacitive dropper in, qv Big Clive). You can buy DC:DC convertors on the same principle for not much money online. All of a sudden voltage is sortof irrelevant, when it used to be the most important thing in a power supply. Now, it can be changed whenever and by however much a circuit needs.

        What changed? Did high-power transistors get cheaper? Or fast transistors? MCUs, or custom controller chips (these seem pretty recent)? AIUI the idea of a SMPSU has been known for a long time, why did it take so long?

        Actually the really heavy metal, IBM mainframes and the like, used DC:DC convertors in the form of enormous great motor-generator sets, spinning many kilograms of copper at some furious speed. And were actually fairly efficient.

  1. Hmmm… Just thought of an idea for a virus that spreads via multiple wireless/evil-charger vulnerabilities to set 5V only devices requesting a full 20V… Kind of USB-C killer… shall we name it USB-Ciller?

    Said virus would randomly chose either 1 or 2 as the variable for minimum spread and the occasional one that spreads to 10 devices… when the spread counter is zero then the next USB-C charge on the 5v to 20v is detected and the charger is requested by the virus to supply 20v even though the charger chipset can only handle 5V to 7V (7V being datasheet absolute max rating)

    OK such a virus would be nigh impossible to create unless it is for a specific target… Hmmm.. say: all most popular phones. i.e. Samsung and iPhone…. though the iPhone would require the user to use a USB-C to lightning cable AFAIR.

    P.S. I have nowhere near enough programming skill nor the NDA-datasheets/specs/schematics/etc to pull such a thing off.

    1. One’d only need to find what standard usb chipsets devices use, test the firmware for vulnerabilities, use found vulnerabilities for code execution, write virus to set overvolt power!

      1. I’m sure they, NSA and GCHQ at least have already thought of this as soon as the idea behind USB-C entered the original inventor’s mind.

        It’s the Black-hats and the 1337 5kr1pt0rz we should be worried about… However now the idea is out there, people can look for a solution.

      1. Like >10yr ago: I connected my quite new Nokia phone to a Nokia charger of a friend without a closer look as the connector fitted and wondered why my phone said:” Not charging”. It turned out that this was the charger from an older model which supplied unregulated 12V instead of 3,8V. Which luckily did not harm the phone in any way.
        So a device does not really have to handle charging at 20V, but it needs one input switch (FET) which can block the 20V.

        1. Did older Nokia chargers really do that? I am very suspicious of this. I bet it was a cheap knockoff. Even the old USB standard said that devices are supposed to be able to survive higher voltages. USB hosts and chargers just weren’t supposed to actually do that. The standards writers realized that it would happen anyway, someone would sell cheap, car adapters that would actually just wire the cigarette lighter plug directly to the output port. And… they did.

          1. As far as i know the 3.8 (wasnt it 3.6V) were the first nokia chargers to charge the brand new Lithium batteries. They got later changed to 5V still the same power jack.

            ……. thanks now I feel old

  2. Thanks! I was just thinking about how many Lenovo power adapters I have around that could be used on my new X1 Yoga if only there was a suitable USB-C interface that could negotiate power per spec.

  3. I want to see a gizmo that plugs in between a USB port and cable, tests the port for its power delivery capability and queries the device for how much power it can draw – then matches up the best of both sides.

    That way a cheap, generic (or not so cheap but cheaper than the $$$$ a Samsung or Apple charger costs) high output charger can be used with devices that use weird ways of detecting if they’re plugged into an officially authorized charger.

    Even cooler would be if it could test the resistance of the cable and boost the output some to overcome it, without melting it. I bought a really nice looking long cable but my genuine Samsung charger only delivers about 700ma through it VS the 900 to 1200 it does through shorter cables.

    1. Far as I know the standard has a thing where cables themselves can report their current capacity to the power supply, so that’s covered.

      For your own problem, maybe the Samsung charger is measuring the cable’s resistance, somehow. Maybe between 0V and chassis ground? Unless the cables have some special stuff built in, are they particular Samsung or “high power” cables or something?

      1. No, the phone is measuring the resistance of the cable and capacity of the PSU. It increases the current until the voltage drops below something like 4,75V. The original charger of my S5 delivers about 5,25V at no load and increases the voltage to something like 5,75V at 1,8A

    2. The gizmo you’re describing, it sounds like its main job is to pretend to be an officially authorised charger. The logic behind PD is that this will no longer be necessary. Laptop or phone asks charger what it can output, charger says it can output 30W, phone charges happily, laptop agrees to take it but maybe doesn’t charge as it’s consuming 60W. The whole ‘authorised charger’ thing was a workaround to stop a laptop drawing more than a power supply could supply, but now you can actually ask the supply what it’s capable of. If it lies, it’s a bad supply and you should get a refund after it pops.

  4. “we can’t wait to see the outcome of people messing around with five amps flowing through a cable they picked up at the dollar store”

    A 5A rated cable needs a chip to report it’s capable of 5A, the most you’ll see over a dumb cable is 3A which isn’t too far off what a micro USB cable has been carrying already.

    Here’s hoping the chip is so expensive you wouldn’t consider adding it before thicker gauge wires.

    1. You shouldn’t put a chip in the cable, as counterfeits will lie.

      What the receiving end needs to do is monitor the voltage drop, and back off if it’s too much. This ends up safer as it also accounts for dirty connectors and counterfits have to violate laws of physics.

  5. Does anyone know a of the shelf solution for a certain use case:
    Given a power supply (60W) with an USB-C socket I want to charge a device that has a standard 20V 3A device (with +/- socket)?
    Of course this DIY thing presented here is able to do it, but I don’t need the full flexibility.
    Anyone has some links for where to get “fixed power output usb-c delivery adapters” cause I don’t know which keyword to google for!

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.