PD Buddy Sink

USB Power Delivery for everyone

Similar projects worth following
USB Power Delivery is a cool standard for getting lots of power—up to 100 W—from a USB Type-C port. Being an open standard for supplying enough power to charge phones, laptops, and just about anything else under the sun, USB PD is poised to greatly reduce the amount of e-waste produced worldwide from obsolete proprietary chargers. Unfortunately, like all USB standards, it's quite complex, putting it out of reach of the average electronics hobbyist.

PD Buddy Sink solves this problem, letting any hacker or maker use USB PD in their projects. Think of it as a smart power jack. To use it, first configure a voltage and current via the USB configuration interface. Then whenever the Sink is plugged in to a USB PD power supply, it negotiates the power your project needs and provides it on the output connector.

The Idea

One day I was digging through a box of wall warts, trying to find one that would work for my latest project. I needed one with 12-16 V output at no less than 0.5 A, and with a reasonable output connector. Untangling cords and checking labels was taking a while, and I started thinking. "If I could use USB Power Delivery, I wouldn't ever have to do this again." Since USB PD power supplies can provide a multitude of voltages at sizable currents, all you'd need is a little circuit board that takes the place of a power jack and tells the power supply what your project needs.

I searched the web, and to my surprise, no such device was available! I realized that I would have to create it myself, so I started figuring out the device's requirements. It would be a small (<2 in²) circuit board with a USB Type-C connector on one side and a screw terminal block for power output on the other. When plugged in, an on-board microcontroller would negotiate the power for your project. Originally I thought it could be configured with a few jumpers, but after reading the relevant parts of the USB Power Delivery standard I realized that a more fine-grained way of setting current would be necessary. For safety, the output would have to be controlled by a MOSFET so as to only turn on once negotiation is complete.

A couple days later, I had a hardware design. A couple weeks later, I built a prototype, and the first PD Buddy Sink was born.

PD Buddy Sink

PD Buddy Sink is a smart power jack for USB Power Delivery. Configure it with the voltage and current your project needs, then plug it into any USB PD power supply with a high enough power capability. It negotiates with the power supply and turns on its output, giving your project up to 3 A at 5, 9, or 15 V, and up to 5 A at 20 V.

PD Buddy Sink is simple to configure. Just plug it into a computer while holding the setup button, and connect to the USB CDC console interface. Alternatively, use the (still experimental) configuration GUI.

Project Status


Initial PCB prototypes (v0.1) were developed in early February 2017, and built mid February. A few schematic changes were necessary, but were nothing a little point-to-point wiring couldn't fix on the prototype boards. A revised board (v0.2) has been developed and tested incorporating these fixes and some other improvements. A further revised board (v0.3) has also been released, having all the same features as v0.2 in a board only 60% the size.

Firmware has been developed supporting most use cases of the PD Buddy Sink. The firmware is now considered stable, and has a real VID:PID pair. It features a USB serial console interface for editing and saving configuration, and is able to negotiate with power supplies to request fixed voltages and currents. An option for GiveBack is available, which allows the power supply to reduce power temporarily if another device needs more. This is recommended if the Sink is being used to charge a battery. To the best of my knowledge, the firmware is compliant with the USB Power Delivery Specification, Revision 2.0, Version 1.3. The configuration API has been documented, allowing developers to produce libraries and applications which allow configuration of the PD Buddy Sink.

I have written a small Python library for configuring the PD Buddy Sink, providing both direct and abstracted access to the serial configuration API. A basic configuration GUI has been implemented using this library and GTK+. It allows editing and saving configuration in a more user-friendly way than the console interface. It also displays a list of all connected PD Buddy devices, in case several are plugged in to the computer at once.

In Progress

Three copies of PCB v0.3 and its corresponding programming jig have both been ordered. Once they arrive, I'll test them and hopefully there won't be any problems. It was a major revision though, so a design error isn't out of the question.

To Do

One more major firmware feature is planned: support for variable...

Read more »

  • 1 × PD Buddy Sink v0.2 PCB 0.8 or 1.0 mm thick, 2 oz copper preferred
  • 1 × STM32F072CBT6 ARM Cortex-M0 Microcontroller
  • 1 × FUSB302BMPX USB PD Revision 2.0 PHY
  • 1 × 12401548E4#2A USB Type-C Hybrid Receptacle
  • 1 × DMP4015SSS Discrete Semiconductors / Power Transistors and MOSFETs

View all 21 components

  • New Firmware and Software Releases

    Clayton G. Hobbs06/19/2017 at 21:01 0 comments

    I just made two new releases: PD Buddy Sink Firmware v1.0.1 and pd-buddy-python v0.2.1. These are both minor bugfix releases, fixing bounds checking for setting invalid voltages and currents through the configuration interface.

    Previously, the firmware allowed the user to set voltages and currents greater than what USB Power Delivery allows. Also, the Python library gave no indication when setting the voltage or current failed. These bugs are both fixed now: the firmware accepts only voltages in the range [0 mV, 20000 mV] and currents in the range [0 mA, 5000 mA]. When the firmware rejects a voltage or current value, the Python library now raises a ValueError in response. After all, errors should never pass silently.

  • PCB v0.3 Released!

    Clayton G. Hobbs06/10/2017 at 20:57 0 comments

    Get it while it's hot!

    A PD Buddy Sink designed for automated assembly!

    • Sizes of passives reduced from 0805 to 0402, with a few 0603 passives as well
    • Surface-mount USB connector instead of hybrid (don't worry, the new connector's shield still has through-hole pins for mechanical strength)
    • QFN microcontroller instead of QFP
    • Boot switch and programming header moved to bottom of board
    • Board size greatly reduced (48 mm × 26 mm ⇒ 30 mm × 25 mm)
    • Screw hole spacing changed (18 mm ⇒ 17 mm)
    • To accommodate the tighter packing of components, the board now has four layers instead of two

    Additionally, a programming jig has been designed to accommodate programming the Sink without a boot switch or programming header installed. The PCB can be found in the programming-jig directory, and a 3D-printed spacer can be found in the pd-buddy-openscad repository.

  • Prototypes For Sale!

    Clayton G. Hobbs06/08/2017 at 17:11 1 comment

    Two of the v0.2 boards are now for sale on Tindie! If you want to use USB Power Delivery in your next project, I encourage you to check them out.

    I sell on Tindie

  • Firmware Version 1.0.0 Released!

    Clayton G. Hobbs06/05/2017 at 20:20 0 comments

    With the last blocker finally resolved, I updated the firmware, Python library, and GUI to use the new VID:PID pair for the PD Buddy Sink. This allowed me to make two new releases: pd-buddy-python 0.2.0 and PD Buddy Sink Firmware 1.0.0. The firmware is now guaranteed to be API-stable, so I'm very happy about that. Looking to the future, I still plan to implement support for variable and battery PDOs and finish the new circuit board. I'm planning to list two of the three v0.2 PCBs for sale on Tindie soon as well, so watch this space if you want to use USB Power Delivery in your next project!

  • Python Configuration Library

    Clayton G. Hobbs05/11/2017 at 22:14 0 comments

    Looking over the GUI code recently, I realized what a mess it was. This was partially because of the cobbled-together way it communicated with the PD Buddy Sink. I decided to make a better interface for configuring the Sink from Python code. It made sense to do that as a separate Python package, mostly because I might want to write a GUI with some other library for better portability than GTK+ offers. After a day or so of writing the library and accompanying unit tests, I made the first release of pd-buddy-python.

    The GTK+ GUI now uses this library rather than pySerial for communication with the Sink. Several portions of code were greatly simplified in the process, notably configuration loading and testing if the "Save" button should be visible. I'm very happy with the new library, and all the possibilities it opens. Expect a more portable configuration interface soon!

  • The First v0.2 Board Assembled

    Clayton G. Hobbs05/06/2017 at 20:37 0 comments

    The first three v0.2 PCBs just arrived from @oshpark today. I was excited to build one, so I ran the 1.5 miles to the mailbox and back to burn off some excess energy. When I got back, I opened the envelope and found these lovely little pieces of FR4.

    Then began the arduous process of hand-assembling a board with a 0.5 mm pitch QFN and USB Type-C connector. Not too scary, especially with a vacuum pick-up tool, but still not easy.

    After about two hours of soldering, I had a beautiful board assembled. Those 10 kΩ and 2 kΩ SMD resistors look almost exactly the same, don't they?

    I bought STM32F072C8T MCUs for these instead of the STM32F072CBT I used on the v0.1 boards. They're almost exactly the same, except the chip on the new board has only 64 KiB of flash instead of 128 KiB. Since the firmware is only about 28 KiB, the smaller chip still has plenty of room for expansion, and costs less too. I had to make a few changes to the firmware to support the smaller flash, but that went very smoothly.

    All in all, I'm really happy with how the new board came out. It's a fairly minor revision compared to what v0.3 will bring, but it has a lot of little improvements that make the Sink so much nicer. The USB connector hangs off the board farther, so enclosure walls can be thicker. The current carrying traces are thicker, so the board shouldn't even get warm when it's carrying 5 A. Plus, no rework is needed in the output circuit, so that's nice.

    Onward to v0.3!

  • GiveBack Support Added

    Clayton G. Hobbs04/29/2017 at 20:51 0 comments

    I just pushed commits for both the firmware and configuration GUI to add GiveBack support. GiveBack is a mechanism defined in the USB Power Delivery spec that allows the power supply to temporarily reduce power to one device in order to provide more to another. The implementation in the PD Buddy Sink works by removing power from the output when the power supply asks the Sink to reduce power.

    "Why would I want my power supply to stop powering my device?" I hear you cry. GiveBack is largely intended for use in non-critical applications, such as battery charging. If a laptop is charging its battery from a USB PD powered hub while sharing power with an external hard drive, the hub power supply's limit could be approached during normal operation. If the hard drive needs to spin up, it will require more power than normal, which could overload the power supply. Making the laptop stop charging for a second while the hard drive spins up allows all devices involved to keep running without drawing too much power.

    In short, if you're using a PD Buddy Sink to charge a battery, it would be polite to enable GiveBack to allow power supplies to manage their loads more effectively.

  • Why the Output MOSFET Is Important

    Clayton G. Hobbs04/23/2017 at 01:30 0 comments

    Or: Why the USB-C Easy Bake Oven Is Dangerous

    This is just a quick little post to explain why the PD Buddy Sink has a MOSFET to switch its output. There are several reasons, but they all boil down to the same thing: without it, a device like the USB-C Easy Bake Oven would be dangerous.

    The PD Buddy Sink has a MOSFET controlling its output. It turns on when the Sink establishes an Explicit Contract for the power configured, and remains off if the power supply cannot provide the power you wanted. One obvious consequence of this is that your project only gets the voltage you configured the Sink to request, preventing any possible undervoltage from occurring.

    More importantly though, this MOSFET is essential to the safe operation of any device utilizing the PD Buddy Sink. Take for example the USB-C Easy Bake Oven made by Jason Cerundolo. It's a modified Easy Bake Oven that gets its power from USB Power Delivery, made using an Arduino and a breakout for the FUSB302B (the same USB PD PHY used in the PD Buddy Sink). Jason modified the resistive heating element to dissipate 80 W at 20 V, producing enough heat to bake cookies.

    Time for some analysis. His heating element is a (20 V)² / 80 W = 5 Ω resistor. In his system there's no circuitry to switch it on and off, so it's always connecting VBUS to GND. Before any negotiations are done, it draws 1 A at 5 V. For a USB PD supply like the one he used, it's entirely likely that nothing bad is happening yet: it probably advertises a Type-C Current of 3 A, so it's safe to draw up to that much current at 5 V without doing any PD negotiations (Edit: it actually advertises a Type-C Current of 1.5 A). I'm not sure if Jason's firmware checks this however, and even if it did, it would have no way to stay within the limits of the advertised current.

    Read more »

  • Application: USB PD Bench Power Supply

    Clayton G. Hobbs04/18/2017 at 20:29 0 comments

    Inspired by a comment, I put a PD Buddy Sink in a box with a DPH3205 buck-boost power supply module to make a USB-powered bench supply. Check it out on its project page!

  • PCB v0.2 Released!

    Clayton G. Hobbs04/16/2017 at 16:34 0 comments

    Get it while it's hot!

    Finally, a hand-solderable Sink that doesn't need rework! The output circuit has been fixed, so no cutting traces and point-to-point wiring should be necessary.

    Other changes:

    Read more »

View all 13 project logs

Enjoy this project?



oshpark wrote 04/18/2017 at 01:45 point

Very interesting project!

  Are you sure? yes | no

Andrew Bolin wrote 03/21/2017 at 04:25 point

Hey, I had almost the same idea recently, but you've actually built it!
If you stick it in a box with one of those cheap DPS3005 type regulator modules you could probably take some money from me ;)

  Are you sure? yes | no

Clayton G. Hobbs wrote 03/21/2017 at 14:28 point

That would be a pretty cool idea. It would be better to use one of the buck-boost versions, like a DPH3205, so it's not limited by the 20 V maximum voltage of USB PD.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates