4
\$\begingroup\$

I'd like to properly power a gadget off USB (2.4A USB powerbank https://www.amazon.com/Anker-20100mAh-Portable-Charger-PowerCore/dp/B00X5RV14Y/ref=sr_1_3?ie=UTF8&qid=1512261941&sr=8-3) consisting of:

  • A cheap power only USB Y-splitter
  • Raspberry Pi Zero
  • A boost converter from 5V USB to 12V
  • 4 LEDs in series
  • An ULN2003A used to control a unipolar stepper motor
  • Some sort of graphical output (OLED/Character LCD)

Adding all the respective current values together, the max. current draw of my gadget should be:
180mA RPi Zero + 500mA LEDs (384mA for perfect transformation, I assumed 75% efficiency) + 165mA Stepper Motor + 165mA Character LCD = 1010mA total power draw.

What I know so far:

Having delved into (and having been overwhelmed by) the USB specification, I have found that USB can under some circumstances supply 5V@1.5A (or even more).

Back in the day, there apparently used to be a kind-of handshake process (enumeration/negotiation/...) which was necessary to allow >100mA. I found an article explaining some aspects of USB charging: http://www.electronicdesign.com/interconnects/introduction-usb-power-delivery

It’s important to note that BC-1.1 was released as an Engineering Change Notice (ECN) to USB 2.0 and it significantly deviated from the sanctions of USB 2.0. As per USB 2.0, any USB device could be classified as either low power (5 V @ 100 mA) or high power (5 V @ 500 mA). On connection, a USB device was allowed to draw 100-mA current initially while enumerating and negotiating its power budget with the host. Based on the enumeration, the host would either raise the power delivery to 2.5 W or continue at 0.5 W.

The battery-charging spec went on to define more power sources than what was recommended above:

  1. Standard downstream port (SDP): power source compliant with USB 2.0 Spec.

  2. Charging downstream port (CDP): power source not compliant to USB 2.0. CDP can supply up to 7.5 W (5 V, 1.5 A) and the 1.5-A current can be supplied before enumeration.
    ...

  3. Dedicated charging port (DCP): There’s no enumeration here, and charging occurs without any digital connection. DCP supplies up to 1.5 A and 5 V.

There has been a similar question before ("Dumb" power from USB), but it does not mention SDP and CDP. Apparently, you can achieve CDP-mode when you short the data lines together.

My question:

  1. Can I get the full 5V 1.5A (or even 1.8A) power from an ideal (100% USB standard-conforming, protocol-following) port without any fancy enumeration/registration/...
  2. Can I get the full 5V 1.5A (or even 1.8A) power from a real world (a decently beefy power bank like the Anker in the Amazon link) port without any fancy enumeration/registration/...
  3. In case I need negotiation, couldn't the Pi just handle it in the name of both sides of the Y-splitter (they terminate in one Micro-USB port, so the power bank shouldn't even know that the cable splits somewhere downstream...

Here's how I intend to wire it up: My intended wiring

\$\endgroup\$
  • \$\begingroup\$ Actually, for the Anker stuff, you probably need to look in to the quick-charge spec. I know some of their devices use it. qualcomm.com/products/features/quick-charge I'd be shocked if the chargers had a USB host controller in them requiring a handshake. \$\endgroup\$ – pgvoorhees Dec 3 '17 at 2:35
  • \$\begingroup\$ USB powerbanks don't implementing any USB signalling at all, but boost conversion here is probably a mistake. Look for a well engineered ~12v pack, and use a switching regulator to power the 5v loads from it. \$\endgroup\$ – Chris Stratton Dec 3 '17 at 2:41
  • \$\begingroup\$ From a realistic power bank, you can get the full current without doing any negotiation. Also, if it has multiple ports each with a current limit on the label, all the ones I've tried just had the ports connected in parallel, so you can probably get the full limit from one port. \$\endgroup\$ – immibis Dec 4 '17 at 2:04
  • \$\begingroup\$ @ChrisStratton I wish I could to that, but I really need the abundance of USB. My gadget will be used on the go, so carrying my regular powerbank AND a dedicated 12V powerbank would be a mayor pain. Is the 5V -> 12V boost converter in your mind just a non-optimal or an outright wrong solution? \$\endgroup\$ – iMrFelix Dec 4 '17 at 21:01
1
\$\begingroup\$

You are approaching the problem upside-down.

First, all BC/QC etc. charging protocols are used primarily for DEVICES, so the devices can understand the source capability, and then configure itself internally to align their consumption with the source. There could be another stage to negotiate the voltage level, but this in this case both provider and consumer must use the same protocol/standard.

The ANKER powerbank is just a source of 5 V 2.4 A. It doesn't even follow any announced standards. Their "PowerIQ" is utter BS.

(Disclaimer: there used to be ideas of intelligent chargers that are supposed to change advertised standard, and select the "best" based on maximum current draw. The problem is that phones also use some intelligence and take different charges depending on the battery's state of charge, so the algorithm doesn't converge. These "chargers" might work a bit better than the dumb ones, but no guarantee).

Therefore, if you have the Anker powerbank, you don't need to do anything, just split the power as you suggested yourself.

Regarding your specific qiestions,

(1) No, you can't be sure that any USB (legacy Type-A) port will let you draw 1.5 A. While usually you can do much more than that, some ports may have current limits set for 500-600-900 mA, so the port will sense overcurrent and will be shut down; [A 100% USB standard-conforming, protocol-following port with 1.5 A capability must be specifically designed as "charging port", and shall be explicitly labeled as such.]

(2) Yes, if a bank is rated above 1.8 A (say, 2100 mA), you can safely draw 1.8 A from it without any fancy reservations;

(3) Since this is a case when you don't need to do anything, the question is moot. But no, Pi-3 or whatever can't handle any of the "negotiations" even if the bank follows one of intelligent charging standards. First, the power supply port on Pi doesn't have any connections to D+/D- pins. Second, to bring in negotiations, you would need a special IC that is designed for this.

\$\endgroup\$
  • \$\begingroup\$ Actually, in fact, many Quallcom based Androids apply one of several QC protocols and my phone charges using 12V (or maybe even a higher voltage?) in 1 hour from 5% to 85% on a QC2.0 charger and/or the compatible power-bank, yet takes more than 3 hours for the same on a cheapy weepy 2.4A power bank. That is, however, just an aside to your tangential thought and is not meant to detract from other elements. \$\endgroup\$ – Asmyldof Dec 3 '17 at 3:47
  • \$\begingroup\$ @Asmyldof, yes, if a device and charger have QC protocol embedded, they will "negotiate" higher voltage, and therefore charge your QC-enabled device quite faster. So how it is a surprise, and how it contradicts to my answer? Also, they don't apply "several QC protocols", the protocol is only one, QC, currently on version 4+, which is backwards compatible with 3.0, 2.0 amd 1.0 versions of QC. \$\endgroup\$ – Ale..chenski Dec 3 '17 at 3:54
  • \$\begingroup\$ @AliChen Thank you so much for your answer, it really cleared matters up! Let's say I were to plug my contraption into a non-supporting USB-port (e.g. a <1A power bank or a USB port from a laptop), would I risk damage to the bank/laptop due to overcurrent (I guess it depends if it has some sort of overcurrent-sensing built in) or would my contraption just be underpowered? \$\endgroup\$ – iMrFelix Dec 3 '17 at 20:14
  • \$\begingroup\$ @iMrFelix, if you try to get more than 500-900 mA of current from a regular (non-charging) USB port with power switching implemented, the port will simply shut down, and OS will display a pop-up message "port overcurrent". It could be electronically protected, of a resettable "polyfuse" can trip, and recover later. It could be a case when the voltage will simply sag, then you Pi Zero will likely malfunction. I don't expect any damage to anything that is acquired through retail industry. \$\endgroup\$ – Ale..chenski Dec 3 '17 at 20:47
  • \$\begingroup\$ @AliChen Cool, one more question and I think I'm gonna be all set after that (it's more of a subjective question): If I were to commercialize my gadget, would it be okay to power it like I have now (from a safety/regulatory/best practice/can't be sued for setting their house ablaze - standpoint)? I'd like to keep the USB port due to its abundance, but the internal Y-splitter would be replaced by a more rigid solution. It would also come with a disclaimer that it must only be powered by powerbanks > 1.8A output. Thank you so much for your support! \$\endgroup\$ – iMrFelix Dec 4 '17 at 0:22
0
\$\begingroup\$

Even though I'm too tired and sleepy and all that to open the specs and look up some details to refer to, this comment became too answer-y and too long, so while it started out feeling more like a comment, I post it as an answer now. Do with it what you will;

Basically your question boils down to, I think:

"Do I need negotiation for a very specific set of situations?" (such as knowing it's going to definitely always be plugged into a DCP)

Which I believe to be a "no", without opening the standard documents and guidelines I have laying around.

Followed by:

"To be able to plug it into anything anywhere without damage, do I need negotiation?"

Which certainly is yes, though with modern hardware actual lasting damage is unlikely.

Lastly:

Your Pi Zero may be able to do the negotiation, if that features an Atmel (or any other chip on any other board) with built in USB, for which the right drivers can be written. It can be an annoying task to figure out if built in stacks can be used for advanced power management and how and I'm sure somewhere there's a half-decent chip for not too much money to do it. Likely with SPI or I2C bus for configuration. Surely someone must have even made a board with one, but that may possibly be harder to find.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the input! Just so I understood you correctly: Although I don't need any negotiation for my specific case, if I were to connect it to another source (e.g. a regular USB-port from a PC instead of a >2A power bank), I could risk damage? \$\endgroup\$ – iMrFelix Dec 3 '17 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.