Line Coding Schemes in Digital Communication For students.
Line coding is the translator between raw bits and the electrical (or optical) wiggles that actually travel down a wire. A string of 1s and 0s cannot be sent as-is: long runs of zeros carry no timing information, DC offsets confuse transformers, and some patterns radiate interference. A line code maps bits to pulse shapes that solve these physical headaches.
This matters because every cable standard — Ethernet, USB, fibre links — specifies a line code, and the choice directly trades bandwidth, clock recovery, and DC balance. Pick NRZ for simplicity, Manchester when you need a bulletproof clock, AMI/HDB3 when the line must stay DC-free.
Key Concepts
- NRZ (non-return-to-zero): 1 = high, 0 = low, for the whole bit time — simplest, most bandwidth-efficient.
- RZ (return-to-zero): the pulse returns to zero mid-bit, so every 1 carries a timing edge — costs double the bandwidth.
- Manchester: each bit has a mid-bit transition (low-to-high = 1, high-to-low = 0); self-clocking but needs 2× the bandwidth of NRZ.
- AMI (alternate mark inversion): 0 = zero volts, 1s alternate +V/−V — no DC buildup, used in old T1 lines.
- HDB3: AMI plus special violation patterns that break up long zero runs, keeping the clock alive — the E1 standard's code.
- DC balance: the average voltage stays near zero, which transformer-coupled lines require.
How It Works
- Take the bit stream, e.g. 1 0 1 1 0.
- NRZ: high, low, high, high, low — one level per bit, held for the full bit period.
- Manchester: ↑, ↓, ↑, ↑, ↓ transitions at each bit centre (using low→high = 1) — the receiver extracts the clock from these guaranteed edges.
- AMI: 0 → 0 V; the three 1s become +V, −V, +V in alternation — a DC meter on the line reads ~0 V.
- HDB3: same as AMI, but four zeros in a row get replaced by a coded violation pattern the receiver recognises and strips.
Worked Example
Send 10 Mbps over three different codes. Step 1: NRZ — one pulse per bit, so the line rate is 10 Mbaud and the minimum bandwidth ≈ 5 MHz. Step 2: Manchester — two half-bit pulses per bit, so 20 Mbaud and ≈ 10 MHz bandwidth — double the spectrum, but the receiver recovers the clock without a separate wire. Step 3: AMI — still 10 Mbaud like NRZ, but with zero DC component, so it passes through the line transformers that block NRZ's DC. Step 4: the trade is now visible — NRZ is the spectrum miser, Manchester buys clock recovery with bandwidth, AMI buys DC balance with a little extra logic. (Modern links use fancier descendants like 8b/10b, which buy the same benefits with only 25 % overhead.)
Common Misconceptions
- "Baud and bits per second are the same." Wrong: Manchester at 10 Mbps runs at 20 Mbaud; multilevel codes can even carry more than one bit per baud.
- "Manchester is wasteful, so it's useless." Wrong: its guaranteed transitions made 10 Mbps Ethernet and RFID work reliably without clock lines — robustness was worth the bandwidth.
- "Line coding is the same as modulation." Not quite: line coding shapes baseband pulses for a wire; modulation puts those pulses onto a radio carrier — related jobs, different layers.
Real-World Applications
- Classic 10 Mbps Ethernet used Manchester coding on coax and twisted pair.
- T1 telephone lines used AMI; European E1 lines used HDB3.
- USB and PCIe use 8b/10b and 128b/130b descendants that guarantee transitions and DC balance.
- Optical fibre links use scrambling plus line codes to keep the laser's average power steady.
Bits are abstract; wires are physical. Line codes are the diplomats between the two — NRZ for thrift, Manchester for a free clock, AMI/HDB3 for DC-free lines. Whenever a cable standard quotes a code, it is really quoting which physical problem it chose to solve.
Related blogs
- Sampling and Quantization: Complete Beginner's Guide
- Pulse Code Modulation (PCM): Complete Beginner's Guide
- Digital Modulation: ASK, PSK, FSK and QAM For students.
- Error Control Coding: Complete Beginner's Guide Guide.
- Spread Spectrum: FHSS and DSSS Basics With easy examples.
- Matched Filter and Detection Theory Basics For students.