I am making a Li Ion 1 cell charger that will draw power from a USB cable. How do I know how much current is available? I don't know if I am plugged into a wall wart that can supply 2A or a computer that can only supply 500mA. Is there a chip that will talk to the USB and let me know how much current my charger can draw? Do I just keep drawing more current until the supply dips? I have spent hours looking, but have not found an answer...

  • 2
    \$\begingroup\$ There are USB power control IC's See ti.com/interface/usb/type-c-and-power-delivery/overview.html , for example. E.G: The TPS65981 is a stand-alone, USB Type-C, and power-delivery (PD) controller... [It] communicates on the CC wire using the USB PD protocol... [It] provides default (900 mA), 1.5-A, or 3-A current for Type-C power sources, detects a plug event, determines the USB Type-C cable orientation, and autonomously negotiates USB PD contracts by adhering to the specified biphase-marked coding (BMC) and physical-layer (PHY) protocol. \$\endgroup\$ Jun 13, 2021 at 21:00
  • 2
    \$\begingroup\$ Before PD older chargers used resistor biasing of the D+ and D- lines to advertise output capacity. See, for instance, electronics.stackexchange.com/questions/223221/… \$\endgroup\$
    – ErikR
    Jun 13, 2021 at 21:09
  • \$\begingroup\$ I'm trying to keep things as simple as possible. I've taken apart an off the shelf powerbank and it doesn't look like there is anything too sophisticated going on. I don't want to get as complex as USB-C and PD. I don't want to to have to enumerate. @MarcusMüller is it as easy as looking to see if the voltage is higher than 5.0V or data lines being shorted? I've seen chips like the TPS2514 that put 2 or 2.7V on the data lines to indicate 5 or 10W \$\endgroup\$
    – jmadsenee
    Jun 13, 2021 at 22:44
  • \$\begingroup\$ no, it's not that simple. \$\endgroup\$ Jun 13, 2021 at 23:06
  • \$\begingroup\$ @jmadsenee USB will always provide 5±0.5 volts until a device negotiates a higher voltage, otherwise you'd destroy any non-PD USB device upon plugging it into a USB-PD power supply. \$\endgroup\$
    – Hearth
    Jun 14, 2021 at 0:09


Browse other questions tagged or ask your own question.