logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

USB 2.0 Cable Wiring Color Code, USB-A Pinout, Micro-USB ID Pin, USB-C

User question

How to wire a USB cable correctly

Artificial Intelligence Response

Direct answer to the question

For a standard USB 2.0 cable, wire it as follows:

USB signal Usual wire color Function
VBUS Red +5 V power
D− White USB data negative
D+ Green USB data positive
GND Black Ground
Shield / drain Bare / braid / foil Connector shell / shield

The most common USB 2.0 pinout is:

Pin Signal Usual color
1 VBUS, +5 V Red
2 D− White
3 D+ Green
4 GND Black

Important: Do not rely on wire color alone. Cheap or non-standard cables may use different colors. Always confirm with a multimeter continuity test before plugging the cable into a computer, charger, phone, microcontroller board, or other device.


Detailed problem analysis

1. Identify the USB connector type first

USB wiring depends on the connector and USB generation. The simple red/white/green/black wiring applies mainly to USB 2.0 Type-A, Type-B, Mini-USB, and Micro-USB cables.

Common cases:

Connector type Typical difficulty Notes
USB-A / USB-B 2.0 Easy 4 conductors: VBUS, D−, D+, GND
Mini-USB / Micro-USB 2.0 Moderate 5 pins; extra ID pin for OTG
USB 3.x Type-A / Type-B / Micro-B Difficult Extra high-speed differential pairs
USB-C More complex Requires CC pins, orientation handling, and sometimes e-marker circuitry

For a repair or DIY cable, USB 2.0 is the practical one to hand-wire. USB 3.x and USB-C cables are much more sensitive to impedance, shielding, connector geometry, and power negotiation.


2. Standard USB 2.0 wiring

A standard USB 2.0 cable has four main wires:

Signal Meaning Typical color Connection
VBUS +5 V supply Red Pin 1
D− Negative data line White Pin 2
D+ Positive data line Green Pin 3
GND Ground return Black Pin 4
Shield EMI shielding Bare/braid Connector shell

USB data is carried on the D+ and D− differential pair. These two wires should ideally remain twisted together as much as possible. Untwisting them too far can make the cable unreliable, especially at full-speed or high-speed USB 2.0 operation.

USB 2.0 speeds include:

Mode Speed
Low-speed 1.5 Mbit/s
Full-speed 12 Mbit/s
High-speed 480 Mbit/s

At 480 Mbit/s, cable quality matters. For short repair lengths, careful hand wiring can work, but for long cables or reliable high-speed operation, use a proper manufactured cable.


3. USB-A pinout

For a standard USB-A connector, the signal order is:

Pin 1: +5 V / VBUS
Pin 2: D−
Pin 3: D+
Pin 4: GND
Shell: Shield

Usually:

Red → VBUS / +5 V
White → D−
Green → D+
Black → GND
Bare → Shield / shell

Be careful with connector orientation. The safest method is to check the connector datasheet or use continuity testing against a known good cable or connector.


4. USB-B pinout

USB-B, often used on printers, instruments, Arduino Uno-style boards, and older equipment, uses the same four USB 2.0 signals:

Pin Signal
1 VBUS
2 D−
3 D+
4 GND

The wiring is electrically the same as USB-A, but the physical pin layout is different. Do not assume the left-to-right order visually without checking the connector orientation.


5. Micro-USB and Mini-USB wiring

Micro-USB and Mini-USB have five pins, not four:

Pin Signal Usual function
1 VBUS +5 V
2 D− Data negative
3 D+ Data positive
4 ID OTG identification
5 GND Ground

For a normal USB device cable:

Pin 1 → +5 V
Pin 2 → D−
Pin 3 → D+
Pin 4 → Leave unconnected
Pin 5 → GND

For a USB OTG cable:

ID pin → GND

Grounding the ID pin tells an OTG-capable device to act as the host. Leaving the ID pin floating is used for the normal peripheral/device side.

This is a common source of mistakes.


Current information and trends

For modern devices, the main practical trend is the move toward USB-C. However, USB-C is not simply “USB with a different connector.” It includes:

  • 24 pins
  • Reversible orientation
  • CC1 and CC2 configuration pins
  • Power-role detection
  • Optional USB Power Delivery
  • Higher current levels
  • High-speed differential pairs
  • Optional e-marker chips in higher-power or high-speed cables

For simple hobby use, the best practice is usually:

  • Use a pre-made USB cable
  • Or use a USB-C breakout board
  • Avoid hand-soldering a full USB-C cable unless you understand the CC pins, current advertisement, shielding, and cable requirements

For electronics projects, USB-C breakout boards with proper 5.1 kΩ pull-down resistors on CC1 and CC2 are commonly used when the project is a USB-C powered device receiving 5 V.


Supporting explanations and details

Power-only USB cable

If you only need power, for example to power a small 5 V device:

Red → +5 V
Black → GND

The white and green data wires may be left unconnected.

However, some chargers and devices use data-line behavior to detect charging capability. A simple power-only cable may work with many devices, but some phones, tablets, or USB battery packs may limit current or refuse to charge properly without correct USB charging identification.

Data cable

For data transfer, all four conductors are needed:

Red → +5 V
White → D−
Green → D+
Black → GND

If D+ and D− are swapped, the device will usually not enumerate. It may power on, but the computer will not recognize it.

Shield connection

The cable shield or drain wire should normally connect to the metal shell of the USB connector.

In a cable repair, this generally means:

Bare shield/drain wire → connector shell

The shield improves electromagnetic compatibility and reduces noise susceptibility. For short low-speed charging cables, the shield may not seem critical, but for reliable data operation it is important.


Practical guidelines

Tools recommended

Use:

  • Fine-tip soldering iron
  • Rosin-core electronics solder
  • Wire strippers
  • Small side cutters
  • Heat-shrink tubing
  • Multimeter
  • Magnifier or microscope for small connectors
  • Helping hands or PCB vise

Step-by-step wiring procedure

  1. Cut and strip the cable

    • Remove the outer jacket carefully.
    • Do not nick the inner wires.
    • Preserve the shield or drain wire if present.
  2. Identify the wires

    • Usually:
      • Red = +5 V
      • White = D−
      • Green = D+
      • Black = GND
    • But verify if possible.
  3. Strip the conductors

    • Strip only a few millimeters.
    • Keep the exposed wire short.
  4. Tin the wires

    • Apply a small amount of solder to each conductor.
    • Do not overheat the insulation.
  5. Tin the connector pads

    • Add a small amount of solder to the connector terminals.
    • Avoid solder bridges.
  6. Solder the wires

    • Connect each wire to the correct pin.
    • Keep D+ and D− short and close together.
    • Avoid leaving long untwisted data wires.
  7. Connect the shield

    • Solder the drain or braid to the metal connector shell if possible.
  8. Inspect carefully

    • Look for solder bridges.
    • Check for stray wire strands.
    • Check that no conductor touches the shell unless intended.
  9. Test with a multimeter

    • Check end-to-end continuity.
    • Check for shorts between:
      • VBUS and GND
      • VBUS and shield
      • D+ and D−
      • Each signal and adjacent pins
  10. Insulate and strain-relieve

    • Use heat shrink.
    • Clamp or secure the cable mechanically.
    • Do not rely only on solder joints for mechanical strength.

Common mistakes

Mistake Result
Swapping red and black Can destroy connected electronics
Swapping D+ and D− Device powers but is not detected
Shorting VBUS to GND Can damage host port or charger
Forgetting strain relief Cable fails mechanically
Overheating connector Melted plastic, shifted pins
Relying only on color code Incorrect wiring if cable is non-standard
Hand-wiring USB 3.x pairs poorly Unstable or no high-speed data
Treating USB-C like simple USB-A Incorrect or unsafe behavior

Special note on USB-C

For USB-C, a simple four-wire connection is often not enough.

For a USB-C device that wants to receive normal 5 V power from a USB-C source, the receptacle generally needs:

VBUS → +5 V input
GND → Ground
CC1 → 5.1 kΩ to GND
CC2 → 5.1 kΩ to GND
D+ → USB D+
D− → USB D−

But exact wiring depends on whether you are building:

  • A USB-C device
  • A USB-C host
  • A USB-C cable
  • A USB-C to USB-A adapter
  • A power-only cable
  • A USB Power Delivery device
  • A high-speed data cable

For USB-C, using a proper breakout board or certified cable is strongly recommended.


Possible disclaimers or additional notes

  • USB wire colors are common conventions, not an absolute guarantee.
  • Very thin USB charging cables may omit data wires entirely.
  • Some cables contain non-standard color codes.
  • USB 3.x and USB-C high-speed wiring should maintain controlled impedance and proper shielding.
  • Never test an unknown USB cable first on expensive equipment.
  • Before connecting to a PC, test the cable using a multimeter and preferably a current-limited bench supply or inexpensive USB power source.

Brief summary

To wire a basic USB 2.0 cable correctly:

Red → +5 V / VBUS
White → D−
Green → D+
Black → GND
Bare shield → Connector shell

For Micro-USB or Mini-USB, use the same power and data signals, but remember the extra ID pin. Leave ID floating for a normal device cable; connect ID to ground for OTG host mode.

For USB-C or USB 3.x, avoid hand-wiring unless you know the exact connector requirements. Use a breakout board or certified cable whenever possible.

Ask additional question

Wait...(2min)
Disclaimer: The responses provided by artificial intelligence (language model) may be inaccurate and misleading. Elektroda is not responsible for the accuracy, reliability, or completeness of the presented information. All responses should be verified by the user.