USB Power Delivery for Hobby Projects
flameeyes.blog
flameeyes.blog
Getting 5V out of USB-C is pretty trivial, all the way up to 3A. The vast majority of hobbyist projects run on 5V, and very few of them need more than 15W.
Most of the rest seems to be over-engineering. You can get a ready-made "PD Trigger" board for literally $1 [0], which will allow you to select the desired voltage using jumpers. It even has support for the non-standard (although still common) 12V profile. Or, if you really want to do it using software, grab a $6 one from Adafruit [1] which comes with a tutorial and Arduino library.
If you really want to yak-shave, grab an FUSB302B. They are quite affordable, widely available, and provide easy access to protocol-level PD comms. It's only really needed once you want to implement something like Alternate Modes, though.
The only USB connector I've found that is still through-hole is USB Mini-B so I am unfortunately stuck with that.
(I should mention I am building kits for hobbyists who are averse to tackling an SMD component — they make me nervous as well.)
If I were to design a hobbyist kit, I'd probably just use a breakout board with the USB-C connector already soldered onto it.
[0]: https://www.lcsc.com/product-detail/USB-Connectors_Jing-Exte...
[1]: https://www.lcsc.com/product-detail/USB-Connectors_XUNPU-TYP...
[2]: https://www.lcsc.com/product-detail/USB-Connectors_Korean-Hr...
With wings and small holes to help with rough alignment, I’d sure rather buy a kit with micro-USB than mini.
I think I might even own more USB-A/C to DC cables than I own mini-B cables.
But for a hobbyist device, the currently available USB-C jacks have pins that are too small to solder by hand so I'll settle there. It would be nice if hand-solderable breakout boards were cheaper and more commonly available (the DC trigger boards out there are a great start but typically have to be ordered direct from China)
But for factory-manufactured goods, DC jacks need to die and be replaced with USB-C.
Meanwhile there is no room anywhere for mini-B, micro-B, etc anymore, even on hobbyist devices. I'm not even sure I could even find a mini-B cable in a physical store nearby anymore.
My parents had a D-link DSL modem and Router where both the devices looked pretty much the same (they were stackable), had the same DC jacks, the power adapters looked the same, but were different voltages, which you could tell in white-on-gray 12pt text.
In my experience (as a self-taught hobbyist), SMD is easier to work with given cheap equipment (an Amazon skillet, some aquatic sand, and a cheap tube of T5 paste).
I would much rather just use a standard USB-C power brick and run it through something like the boards you listed, but they don't seem to support 33v. Any help would be greatly appreciated.
- a USB-C receptacle
- a couple DIP switches where you set the output voltage range you're expecting/able to handle and the minimum wattage you need
- a molex plug to attach a modular set of buck-boost converters
- screw terminals to attach your circuitry
- a small-current 5V regulator output for the "initial" brains of your circuitry, a 5V output signal for power-good and power-bad (source can't supply the required wattage), and an optional input that activates the high-power output
https://www.sparkfun.com/products/15801
And one of those PD measuring things for giggles:
For obvious reasons. Almost everything can tolerate 5V. Very few things can tolerate 9V and above.
Consequently, you need a complicated dance in order to ensure that everybody agrees before jamming 9V, 15V or 20V down the pipe. That dance has enough complexity that effectively everybody uses a full-blown Cortex M0 with a couple of purpose built analog blocks to carry it out.
See: https://www.infineon.com/cms/en/product/universal-serial-bus...
If you look at Digikey AC-DC power supplies, you can find about 12K that end in a barrel jack.
Of those 12K, only 6 are not a 2.5mmx5.5mm, 2.1mmx5.5mm or smaller barrel jack. And Digikey seems to not even stock the mating jack for those 6 power supplies.
There is also absolutely no standardization of what voltage level corresponds to which jack. I have about a half-dozen dead Beaglebone Black's over the years because I had two different power supplies on my lab bench for testing and the plugs were "juuuuust" close enough (2.5mm and 2.1mm are compatible enough to let you short things out even if you can't completely seat them) to let me put 12V or higher onto a 5V-only jack.
The only time I use 2.1mm is when I'm going to daisy chain or do something besides point to point, when I'm doing solar, or when I'm using the connector for something other than power(A voltage divider can protect your input from accidental power connection, so it's one of my favorite simple connectors).
Just watch out, 12v isn't a thing anymore in the new specs and might not work, best to build around 5v, 9v, 15v, or 20v.
Although usually if I just need 5v, I'm building around a D1 Mini ESP32 module that already has 5v built in.
Edit: the one chx linked to above is precisely of this kind
Fairly cheap but easy to configure with the dip switches and the boards I've been sent have been high quality with good solder joints.
[1] https://www.analog.com/media/en/news-marketing-collateral/so...
But I also successfully used a combination of simply a shortly rectifier, some Zehner diodes without any buffering via batteries. It would be great to have the buckboost just after the rectifier IMHO. I would somehow expect it to work much bette if one could simple pass down the higher voltage in USB-C if you are riding faster rather than converting it to 5V.
Ok. So if i make today a device, tomorrow it will be obsolete ? I guess some people are paid to come with ideas.
Anyway this USB-PD looks like a good parody (240 W in a USB-C connector - what can go wrong? ). I take my popcorn.
Which is exactly why this particular problem is a lot more annoying for hobbyists rather than actual industry players.
PD is obviously the future, but if you just need a 12V motor project running on battery by tomorrow morning, QC can be an option too.
"The latest USB-C chargers are apparently more powerful than Apollo 11’s computer"
https://www.theverge.com/tldr/2020/2/11/21133119/usb-c-anker...
The reality of today’s MCUs is that you can get single-digit MIPS at the price of shipping, handling, and the plastic of the chip’s package. So you see those used where a handful of discrete logic would suffice, like before that you’d see discrete logic where a couple of relays and a handful funny-shaped mechanical actuators would suffice. It’s overkill in the sense that you don’t need nearly as much compute as you get, but it’s completely rational in that it’s genuinely the most cost-efficient approach.
You can also (and thank you STMicroelectronics and before that Atmel for getting Microchip off their collective asses on that) get ridiculous amounts of I/O to drive with that compute. Gobs of GPIOs with individually configurable driving modes? No problem. Multiple DACs and ADCs? Sure. I2C and SPI? You bet. Two or three UARTs? Gotcha, would you like some CAN with that? In a 24-pin package so you can actually use more than a couple of these? Ahh now that’ll be four times the price, please and thank you.
You know what’s also expensive? RAM and (to a lesser extent) ROM. The TRS-80 came with 4K bytes of RAM at minimum. The AGC had about the same computing power, 2K words of RAM and 36K words of ROM, and still the designers traded speed for program memory by writing a bytecode VM. The cheapest STM8S0, by contrast, comes with 256 bytes of RAM and no external memory interface; and I don’t even want to think about the obscure Chinese 6502 and 8051 clones you’ll find under the epoxy in toys and TV remotes. All that power and all you can fit in there is a glorified flowchart. But if you think about it as programmable logic, in the widest possible sense of the phrase, it makes perfect sense!
Also (and here I could be wrong), my understanding is that the software on the AGC couldn’t actually plan the mission—it could do some specific things that you can’t reasonably to by remote, like landing, but most of the math was done by much chonkier programs on much beefier machines. It was a controller in the purest sense: it could control the hardware to achieve what you wanted, but you had to tell it precisely what, it didn’t figure it out for you. So if anything goes wrong and your comms are busted, you die.
Don’t get me wrong, the AGC is bloody impressive. (Transparent native code / bytecode interworking anyone?.. None of those words were even in the dictionary back then.) But through equally impressive efforts of other people, its computing power was table stakes within a decade. Nowadays it’s a rounding error in your bill of materials.
ETA: Ah, I see, the argument is that the Cortex-M0+ in question is superior in MIPS, RAM, and ROM. Yeah, that’s more reasonable. Low-end Cortex-Ms can also be very cheap these days[1], provided you can source them.
[1] https://hackaday.com/2023/02/16/puya-py32-the-cheapest-flash...
When it comes to electric guitars if something is done backwards compared to everything else it probably comes down to some pioneer in that thing got it wrong and then everyone else copied them.
That's why the arm on many electric guitars that you can jiggle to cause pitch variation (which is called "vibrato") is often called a "tremolo" arm. Fender put a vibrato system on their 1954 Stratocaster but called it a tremolo system and that stuck in the electric guitar world.
Then in 1964 they introduced the Fender Vibrolux amp. That included a circuit to rapidly vary volume (which is called "tremolo") but they called it a "vibrato" system, thus completing Fender's complete reversal of the meaning of vibrato and tremolo.
Firstly, it appears a few people have not actually went through and read what I wrote and suggested, well pretty much the same thing I suggested on the article! If you can get away with 5V, I link to 6p connectors that are indeed very easy to use, and even provided links to my own projects [1] using them! Please, have a read of the article, maybe there is something I missed, but it's not that.
Secondly, I made this very clear that what I'm writing about is for hobby projects. Of course a lot of the energy I'm spending looking at options here is not going to be a worthy RoI if you're doing this professionally. That's the point of a hobby project! [2] But it also means that I'm looking for things that are easy to source and to modify for different uses. If the answer is "Use that one module, that only one manufacturer makes" or "Get a cheap AliExpress thing that maybe will exist in two years and maybe not", then I feel like it's all for nothing. When I looked into this (which admittedly by now is _months_ ago!) finding the components for the fpx board [3] (which someone linked to down in the thread already) was basically impossible as the STUSB4500 was out of stock everywhere.
Thus, trying to find alternatives and trying to "pay the development price" once, and have others be able to pick up some code for ESPhome or Zephyr and build upon it. I'm sure there's plenty of closed-source implementations of these in ECs and similar closed-source firmwares, so why not get it in hands of more people?
Also, honestly, I enjoy the challenge, when it's not frustrated by manufacturers publishing outright lies in their datasheets (more on that in the next few months!) and since I had some additional spare time for a couple of months, I connected it with a fundraiser [4] not for me but for Diabetes UK. Y'all are welcome to donate to Diabetes UK if you want to read more on this topic. Some of it is written down already, but other stuff has been basically stalled.
[1] https://flameeyes.blog/2023/07/30/acrylic-lamps-finally-work... [2] https://flameeyes.blog/2020/01/19/unnecessary-but-required/ [3] https://blog.oxplot.com/fpx/ [4] https://tiltify.com/@flameeyes/gone-with-the-wind
Giving up on understanding and documenting it is not going to improve the situation, we'll just end up relying on a handful of manufacturers that are the only ones able to supply what everyone else built upon… and the chip shortage of 2020/2021 pretty much has shown how bad that can get.