Close
0%
0%

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 with the voltage I needed at a high enough current. 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 existed! 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, it 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 decided 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 small device that performs the necessary communications for being a USB Power Delivery sink. Configure it with the voltage and current your project needs, then plug it into any USB PD power supply with sufficient power output. It negotiates with the power supply and turns on its power 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.

  • 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
  • 1 × MMBT2222ALT1G Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs
  • 2 × CZRF52C5V6 Electronic Components / Misc. Electronic Components
  • 1 × AP2204R-3.3TRG1 Power Management ICs / Linear Voltage Regulators and LDOs
  • 1 × SS14FL Discrete Semiconductors / Diodes and Rectifiers
  • 1 × SKQGAKE010 SMD Tactile Switch

View all 21 components

  • Why the Output MOSFET Is Important

    Clayton G. Hobbs5 days ago 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. 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 »

  • Support for Type-C Current Added

    Clayton G. Hobbs04/13/2017 at 22:44 0 comments

    The USB Type-C spec defines a much simpler mechanism than Power Delivery for ports to advertise their current capability. Type-C Current works by just putting a different pull-up resistor on the CC line of the Type-C connector to indicate different source currents. Combined with the pull-down in the sink, this creates a voltage that indicates how much current the sink can draw from the source. Table 4-27 from the USB Type-C spec shows these voltages.

    I just pushed a commit adding support for Type-C Current as a fallback when Power Delivery communications fail. This means the PD Buddy Sink is now capable of getting up to 3 A at 5 V for your project even from non-PD power supplies.

  • Prototype Configuration GUI

    Clayton G. Hobbs03/30/2017 at 01:51 0 comments

    I've now created a prototype configuration GUI with GTK+ in Python. It should be able to run on OS X and Windows, but I haven't tested it on anything other than Linux. If you were paying close attention, you might've seen the link to the Git repository appear in the sidebar a couple days ago, but now it's working well enough that I feel like writing about it.

    The GUI detects all the PD Buddy Sink devices connected to the computer and presents them in a list (which updates automatically!). Each list entry has a button to identify the device: click the button and the Sink's LED blinks fast for a couple seconds. The GUI allows you to easily configure each device's voltage and current. The settings are loaded from the device when it's selected from the device list, and new settings can be saved at the press of a button.

    There are still a few bugs to iron out (mostly regarding serial port permissions and device disconnection), but I'm becoming increasingly happy with this little interface.

  • Wrote a Console Configuration Interface

    Clayton G. Hobbs03/25/2017 at 03:13 0 comments

    I just put the finishing touches on the initial PD Buddy Sink console configuration interface. It's based on the ChibiOS command shell, but with some changes I feel make it much nicer. First, it has PD Buddy branding, rather than the ChibiOS branding the original had. The help text has been improved, providing a short synopsis for each command rather than simply a list of commands. There's also no way to exit the shell, because I really don't know why that would be necessary in this application. After all, when you're done configuring the Sink and your changes have been written to flash, there's no harm done by just unplugging it.

    The new code has been pushed to the main firmware repository. This brings the PD Buddy Sink much closer to being fully functional, so I'm really happy about it. Next, I think I'll work on the GUI before returning to the firmware.

    Some implementation details follow, as well as next steps for the firmware.

    As is common with Cortex-M microcontrollers, there's no EEPROM here, only flash. That means the configuration has to be stored somewhere in flash, so the last page makes sense to me. Only a few bytes of flash are needed to store the configuration, but since I had to reserve a whole 2 KiB page for it anyway, I figured I might as well go ahead and do some wear leveling. The page is used as an array of 128 structs, each beginning with a magic value indicating its status. An empty struct is identified by the magic value 0xFFFF (naturally), the one that currently stores the configuration is identified by 0xBEEF, and old ones that aren't being used right now are 0x0000. As the configuration is updated, the page fills from low to high addresses, until eventually it's completely full. Then on the next update, it's automatically erased before the new configuration is written. The flash in the STM32F0s is rated at a minimum of 10k cycles, so with my wear leveling, the Sink can be configured at least 1,280,000 times before the flash might wear out. That should be far more than anyone ever needs.

    There's enough space left over in the struct for a few new features as well, but they're not implemented yet. One half-word is set aside for flags, which will eventually include at least whether we should enable GiveBack and whether we can get power from batteries and variable power supplies. GiveBack support would allow the power supply to temporarily remove power if another device needs extra power, and would be mostly useful in the PD Buddy Sink for battery charging applications. Support for drawing power from batteries and variable supplies requires specifying a voltage range, and they will be lower priority than fixed supplies.

    (N.B. "Variable supply" in USB PD parlance is really just a euphemism for "poorly regulated supply", not the kind of variable power supply you're probably thinking of. For those, USB PD 3.0 support is needed, and they're called "programmable". I'm not aware of any programmable USB PD power supplies on the market yet, but if I've just missed them, please let me know!)

View all 6 project logs

Enjoy this project?

Share

Discussions

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