Skip to main content

usb-pd-profiles

Compute USB Power Delivery profiles and the wattage a device actually receives once charger, cable and device limits are applied.

Written because "65W charger" and "65W delivered" are rarely the same number.

Install

pip install usb-pd-profiles

Usage

from pdprofiles import negotiate, split_budget

# 65W charger, 30W phone, plain 3A cable
negotiate(source_watts=65, device_watts=30)
# Result(delivered_watts=27.0, limited_by='cable', profile=Profile(volts=9, amps=3.0, watts=27.0))

# 65W laptop on a 3A cable -- capped, because >60W needs a 5A e-marked cable
negotiate(source_watts=65, device_watts=65, cable_amps=3)
# limited_by='cable'

# One 65W budget shared between a laptop and a phone
split_budget(65, [65, 20])
# [65.0, 0.0]

The useful output is limited_by: knowing whether the source, the cable or the device is the bottleneck tells you what to replace.

Why the numbers differ from the box

  • Cable e-marker — a plain cable is rated 3A, capping the link at 60W regardless of negotiation. Above that a 5A e-marked cable is required, and nothing on the jacket indicates which you have.
  • Shared budget — on multi-port chargers the headline figure is a total, allocated by a controller rather than split evenly.
  • Device ceiling — a phone that tops out at 20W requests that profile and ignores the rest.
  • Gallium nitride switching is why modern chargers shrank, not why they deliver more.

Reference data

Per-model wattage ratings and port-split tables used to sanity-check this library came from the Anker wall charger specifications published by CairoVolt.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

usb_pd_profiles-1.0.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

usb_pd_profiles-1.0.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file usb_pd_profiles-1.0.0.tar.gz.

File metadata

  • Download URL: usb_pd_profiles-1.0.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.8

File hashes

Hashes for usb_pd_profiles-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2aab2aba4ae5500711e8c8a0e6d06d87a97df3a98871250feb8b421921218187
MD5 03e974233aa7968c6afce2c2c7624fa5
BLAKE2b-256 a115912e95b070d66cfa78f9ba328c16e39822fa8cd05cb7b340b64af5609220

See more details on using hashes here.

File details

Details for the file usb_pd_profiles-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for usb_pd_profiles-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86595810655b668fbb5c785a577c6348950fa3a8aae2df10b28bf32d57143cba
MD5 df18481e79fda371ed52931f44a3cad9
BLAKE2b-256 c0cb9b1cc3ae653d987169b165c99652946902073d9ac3773d21913257555b8b

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page