[HN Gopher] USB Power Delivery for Hobby Projects
___________________________________________________________________
USB Power Delivery for Hobby Projects
Author : panic
Score : 74 points
Date : 2023-10-26 21:52 UTC (3 days ago)
(HTM) web link (flameeyes.blog)
(TXT) w3m dump (flameeyes.blog)
| userbinator wrote:
| I guess the tl;dr of the article can be summed up as "better
| not". If all you need is to supply power, than a regular two-pole
| connector with a fixed voltage will save a ton of work and
| probably end up more reliable.
| eternityforest wrote:
| I use a $2 PD trigger module on basically everything.
|
| 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).
| adhesive_wombat wrote:
| Which PD module do you use?
| eternityforest wrote:
| I think they're pretty much all unbranded and look similar,
| but now there are some with through hole outputs instead of
| pads to solder wire. If I didn't already have a stash I
| would probably get those and some right angle male headers.
|
| 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.
| rzzzt wrote:
| I saw one in a YouTube build video that allows you to
| select output voltage / what it will negotiate using a
| pushbutton, the selection is indicated by the color of an
| LED (and hopefully persisted when powered down).
|
| Edit: the one chx linked to above is precisely of this
| kind
| adhesive_wombat wrote:
| A unique twist on this is a module that is programmed by
| a flashing light, for example a web page with a flashing
| image: https://hackaday.com/2021/04/21/easy-
| usb%E2%80%91c-power-for...
| Flameeyes wrote:
| That _was_ my first choice, to be honest, but the device
| (and the chip itself) was unobtanium at the point I was
| looking at it.
| chx wrote:
| https://goughlui.com/2023/10/22/tested-project-usb-c-pd-
| trig...
|
| More on the ZY12PDN: https://lygte-
| info.dk/review/USBmeter%20yzxStudio%20ZY12PDS%...
| CosmicBee wrote:
| I'm not the parent but I'm a fan of WeAct's modules.
| https://www.aliexpress.us/item/3256803150519042.html
|
| 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.
| MrBuddyCasino wrote:
| Same, I always have a few ready to use. Can't wait for 48V
| USB to kill the remaining barrel plug usages.
| bmicraft wrote:
| I've know about EPR since the spec was release, but reading
| "48V USB" somehow still caught me a bit of guard because it
| just sounds cursed
| ilyt wrote:
| I use it when it's 12V, it's probably most popular barrel
| plug voltage and also used in a lot of audio devices (aside
| from guitar pedals which have 9V with reversed voltage...
| fuck that)
| bsder wrote:
| No, it's "5V is easy. Anything above that is not."
|
| 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...
| ilyt wrote:
| I'm waiting for something like that but with built-in buck-
| boost to make it immune for charger quirks
| userbinator wrote:
| For higher voltages, use a barrel plug. There's a de-facto
| standard of 12V and 20V there, with the latter using a
| slightly larger plug. As they're used widely in laptops,
| parts are readily available.
| bsder wrote:
| > For higher voltages, use a barrel plug. There's a de-
| facto standard of 12V and 20V there, with the latter using
| a slightly larger plug. As they're used widely in laptops,
| parts are readily available.
|
| 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.
| mschuster91 wrote:
| What I'd _love_ to see is a tiny little board with
|
| - 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
| lakid wrote:
| This has some of what you are after ?
| https://www.tikstation.com/product/mini-power-station/
| mschuster91 wrote:
| Oh, indeed. But the price point is crazy, that thing is more
| expensive than a Raspberry Pi.
| genmud wrote:
| Wanna make one, we could open source it? I have thought about
| making something similar before for driving VFD/Nixie tubes.
| There are a bunch of things out there that don't _quite_
| scratch the itch.
|
| https://www.sparkfun.com/products/15801
|
| https://www.adafruit.com/product/5807
|
| https://electroniccats.com/store/catsink-usb-c-pd/
| riedel wrote:
| My dream would be to implement a bicycle dynamo (or rather
| universal) charger that negotiates the out voltage with a 2.7 to
| 40V buck boost (like the LTC3115-1 [1]) in the middle.
|
| [1] https://www.analog.com/media/en/news-marketing-
| collateral/so...
| zrail wrote:
| Kind of like this? https://pedalcell.com
| perilunar wrote:
| JFHC that's expensive -- $641 for a tiny generator and a
| battery. That's more than my bike cost.
| morsch wrote:
| It's 399 USD. Still seems ridiculous.
| riedel wrote:
| I already have this one (much cheaper, German site)
| :https://www.forumslader.de/forumslader-pro/
|
| 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.
| kozak wrote:
| So, why are center positive barrel jacks risky when used with
| rechargeable batteries? I tried googling and asking ChatGPT about
| that to no avail.
| ssl232 wrote:
| I wondered about that as well. My best guess is that it's
| something to do with which pin makes contact first in the
| barrel, and having the battery parallel to the barrel's
| contacts, it might matter which one contacts first (though I
| can't think why).
| r2_pilot wrote:
| Not an electrical engineer but I dabble; I believe it would be
| because center positive could have electric current going to
| the battery before the ground connection is made. Center-
| negative would guarantee the ground connects first. {edited}
| Based off a quick Kagi search and reddit results guitarists use
| center negative connections and most wall plugs provide center
| positive, but I don't really know why.
| tzs wrote:
| > Based off a quick Kagi search and reddit results guitarists
| use center negative connections and most wall plugs provide
| center positive, but I don't really know why
|
| 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.
| _trampeltier wrote:
| Comes to mind ..
|
| "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...
| mananaysiempre wrote:
| I mean, with all due respect, so? An OG ATmega-based Arduino is
| significantly more powerful than the AGC. A garage opener from
| a decade ago can easily be more powerful (MIPS-wise) than the
| AGC. I wouldn't be surprised if that holiday candy box that
| plays music when you open it were more powerful than the AGC.
|
| 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...
| yjftsjthsd-h wrote:
| There's probably a commentary there about the compute being
| less important than it being attached to the most powerful
| rocket ever built.
| crote wrote:
| Most of that complexity isn't needed, though.
|
| 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.
|
| [0]: https://aliexpress.com/item/1005003828144045.html
|
| [1]: https://www.adafruit.com/product/5807
| JKCalhoun wrote:
| I'm adding USB to projects just as a power cable but I'm
| (still) trying to avoid surface-mount.
|
| 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.)
| sokoloff wrote:
| Even hobbyists should be able to handle a fat pitch part like
| a surface mount micro USB-B. (I'm talking about once they get
| over the mental block. :) )
|
| With wings and small holes to help with rough alignment, I'd
| sure rather buy a kit with micro-USB than mini.
| kalleboo wrote:
| At this point I think I'd rather have a DC jack than mini-B
|
| I think I might even own more USB-A/C to DC cables than I own
| mini-B cables.
| dylan604 wrote:
| I'm perplexed by the desire to move away from DC jacks as
| well. Power needs 2 pins. Using a multipin connector
| knowingly to only use 2 pins is rather confusing.
| kalleboo wrote:
| Personally I would prefer USB-C for everything. I have
| plugged in the wrong DC adapter (wrong polarity or
| voltage but the same physical form factor) far too many
| times and killed too many things. Not to mention all the
| device-specific DC adapters that have been lost through
| the ages.
|
| 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.
| JKCalhoun wrote:
| Yeah, that's basically it. I have a drawer of barrel-jack
| wall warts but they all vary in diameter, polarity,
| voltage, current... USB is a nice standard 5V source.
| kalleboo wrote:
| Even the confusion about USB-C devices and adapters is
| nothing compared to the insanity that is DC jacks. At
| least USB-C will just not work instead of destroy things.
|
| 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.
| numpad0 wrote:
| DC barrel plugs aren't best in terms of contact
| stability, they can rotate and slide and create noises.
| Something with locking and indexing would be better,
| which USB-C don't quite qualify but I guess is close
| enough.
| bmicraft wrote:
| The "problem" with dc jacks is you have to know what
| voltage something needs, maybe years after your or
| someone else built it. With usb-c you might have to
| remember that it needs a power supply with 15V support,
| but it won't let out the magic smoke if you chose the
| wrong one.
| pi-rat wrote:
| Don't forget that you can often through-hole mount cheap
| readily made module boards like the one above. Often without
| adding height.
| JKCalhoun wrote:
| It looks a little hacky, but I may have to succumb, ha ha.
| crote wrote:
| They do exist [0][1][2], but they're not really suitable for
| hobbyist kits either. Due to the pin density they aren't
| really any easier to solder than SMD.
|
| 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...
| JKCalhoun wrote:
| Thanks, looking at these 6P connectors, the through-hole
| mounts ought to make the SMT connectors easy to solder
| down. I'll pick a few up and try them out on my next PCB
| project. (Worst case I can pre-solder these to the PCBs in
| the kits.)
| the__alchemist wrote:
| As crote pointed out, you can get THT ones, but this sounds
| like an XY problem: I would reflect on why you (and the kit
| targets) avoid SMD, and if that's something you should
| consider doing.
| foldr wrote:
| Let me be the nth person to say _don 't avoid surface mount_.
| Temperature controlled soldering irons are cheap now. Once
| you have one, coarse pitch SMT parts are really just as easy
| to solder as through hole.
| junon wrote:
| Out of curiosity, why is SMD avoided?
|
| 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).
| the__alchemist wrote:
| I'm confused by the article; I use USB power delivery with
| USB-C all the time, and haven't hit the considerations it
| mentions. Set up a fuse and diode on the power out, set up the
| CC resistors, choose a footprint in SMT or THT as appropriate.
| Thrir94994i wrote:
| I really hate USB PD for hobby project. You are getting into
| territory of cheap Chinese power adapters and voltage regulators,
| with high risk of fire! It is very easy and cheap, to find power
| bricks for any voltage, with much much better quality!
| Flameeyes wrote:
| I mean, that's the whole point why I decided to go down the
| rabbit hole of spending time to learn and understand it instead
| of just grabbing the cheapest AliExpress trigger board and hope
| for the best.
|
| 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.
| askiiart wrote:
| Has anyone in the portable Wii space looked at powering one with
| a USB PD power bank? It would be really nice to just hook up a
| USB power bank, maybe something like this, which could power a
| disc drive-less Wii for a few hours, rather than dealing with
| batteries inside the Wii itself.
| danhor wrote:
| At least the Wii U can just be powered using a 15V PD trigger.
| The maximum current requirement of 5A isn't met, but works just
| fine. Since the Wii needs 12V I would add a DC-DC converter but
| I don't see any reason why it shouldn't work.
| askiiart wrote:
| Just a small clarification: The maximum 5A of the original
| power adapter can't be met, but without a disc drive a Wii
| pulls about 15-20 watts, then add in a screen and that's
| maybe another 5 watts, well within the 3A (45W) a power bank
| can provide.
| amelius wrote:
| For hobby projects perhaps also apply galvanic isolation, so that
| you don't damage your PC when something goes wrong.
| Havoc wrote:
| Excellent timing - my aliexpress package with PD kit came today.
| PD triggers (12V) for fan plus converts down to 5V for esp32.
|
| And one of those PD measuring things for giggles:
|
| https://www.aliexpress.com/item/1005005933827668.html
| frob wrote:
| I feel vindicated that I still default to just cutting the end
| off of an old USB-A cable and directly drawing from the power and
| ground lines.
| numpad0 wrote:
| Another path to get non-5v in hobby projects is Qualcomm Quick
| Charge 2.0/3.0. They allow up to 20V/1.67A from USB-A and easily
| triggerable from a junk bin ATTiny85. Lots of powerbank products
| still support it as legacy compatibility.
|
| 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.
| Flameeyes wrote:
| Article author here -- just to clarify a couple of points.
|
| 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
| JohnFen wrote:
| This is why I stick with barrel jacks for most of my projects. It
| keeps things simple, and the only real downside is that it isn't
| compact. For projects that need compactness, I go with USB micro
| B. For my power purposes, USB-C just adds complexity without any
| significant benefit.
___________________________________________________________________
(page generated 2023-10-29 23:02 UTC)