close-circle
Close
0%
0%

PD Buddy Sink

Smart power jack for USB Power Delivery

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 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. For simplicity and flexibility, the configuration should be done by USB. To avoid drawing excessive power, 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

Done

I developed the first PCB prototypes (v0.1) in early February 2017, and built them mid February. This design had a few errors, which were fixed in v0.2.  The next revision (v0.3) was a complete redesign for automated assembly.  This got a few more optimizations for the first stable release, v1.0, released in mid-July 2017.

The PD Buddy Sink's firmware is stable, with a few more features planned. It provides 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. The firmware allows users to control PD negotiations and show the power supply's capabilities while in Setup mode. To the best of my knowledge, the firmware is compliant with the USB Power Delivery Specification, Revision 2.0, Version 1.3.

Documentation for the configuration API is available, allowing developers to produce libraries and applications for configuring the PD Buddy Sink. I have written a small Python library for this purpose, providing both direct and abstracted access to the serial configuration API. A basic configuration GUI has been implemented using this library and GTK+, allowing users to edit and save configuration, control the Sink's output, and view the power supply's capabilities in an easier 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

Just after winding up the development cycle for firmware 1.1.0, I'd like to move to hardware for a little while.  As such, I think I'll design the splitter board I talked about before.  It's a tiny project, but I think it's useful enough to warrant being built.  Assuming they work correctly on the first try, I'll list a couple on Tindie in a few weeks.

To Do

One more big-ish firmware feature is planned currently: support for variable...

Read more »

  • 1 × PD Buddy Sink v1.0 PCB 1.6 mm thick, 1 oz copper all layers
  • 1 × 1 μF 0603 25V C1
  • 1 × 2.2 μF 0603 C2
  • 8 × 0.1 μF 0402 C3, C4, C5, C6, C7, C8, C10, C11
  • 2 × 1 μF 0402 C9, C12

View all 22 components

  • PD Buddy Sink v1.0 was briefly in stock

    Clayton G. Hobbs08/07/2017 at 21:28 0 comments

    A few hours ago, a batch of ten PD Buddy Sink boards arrived from @MacroFab.  They're all beautiful, and I photographed them and listed nine on Tindie promptly.  As I was preparing to write a post about them over here on Hackaday.io, I saw that three had already sold.  When I finished packing those, four more had sold.  When I finished packing those, the last two had sold!  Running out of inventory quickly isn't a bad problem to have, all things considered.

    I've ordered another batch, so they'll probably be back in stock in three to four weeks [Edit: the microcontrollers used aren't available currently, so it'll be longer than that].  Here's hoping they'll continue to sell this well, so I can keep ordering even larger batches in the future!

  • Power/Data Splitter Not Needed

    Clayton G. Hobbs07/27/2017 at 19:39 0 comments

    I started looking at ways to make the power/data splitter described in the last post, and the situation didn't look good.  I didn't want the side that plugs into the PD Buddy Sink to have a female connector because I don't know how e-marked cables would like being chained together.  However, all the male connectors I found either had to be reflowed, which I'm not capable of doing at home, or require 0.8 mm PCBs, which I can't find a way to get for under $50 in under 3 weeks.  I really don't want to spend that much or wait that long, so I had to think of another way.  I thought about hacking apart two USB cables, but again, I'm not sure how e-markers would like that.  What to do?

    Well, I have two v0.1 PCBs lying around unused.  They've already been hacked on quite a bit to fix the schematic errors in that version, so a bit more ugliness wouldn't hurt anyone.  I decided to cut the USB D+/- traces and solder a USB cable's GND, D+, and D- wires to the board to have separate data and power connections.  After some tricky fine-pitch soldering, the ugly board came to life!


    After some testing, I've concluded that the problem I observed yesterday was in fact the fault of the Asus USB 3.1 UPD Panel, not the PD Buddy Sink.  This is welcome news, since it means I don't have a weird bug to track down and fix.  Now I get to go back to developing new features instead of quietly worrying!

    I still might design a power/data splitter board, since it could be useful to people other than myself.  But since I personally have no urgent need for one, I'll probably only make it if someone out there asks me to.

  • Working on Firmware 1.1, Power/Data Splitter Needed

    Clayton G. Hobbs07/26/2017 at 20:27 0 comments

    I'm currently working on the big new feature of firmware version 1.1, Power Delivery communications in Setup mode.  It's working partially, but not fully as planned yet.  The saved configuration is negotiated on boot in Setup mode, and any time the configuration is written to flash, a new contract is negotiated for the new power.  There's no way to control the output from the command shell yet, and I'd like the shell to be able to print information like the power supply's advertised PDOs, but what I've done so far is working well.

    Er, it's mostly working well, that is.  I'm testing simultaneous Power Delivery and USB data with an Asus USB 3.1 UPD Panel, a device which has a few quirks.  It uses the old USB Power Delivery voltages of 5, 12, and 20 V instead of the newer 5, 9, 15, and 20 V.  It also only offers 1.5 A at 5 V.  However, it offers a full 5 A at 20 V if the cable can carry that much current, so it's not a bad tool to have on hand.

    But there's one thing I've run into that I'm not sure whether to blame on the UPD Panel or the PD Buddy Sink's firmware.  When I reconfigure the Sink for 12 V and 20 V repeatedly, it happily gets those voltages as expected.  But sometimes when I configure it for 5 V, or configure it for something else when it was already configured for 5 V, power is lost entirely.  It seems unlikely that the PD Buddy Sink is at fault, since I'm not aware of anything in the USB PD spec that should cause the source to completely remove power until the sink is physically reconnected.  However, I'm not 100% sure I'm right about that, and I don't want to read all the way through a >500 page technical document to find the answer.  The easy way to test this would be to plug the PD Buddy Sink into a different power supply to see if the problem disappears, but I don't have another power supply that lets me communicate with the Sink via USB at the same time.

    The solution I've imagined is a USB Type-C power/data splitter.  It could be a funny Y-shaped cable, or a small PCB with 3 USB connectors.  One connector would be male, with power, ground, the configuration channels, and the USB 2.0 D+/- lines connected.  These would split off so that one female connector would have power, ground, and the configuration channels, and the other would have ground and the D+/- lines.  This device would allow me to plug the PD Buddy Sink into any power supply, including standalone ones, while communicating with it from a computer.

    I don't know if a device like this already exists, but I could design one easily enough.  If you know of anything like this, please let me know in the comments!  Otherwise, I'll be designing and ordering a PCB for one in a day or so.

  • PD Buddy Sink v1.0 Released!

    Clayton G. Hobbs07/19/2017 at 19:01 0 comments

    Get it while it's hot!

    The first PCB release considered stable! Very similar to v0.3, this release is optimized for lower cost while retaining all functionality of the previous release.

    • D1, Q1, Q2, and SW2 have all been changed to reduce the board's cost
    • Many reference designators have been moved closer to their components
    • The board's dimensions remain the same, including positions of the parts on the bottom

    Due to the last point, the programming jig did not require any changes in this release. I'll be placing an order for a medium quantity of these soon, and I expect to have them in stock on Tindie in 3-4 weeks. I'll hopefully be able to write firmware version 1.1 by then, which will allow the device to do Power Delivery negotiations in setup mode.

  • PD Buddy Sink v0.3 Now Available

    Clayton G. Hobbs07/06/2017 at 01:29 0 comments

    PD Buddy Sink v0.3 group shot

    The v0.3 prototype boards just arrived from @MacroFab, and boy am I pleased with the work they did! I programmed them with the programming jig that arrived from @oshpark a couple weeks ago, and they all work perfectly. There are still a couple minor changes I'll probably make before v1.0, but with this revision the PD Buddy Sink hardware is in essentially a finished state.

    You may notice that I didn't have MacroFab install an output connector. That's because I wanted to give people more connector options than before. The new boards can be purchased with no output connector, the screw terminals used before, or male header pins on the bottom or top of the PCB. I really like the header pins on the bottom, because they can be used to power a breadboard, as seen below.

    Two of the three v0.3 prototype boards are available on Tindie. If you miss out on these, don't worry: I'll be putting the finishing touches on v1.0 soon, so there will be even more PD Buddy Sinks available before long.

    PD Buddy Sink v0.3 with header pins (bottom), powering a breadboard

  • 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!

View all 18 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