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.1.tar.gz (3.6 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.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: usb_pd_profiles-1.0.1.tar.gz
  • Upload date:
  • Size: 3.6 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.1.tar.gz
Algorithm Hash digest
SHA256 7687a662f77ffc9031051393faa172180fd2e7f745ad126264260c6725cde8ea
MD5 72f0d9db1773b72466c51022c5485139
BLAKE2b-256 4869adfcc018561e4c52a4fca794b90561b85dcf4f99014425a952c54f0364e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for usb_pd_profiles-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0cff01f196938e0ea7c65ba62b3cc897c0871178403ac17bb9c90c29b76a2600
MD5 16283a82cae2ee5d431d70dc61e662b5
BLAKE2b-256 4289c9a7d36292a1ef546d725bb95cde47f541260bc2e53a76272e3a3a242310

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

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