USB C breakout as a power source? - Page 1
Forum section: electronics / projects

author: Youkai
author_rank: Regular Contributor
timestamp: November 28, 2023, 05:37:27 am
content: I'm working on a project that will likely need a 5v ~2A power source. I'm debating what I want to use as the source. The simple thing would be a barrel plug power supply. But if I did that I'd have to package the wall plug with my project.I'm thinking it might make more sense though to use aUSB C breakoutthat way the user can provide their own power brick and get a cable of whatever length they need. If I use that; GND is obviously my ground. Which one is the positive voltage pin? Can I use this and only connect GND and V+ to use it as a power source?EDIT: I looked at the data sheet a little. I guess VBUS is the positive terminal? What does VBUS mean and why is it that instead of "5v" or similar?

author: sleemanj
author_rank: Super Contributor
timestamp: November 28, 2023, 05:52:41 am
content: Without negotiation, VBus is 5v. VBus = Bus VoltageUSB-C can provide higher voltages with negotiation.

author: Berni
author_rank: Super Contributor
timestamp: November 28, 2023, 06:30:45 am
content: Vbus is not called 5V because it might not always be 5V. Using USB-PD the Vbus might have 5V 9V 12V 15V 20V 48V..etcAlso that breakout board has CC pins that you need to use in order to present yourself as a USB device, otherwise there will be no power on Vbus when plugged into a host with a native USB-C port.Additionally your device is supposed to check if the host can deliver the 2A that you want by monitoring the CC lines, since the port you are plugged into might be able to supply one of these power levels:- Default USB (500mA for USB 2.0 or 900mA for USB 3.0)- 5V at 1.5A- 5V at 3ASo in your case of needing 2A, if the host reports that can't do the 5V 3A mode, then your device is supposed to reduce its power consumption (either low power mode or turn off)That being said a lot of cheep USB devices on the market do not follow these rules. So as a result they sometimes don't work when plugged into certain things.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 28, 2023, 06:49:55 am
content: If the OP is only going to use it with USB "chargers", in most cases there is no need to configure the CCx pins as they always provide 5V. Of course, that would restrict it to these USB chargers/power adapters.Which seems to be what the OP was thinking about. In that case, of course, make it clear it won't (may not) work with any USB host (which may actually be a feature rather than a problem here, depending on use cases.)I would at least add a fuse/PTC on the VBUS pin, followed by a TVS that will protect your devices from ESD and act as a voltage limiter at the same time. And keep in mind that VBUS (when not negotiated) may not be exactly 5V. It has an official range from 4.75V to 5.5V (now) and in practice, that may be a bit outside of this window, so you should take that into account to design whatever is going to be powered by this.

author: ejeffrey
author_rank: Super Contributor
timestamp: November 28, 2023, 06:54:04 am
content: Also, if someone uses a USB A-> C cable, the resistor for advertising the current limit will be in the cable instead of the power adapter. Since the cable doesn't know what port it will be plugged in to, it is supposed to always have the resistor for the "default USB" setting.That leads to the unfortunate situation that if you believe the resistor, you won't be able draw 2 amps from a wall charger with a USB type A port, but if you ignore it then you can overload or contribute to overloading a port on a computer.The USB BC spec for dedicated charge ports allows drawing at least 1.5 A this is detected by looking for the D+ and D- pins to be shorted together with < 200 ohm.So ideally you would check both. If the CC resistor is set to indicate 3A you are connected to a USB C port and are good to go. Otherwise if the data pins are shorted you are connected to a charge port and can probably draw 2A. Otherwise you are likey connected to a USB A data port or a low power USB C port and you should go into standby mode.

author: ejeffrey
author_rank: Super Contributor
timestamp: November 28, 2023, 07:00:11 am
content: Quote from: SiliconWizard on November 28, 2023, 06:49:55 amAre you sure about that? I could be wrong but my understanding was that even dedicated charge ports with a USB-C connector are required to sense the CC resistors and only supply Vbus if they are there. This is so that if someone connects an A to C cable from the charge port to a type A data port you don't end up back feeding power to the data port.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 28, 2023, 07:31:05 am
content: Quote from: ejeffrey on November 28, 2023, 07:00:11 amYou're probably right, if talking about USB chargers that expose a true USB-C port. I was more talking about USB chargers that have a USB-A port, which are still ubiquitous, and that you'd connect using a USB-A USB-C cable. Or those power adapters that directly have a USB-C male connector (like a lot of these USB-C "power bricks".)But if you want to be more flexible and be able to connect to just any USB-C port on the other side, then yes, you need to configure the CCx pins appropriately, but then you're also going to enter a rabbit hole, as you may not be able to get enough current in that case, unless you can negotiate things. If we really want a generic solution. So, beware. Eitther restrict to a very limited use case (as what I had in mind, barely using chargers with an USB-A port), or be prepared to, yeah, enter a rabbit hole.

author: Berni
author_rank: Super Contributor
timestamp: November 28, 2023, 11:28:53 am
content: Yeah there are a lot of shortcuts you can take and still have it work, just not in all cases.Some USB-C phone chargers might indeed always give 5V without plugging anything in, but not all of them. The correct thing to do on USB-C is to not provide power until you know you have a so called "down stream device" requiring power connected to it. This is because USB-C removes the gender asymmetry between host and device. All devices have a female USB-C port (regardless if host of device) and all cables have a male USB-C plug, so you can connect any combination together, including USB-C to USB-A cables for backwards compatibility, or even reverse, USB-C to USB-A female (for plugging a USB-A thumb drive into a USB-C laptop for example).So you might end up with a USB-C port even switching roles between providing power or receiving power depending on what is on the other end of the cable.Id say ability to charge from a USB-C charger using a USB-C to USB-C cable is pretty important. They are the future of phone chargers. Not only because USB-C is a more modern standard, but also because it allows for faster charging trough USB-PD support. So as a result i stopped buying USB-A chargers.Luckily all you really have to do is place fixed resistors on the CC pins. When using a USB-A charger it won't see them anyway, or when a USB-C port sees them it will configure it for 5V 3A output. When plugged into a PC over USB, just go ahead and try drawing 2A. Most computers power multiple USB ports from one overcurrent protection chip, so they will supply 2A just fine as long as the other ports next to it are not too heavily loaded. And if the PC did properly implement port by port 500mA protection, well then it will just turn off and you will get the "USB short circuit" pop up on the screen. You won't really blow up anything. Just don't expect to get your device trough the official USB certification process with that, So just don't put the USB logo on it.

author: Youkai
author_rank: Regular Contributor
timestamp: November 28, 2023, 05:13:03 pm
content: Quote from: Berni on November 28, 2023, 11:28:53 amOk so it seems if I want to use the USB-C breakout as my power source. I need to use GND (-) and VBUS (+).Additionally I need to wire a resistor across CC1 and CC2 so that negotiation capable power sources know how much to supply? What's the value of that resistor? Is there a table somewhere that identifies the resistor values for different current loads?I assume I can safely ignore the D+ and D- pins since I'm not transferring data.Thanks for the help everyone.

author: ejeffrey
author_rank: Super Contributor
timestamp: November 28, 2023, 07:35:29 pm
content: 5.1 kOhm pull down to ground on each of the CC pins is what you need.

author: ejeffrey
author_rank: Super Contributor
timestamp: November 28, 2023, 07:38:03 pm
content: https://community.infineon.com/t5/Knowledge-Base-Articles/Termination-Resistors-Required-for-the-USB-Type-C-Connector-KBA97180/ta-p/253544What you are looking for is the Rd value which is constant. The charger will have the Rp value appropriate for its capacity.

author: trophosphere
author_rank: Frequent Contributor
timestamp: November 28, 2023, 07:54:16 pm
content: Quote from: Youkai on November 28, 2023, 05:13:03 pmCorrectQuote from: Youkai on November 28, 2023, 05:13:03 pmEach CC pin needs its own resistor shorted to ground. Note that by doing this it does not necessary mean you can go ahead and draw 3A! See below.Quote from: Youkai on November 28, 2023, 05:13:03 pmEach resistor needs to be 5.1 Kto start. You may want to perusethis pdfif you are interested in implementing something on your device that will see if drawing 3A is indeed allowed from a down facing port (DFP).Quote from: Youkai on November 28, 2023, 05:13:03 pmYou can safely ignore the D+ and D- pins; however, if you want your device to be able to leverage BC 1.2 then couldimplement a detection scheme.

author: Youkai
author_rank: Regular Contributor
timestamp: November 28, 2023, 08:09:45 pm
content: The circuit is going to have a micro-controller, small LCD panel, and some LED's on it. I expect it will draw between 1 and 2A during normal usage. That's all I need it to do. I just need a "dumb" power source that can provide enough current at 5v.

author: DavidAlfa
author_rank: Super Contributor
timestamp: November 28, 2023, 08:53:31 pm
content: Quote from: Berni on November 28, 2023, 06:30:45 amBy default, yes, should be exactly 5V unless specifically negotiated.The device is taking to the charger all the time to maintain special voltage modes, once you unplug it or the communication breaks, the charger instantly reverts to 5V.Otherwise, imagine what would happen if you removed the cable from a 20V device and then inserted it into your phone.In fact I remember a charger (Or was it a cable?) from Aukey brand, had a bug and the negotiated voltage stayed after unplugging the device, causing a true carnage in some cases.They made a huge recall replacing all for free.Most chargers won't control the current, will provide 1...2A as long as they're capable enough.Before PD, the USB data pins were used to tell the device (phone,etc) which charger is being connected, so they adjust the drawed current.In practice this was used as a propietary BS, each brand used different resistor dividers in their chargers and the phone would charge slowly with anything else.So using just VBUS and GND should work as long as the charger is rated for 2A.Of course, join both VBUS pins in the PCB.

author: Youkai
author_rank: Regular Contributor
timestamp: November 28, 2023, 08:56:17 pm
content: I foundthis 3-pack of chargerson Amazon. I read through the specs as best as I can and I think it will do what I need.Am I correct in thinking that if I wire up the two 5.1K resistors this will provide 3A at 5v?And that my circuit which I expect to use between 1 and 2A will work fine off of this as a power source?

author: DavidAlfa
author_rank: Super Contributor
timestamp: November 28, 2023, 09:08:36 pm
content: Fromhttps://electronics.stackexchange.com/questions/442063/usb-c-ufp-cc-configuration-what-rd-resistor-value-i-need-to-use-to-be-able-to-dQuote

author: sleemanj
author_rank: Super Contributor
timestamp: November 28, 2023, 11:45:44 pm
content: The sparkfun breakout you posted in your first post already has the CC pulldowns on it you can see in the photo.

author: Youkai
author_rank: Regular Contributor
timestamp: November 29, 2023, 12:26:01 am
content: Oh I see. I looked at that PDF. That's the schematic of the breakout? Not like a suggested implementation? I'm still learning how to read/lookup spec sheets.Can someone explain to me what J2 and J3 represent in this:https://cdn.sparkfun.com/assets/6/1/7/9/8/USB-C-Breakout_Schematic.pdf

author: sleemanj
author_rank: Super Contributor
timestamp: November 29, 2023, 05:17:46 am
content: J is the usual designator for connectors. In this case J2 is the usb connector, and J3 is the pin header (or rather the holes for one).