User Tools

Site Tools


projects:usb-c-ify

This is an old revision of the document!


⚠️UNDER CONSTRUCTION!⚠️⚠

USB-C-ifying

Having several different cables and chargers for devices is tedious. Read about how to convert nearly everything into USB-C.

It can be done two ways:

  • buy an external USB-C adapter if available: you can find them for notebooks, electric razors and other proprietary plugs
  • modify the device itself
  • create a fake battery pack with USB-C socket, reusing original BMS (Battery Management System)
  • create an USB-C adapter: also read DIY drill power bank

There are three ways how to do it electronically:

  1. no voltage adjustment needed = there is already mini/micro-USB or a socket with 5V
  2. use step-up or step-down electronics to match voltage of the device
  3. use USB-PD (with PPS) or Quick Charge (QC) to request voltage of fast chargers

Terminology: PD = Power Delivery ; PPS = Programmable Power Supply

Category 1: Solder in a USB-C socket - there are available USB-C breakout boards for easy of use. For some devices there are replacement boards with USB-C so it is easy to convert them. Examples are PlayStation DS4 controllers and PS Vita. There are solderless boards/kits offered.

Category 2: The voltage of the device is not 5V. To lower voltage, a linear regulator (LDO) can be used (e.g. to 3V7 with AMS1117-adj) - they are small and cheap but also inefficient and may get hot, as LDOs just burn up the excessive voltage. There are switching regulator modules which are more efficient but bigger in size and more expensive. Bad modules may have high voltage ripples - add 10nF + 100nF capacitors for smoothing the output.

Category 3: Chose USB-PD or QC if voltage of the USB power supply needs to be adjusted. Regular USB-PD is >=5V. PD with PPS can go as low as 3.3V. QC3 typically goes as low as 3.6V.

TIP: If you solder in a USB-Socket, you need to fixate it somehow. If there used to be a micro-USB socket, there is mostly a ground pad beneath it. Apply solder tin on the upper side of USB-C socket and solder it upside-down onto the ground plane of the PCB.

#TODO: USB-PD + PPS and QC

“Just” request the desired voltage via USB-PD (power delivery) or USB-QC (QuickCharge). If you need other voltages than fixed USB-PD PDOs of 5v, 9V, 12V, 15V, 20V, (with EPR: 28/36/48 V), go for USB-PD PPS or QC3.0, which support smaller voltage steps.

PPS (Programmable Power Supply)

Typical USB-PD PPS range: 3.3 V → 21 V, in 20 mV steps

Also read about QuickCharge on wikipedia.

QC3.0 introduced INOV (Intelligent Negotiation for Optimum Voltage).
Voltage range: 3.6 V → 20 V
Step size: ~200 mV per step
Negotiation method: pulse-based up/down commands over D+ / D–
Only available on USB-A or proprietary USB-C implementations (not USB-IF compliant)

If a charger supports QC4, it almost certainly supports PPS (because that's how QC4 is implemented).

QC4+ Fast Charge Protocol is a combination of USB-PD PPS and QC3.0/2.0 fast charge protocol for backwards compatibility.

read-ups

hackaday.com series: All about USB-C, especially Replying Low-Level PD and Talking Low-Level PD.

A really good write-up of USB-PD: https://github.com/manuelbl/zy12pdn-oss and OSS FW for ZY12PDN PD-trigger board

hardware modules

There are various pure hardware trigger boards that set PD voltage over resistor or DIP-switches.

IC

There are USB-PD sink controller ICs which you can interface with an MCU, like FUSB302, AP33772, CH224K or IP2736. Read about 30 ICs compared on chargerlab.com

- https://hackaday.io/project/192576-picopd-usb-c-pd-30-pps-trigger-with-rp2040 AP33772 on Pi Pico
- https://github.com/Ralim/usb-pd USB-PD driver stack for FUSB302
- https://github.com/Starryccc/FUSB302 PPS on FUSB302

MCU implementations

Instead of using a trigger sink IC, there are implementations for requesting voltage with MCUs, e.g.:

- https://www.g3gg0.de/esp32/esp32-pd-usb-pd-using-esp32-zigbee-crib/ BitBang USB-PD on ESP32-C3
- https://github.com/vdeconinck/QC3Control Arduino QC3
- https://github.com/Crypter/QC3Client another Arduino QC3
- https://github.com/z4yx/USB-C-PPS PPS for STM32G0
- https://github.com/wagiminator/CH32X035-USB-PD-Adapter PPS on “10¢” CH32X035

TODO

https://pcbartists.com/design/embedded/how-to-replace-microusb-with-usb-c-connector/
In connectors that do not expose the CC1 and CC2 pins, they are simply connected internally to make things easy for you.

USB-PD (65W) fast charger buck boards
Bidirectional power bank modules: e.g. IP2369, read DIY drill power bank
USB-PD/QC trigger boards → request voltage from USB fast charger
Basically the trigger board is the “end device” which needs to be powered.

Regular USB-PD is >=5V. PD with PPS can go as low as 3.3V. Typically, PPS allows continuous adjustment in 20 mV steps.
USB-PD PPS IC (like CH224K or IP2736)

In USB Power Delivery (PD), a PDO (Power Data Object) describes a power option that a source (charger) can offer to a sink (device). Fixed PDOs: Advertise fixed voltages (5 V, 9 V, 15 V, 20 V). Variable PDOs (deprecated): Used in older PD specs, allow requesting a voltage within a range. Battery PDOs: Specify a power range in watts instead of volts. APDOs (Augmented PDOs) Introduced in USB PD 3.0 to support PPS (Programmable Power Supply). Instead of just offering a fixed voltage, an APDO defines a range and step size. The sink can request a specific voltage (in 20 mV steps) and current from the source. Example APDO from a charger: “PPS: 3.3 V – 11 V @ 3 A” Sink could request 3.8 V, 5.6 V, 7.2 V, … within that range. APDOs are PDOs that describe a programmable voltage range (for PPS), not just a fixed level.

EPR = Extended Power Range Standard USB PD (USB PD 3.0) delivers up to 100 W (20 V × 5 A). USB PD EPR extends this range up to 240 W (48 V × 5 A). The device can negotiate USB-C PD at higher voltages (above 20 V). Requires EPR-capable cables and devices to safely handle the higher voltage.

AVS = Active Voltage Switching (sometimes also called Automatic Voltage Switching) dynamically switch output voltage depending on the needs of the device. With AVS, the charger can smoothly change voltage without disconnecting the load = stable power delivery as the device requests more or less voltage.

Also see bidirectional USB-C PD fast charging modules

#TODO: modified battery as USB-C dummy

Modify a (broken) battery to use as a dummy with USB-C. Also useful for devices which cannot be powered w/o battery (and you only need the device stationary).
Caution: Do not accidentally cut into the battery cell! Beware of health issues. Reuse the original BMS and replace the cells of a battery pack cells with electronics to get nominal battery voltage. Add a diode in case you accidentally try to power (and therefore charge) the fake battery via charging port of the device!
All you need is the BMS, a USB-C socket and a voltage regulator - alternatively use USB-PD PPS or QC to request a voltage: ~3.7V for single cell devices or ~7.2V for 2S.

the modern way: USB-PD/QC

“Just” request the desired nominal battery voltage via USB-PD PPS or QC3, which is then connected to the BMS.

voltage regulators

Using a voltage regulator is the classical, passive way. Either use a switching regulator or an LDO.
Advantage: No special USB power supply needed. No software required.
Disadvantage: Bulky or LDO heating up.

switching regulators

Terminology:
Buck = step-down voltage
Boost = step-up voltage
Buck+Boost: can do both

If your device uses > 5V battery (multi cell), you can use a step-up module to connect to the BMS.
If your devices uses ⇐5V (single cell 3.7V), then you can use a step-down module to connect to the BMS.
If you need it compact for a low powered device, you can consider an LDO instead of a step-down switching regulator.

LDO for single cell low power devices

Instead of using USB-PD with PPS, you can use regular 5V USB and a LDO regulator like ASM1117-ADJ to set ~3.7V. An LDO “burns off” the extra voltage as heat and handles only limited current: use for low power devices only!. Advantage: you can use regular dumb 5V USB and are not restricted to use PPS only.

Vout = Vref (1+ R2/R1) + Iadj * R2;
where: 
Vref ~1.25V
Iadj ~50-100µA (small enough to usually ignore)

R1 is the resistor from OUT → ADJ
R2 is the resistor from ADJ → GND

For 3.7 V:
3.7 ≈ 1.25(1+ R2/R1)
R2/R1 ≈ 3.7/1.25 −1 ≈ 1.96

So good resistor pairs are:
R1 = 1 kΩ, R2 ≈ 2 kΩ (closest standard: 2.0 kΩ → 3.75 V output)
R1 = 1 kΩ, R2 = 1.96 kΩ (E96 series gives almost exactly 3.70 V)
R1 = 240 Ω, R2 ≈ 470 Ω (classic LM317-style pairing)

Note:
The ASM1117 has a dropout of around 1.1–1.3 V at typical load, so your input must be at least ~5.0 V.
As power dissipation of the LDO is P=(Vin​−Vout​)*I, do not use a too high input voltage, stay with 5V USB. For anything above ~500 mA, the 1117 may overheat unless heatsinked.

examples of replacements with USB-C sockets

#Category 1:
Devices with 5V power plugs are the easiest to modify. Just replace proprietary socket or mini-/micro-USB with USB-C socket breakout board.

- hollow out proprietary (broken) PlayStation Vita socket, solder in USB-C socket
- custom PCB for Sony Ericsson FastPort USB-C replacement in C901
- install USB-C breakout board in various devices like PSP, PowerBank, etc.

USB-C cables

Depending weather a USB-C cable is USB2.0 or USB3.1 the wires inside the cable vary.
See USB-C pinout: https://pinoutguide.com/Slots/usb-type-c_pinout.shtml
Read the hackaday.com USB-C dictionary

Depending on device type there might be direct audio output on USB-C socket, which let's you use a passive adapter - unlike Apple lightning active audio adapter and Apple's USB-C cable. If you want to build your own active USB-C audio cable, read https://daumemo.com/diy-micro-usb-c-to-3-5mm-adapter-and-headphone-amplifier-part-4/.

USB-C cables are not necessarily passive. There might be so called e-marker chips connected to the CC-pins.

Cable Type Max Current Max Wattage How Power Capability Is Determined Inside the Cable Notes
Non-e-marked (Standard USB-C Cable) 3A up to 60W (20V×3A) No e-marker detected → Host must assume max 3A No chip, no special resistors Only CC pass-through wiring; CC resistors are in the devices, not in the cable
E-marked Passive Cable 5A up to 100W (20V×5A) E-marker chip reports 5A capability over CC line E-marker chip on CC1/CC2 Required for 5A operation; includes cable ID, current rating, voltage rating
EPR E-marked Cable (Extended Power Range) 5A up to 240W (48V×5A) E-marker reports EPR capability and 50V tolerance E-marker chip with EPR fields Needed for USB-PD 3.1 (28V/36V/48V) high-power charging
Active USB-C Cable (USB4/High-Speed) Typically 5A up to 100W or 240W (if EPR) E-marker reports current + data capability E-marker + active signal conditioning Used for USB4/Thunderbolt; power still determined by e-marker

USB-C device roles

Read https://www.wandkey.com/usb-c-pinout-guide-and-features/ for more info.

USB-C devices have different roles:

Device Role Meaning CC Resistors Used CC Behavior Notes
DFP (Downstream Facing Port) – Source Provides power (charger, host) Rp (56k, 22k, or 10k) Pull-up on CC1 and/or CC2 Advertises current: 56k=Default, 22k=1.5A, 10k=3A
UFP (Upstream Facing Port) – Sink Consumes power (phone, device) Rd (5.1k) Pull-down on CC1 and CC2 Signals “I want power”; source detects Rd to begin supplying VBUS
DRP (Dual Role Power) Can be source *or* sink Switches between Rp and Rd Toggles Rp ↔ Rd periodically Used in phones, laptops, some MCUs; role decided via toggling rules
Accessory Mode (Audio/Debug) Special accessories Ra (~800Ω) Pull-down on both CC pins Triggers analog audio or debug accessory mode
Cable Plug with E-Marker Certified 5A or USB4 cable No resistors; digital IC Communicates via CC and powered over VCONN Identifies cable capabilities (5A, EPR, USB4, length, vendor)

USB-C power roles are configured with CC-pin resistor values inside the devices:

Name Value Used By Meaning
Rd (pull-down) 5.1 kΩ Sink (device that *consumes* power, e.g., phone) “I am a sink. Please provide power.”
Rp (pull-up) – Default 56 kΩ Source (charger/host) “I can supply DEFAULT USB current (500 mA / 900 mA).”
Rp (pull-up) – 1.5 A 22 kΩ Source (charger/host) “I can supply 1.5 A.”
Rp (pull-up) – 3.0 A 10 kΩ Source (charger/host) “I can supply 3.0 A.”
Ra (accessory pull-down) ~800 Ω Audio/Debug accessories “I am an analog accessory (audio, debug, etc.).”

Everything else (voltages, 5A capability, data mode, PD negotiation) is digital, not resistor-coded.

USB data libraries

projects/usb-c-ify.1763584697.txt.gz · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki