mini-essay: data vs. charging cables šŸ”Œ

Part of a series of mini-essays.

I had met with some trouble transferring EPUB files from my laptop to my e-reader. It appeared to be charging, but the laptop wasn’t detecting it as an external device. I thought to myself: it must’ve been something wrong with my laptop - perhaps a faulty driver…?

A bunch of unhelpful attempts later, it finally worked when I used a different cable to connect. I later found out why: the first cable I used was a charge-only cable.

  • Data cables have 4 wires: red (+5V) 🟄, black (ground) ⬛, green (D+) 🟩, white (D-) ⬜.
  • Charge-only cables have just the red 🟄 and black ⬛ wires, without the data lines.

When a device connects to a host, it signals its presence by pulling the data lines to high/low voltage; the host would send back packets to identify the device type and negotiate protocols. (Without data lines, none of this happens.)

Data lines

Data lines transmit information via rapid voltage changes that turn on and off (millions to billions of times per second). Each on/off pulse represents a bit: “0” (off) or “1” (on). All types of information can be encoded as a sequence of these bits.

Why 2 wires (D+ and D-)?

USB uses a technique called differential signalling. It sends the same signal on both wires, but inverted - the receiver then looks at the difference between their voltages. This is useful because electrical signals can pick up noise from surroundings.

Suppose D+ is 3V and D- is 0V. The receiver looks at the difference between the two voltages. If interference adds 0.5V to both wires, D+ becomes 3.5V and D- becomes 0.5V:

$$3.5V-0.5V=3V$$

The noise cancels out, leaving the original signal intact; this robustness to noise makes higher-speed communication possible!

Are data lines built different?

I was also curious if there were any fundamental differences in how power and data lines are constructed. Turns out, yes! (In retrospect, this makes sense: data lines need to reliably carry information at high frequencies.)

They’re both generally made of copper but data cables have a couple of extra tricks:

  • They often have a layer of conductive material (like foil) to absorb/reflect noise.
  • They are typically twisted 🧬 together to expose them to roughly the same external noise. It also keeps D+ and D- the same length, which matters for keeping the signals synced.

In contrast, power lines don’t have to worry about all that. Their main concern is carrying current, so they may instead use thicker copper wires. A larger cross-sectional area means lower resistance, which means less voltage is lost along the cable for the same current (thanks, $V=IR$).

References