25
\$\begingroup\$

I've just chopped a usb to micro-b usb cable.

There are 4 small wires inside

  • Red
  • Black
  • White
  • Green

Isn't it universal that Red is power and black is ground?

\$\endgroup\$
  • 1
    \$\begingroup\$ Very probably but see this question \$\endgroup\$ – MikeJ-UK Aug 2 '12 at 14:49
  • \$\begingroup\$ It was in the cable I chopped a while ago, but you should use a meter to verify. \$\endgroup\$ – jippie Aug 2 '12 at 15:07
  • 18
    \$\begingroup\$ It is, except when it isn't. \$\endgroup\$ – user3624 Aug 2 '12 at 15:38
  • \$\begingroup\$ I realize this question is all but done, but anecdotally I had a power brick that I cut the end off of to repurpose elsewhere. The original plug was tip-negative, and had a tinned shield surrounding a blue wire. The shield was positive. Boy was that a surprise after the smoke ... \$\endgroup\$ – Bryan Boettcher Jul 16 '13 at 21:00
  • 1
    \$\begingroup\$ Beware, in 120/240v house wiring in North America, those exact four colors have totally different meanings: Green is safety ground, white is neutral/return and Red and Black are both "hot". \$\endgroup\$ – Harper Feb 15 '16 at 22:30
42
\$\begingroup\$

red = +5 V
white = D-
green = D+
black = ground

enter image description here

(Page 89 of the USB 2 specification)

edit (after reading the other 649 pages)
OK, that's from the formal specification. Reassuring, isn't it? It can even get you an accepted answer. You can feel it coming: there's a but.

enter image description here

This is from page 94. At first sight it seems to confirm what I said, but then there's that word "typical". So not mandatory? I read some more, and the answer isn't clear. The word "typical" must be the most used word in the spec, and also seems to be used for mandatory specifications:

enter image description here

There's that word again, page 93. Sounds like non-binding, but the text above it does say "should be oriented to allow" (emphasis mine). So "typical" seems to be used for mandatory specifications. Talk about confusion!

Apparently there's only 1 way you can trust: measure it. Compare the wire color with the pin number on the connector. The pin number locations are shown in the drawing and their assignments in the table. I'm 99 % sure that it will agree with the "typical" wiring assignment.

There's just that other 1 %... :-(


Further reading
USB version 2.0 specification (.zip file format, size 19.5 MB)

\$\endgroup\$
  • 4
    \$\begingroup\$ I have had USB cables from china where black was Vcc, and Red was Gnd. It blew up a test board. I was NOT happy. \$\endgroup\$ – Connor Wolf Jun 13 '15 at 18:59
  • 2
    \$\begingroup\$ I'm not sure if the same holds for electronics specs, but in Internet protocol specs the strongest wording for absolute mandatory requirements is "must", with "should" at the next lowest rung. Then again, in the illustration "Typical USB Plug" may mean just that: the image shows an example of type. Not all USB plugs will be identical. ...The "typical" wiring assignments in the table, though, I agree that's a lot less confidence-inspiring. \$\endgroup\$ – FeRD Sep 17 '16 at 12:50
6
\$\begingroup\$

It is a good bet, but I would not wage my life on it.

\$\endgroup\$
  • 3
    \$\begingroup\$ Compliant USB ports also limit the current, and I especially wouldn't bet my life on that! \$\endgroup\$ – gbarry Aug 2 '12 at 14:49
  • 1
    \$\begingroup\$ IIRC the phrase in the standard is "limit the current to a safe value". That is rather broad, and might (at least in the mind of the lazy port hardware designer) include the maximum current that can be delivered by the computer's PSU. \$\endgroup\$ – Wouter van Ooijen Aug 2 '12 at 15:45
  • 1
    \$\begingroup\$ In the protocol, the port provides 100ma and the device can ask for more, up to 500ma (USB-1 spec; I know they keep jacking up the values). But I suspect you're talking about max current limits, and I suppose they didn't say that you couldn't supply more. Good point. \$\endgroup\$ – gbarry Aug 6 '12 at 20:22
  • 1
    \$\begingroup\$ @gbarry: The port provides at least 100mA, and the device can ask it to provide at least 500mA. I was responding to "compliant USB ports also limit the current", which is strictly true, but that limit is not necesarry the 100 or 500 mA that is often mentioned. \$\endgroup\$ – Wouter van Ooijen Aug 9 '12 at 16:26
5
\$\begingroup\$

I've had cheap USB cables which had those colour wires connected to the pins differently to "the spec".

Better to "buzz it out" I think.

\$\endgroup\$
  • \$\begingroup\$ They were the right colors??? \$\endgroup\$ – stevenvh Aug 2 '12 at 15:43
  • 2
    \$\begingroup\$ Right colours, wrong pins (but consistent at each end, so the cables worked OK) \$\endgroup\$ – Martin Thompson Aug 2 '12 at 15:46
  • 1
    \$\begingroup\$ I can second that, I've had USB cables that didn't even use the correct colored wires. My +5V cable was blue! \$\endgroup\$ – capcom Aug 2 '12 at 16:36
  • 4
    \$\begingroup\$ @capcom - If they don't follow the standard I would prefer that they would use other colors, then at least you know. If they're the standard colors you would expect that the connections are also standard. \$\endgroup\$ – stevenvh Aug 2 '12 at 17:28
  • 3
    \$\begingroup\$ Once upon a time I found a hard drive cable where +5 was yellow and +12 was red. Unfortunately we didn't notice until after we wired a kludge to the "5V" wire. That let the smoke out of the kludge, and caused much excitement. Since then, I always confirm any cable I'm hacking up before trusting that details like color codes are right. \$\endgroup\$ – RBerteig Aug 2 '12 at 18:18
1
\$\begingroup\$

All usb cable wiring is not same. So search on google for the wiring before you swap cables.

I only know Keyboard and data cable wiring, so here it is as an example: enter image description here

\$\endgroup\$
-1
\$\begingroup\$

When all else fails pull out your meter and test the wires coming out of the cable. That's what someone who isn't a fan of smoking anything inside my computer room that can't be bubbled through water would do.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.