notesonly.in

One notebook for every subject — open it anywhere.

Log in

Error Control Coding: Complete Beginner's Guide Guide.

Error control coding is the reason your phone call survives a noisy wireless channel: before transmission, the sender weaves extra redundant bits into the data according to clever mathematical rules. When noise flips some bits along the way, the receiver uses those rules to detect — and often correct — the damage without asking for a retransmission.

This matters because retransmission is not always possible and not always cheap (it halves throughput on a lossy link). The two great families are block codes, which protect fixed-size chunks, and convolutional codes, which protect a continuous stream — and modern turbo/LDPC codes, their descendants, sit inside 5G, Wi-Fi, and deep-space links.

Key Concepts

  • Redundancy: extra check bits added to data; the price paid for protection.
  • Code rate (k/n): data bits k ÷ total bits n — e.g. 4/7 means ~43 % overhead.
  • Hamming distance: how many bit positions differ between two codewords; a code with distance 3 corrects 1 error.
  • Block code: k data bits → n-bit codeword via fixed rules; the Hamming(7,4) code is the classic example.
  • Parity bits: check bits (often at positions 1, 2, 4, …) computed so each covers a specific subset of bits.
  • Convolutional code: each output bit depends on the current input plus previous inputs (memory); described by rate and constraint length, decoded with the Viterbi algorithm.

How It Works

  1. Hamming(7,4) encode: take 4 data bits, compute 3 parity bits (positions 1, 2, 4), and interleave them into a 7-bit codeword.
  2. Transmit: the 7 bits cross the noisy channel; suppose one bit flips.
  3. Syndrome check: the receiver re-checks each parity group; the pattern of failures (e.g. checks 1 and 4 fail → binary 101 = position 5) identifies the bad bit.
  4. Correct: flip that bit back — the original 4 data bits are recovered with zero retransmission.
  5. Convolutional alternative: instead of blocks, a shift register mixes each input bit with the previous m bits, emitting (say) 2 output bits per input bit (rate 1/2); the Viterbi decoder finds the most likely transmitted path through the trellis.

Worked Example

Protect data bits 1 0 1 1 with Hamming(7,4). Label positions 1–7 as p1, p2, d1, p4, d2, d3, d4, so d1=1, d2=0, d3=1, d4=1. Step 1: p1 covers positions 1,3,5,7 → d1+d2+d4 = 1+0+1 = 2 (even) → p1 = 0. Step 2: p2 covers 2,3,6,7 → d1+d3+d4 = 1+1+1 = 3 (odd) → p2 = 1. Step 3: p4 covers 4,5,6,7 → d2+d3+d4 = 0+1+1 = 2 (even) → p4 = 0. Codeword: 0 1 1 0 0 1 1. Step 4: noise flips position 5 → received 0 1 1 0 1 1 1. The failed checks point to position 5; flipping it back recovers the data.

Common Misconceptions

  • "More redundancy is always better." Wrong: extra bits eat bandwidth — engineers pick the weakest code that still meets the error target, which is why codes are rated by rate vs correction power.
  • "Error correction makes the channel perfect." Wrong: every code has a limit (Hamming(7,4) fixes one error per block; two errors can fool it) — beyond that, only retransmission or a stronger code helps.
  • "Checksums and error-correcting codes are the same." Wrong: a checksum only detects damage; a proper code locates and repairs it.

Real-World Applications

  • QR codes use Reed-Solomon block codes — a scratched code still scans.
  • 5G and Wi-Fi use LDPC and turbo codes, the modern heirs of convolutional codes.
  • NASA's deep-space links use powerful concatenated codes — retransmission across billions of kilometres is impractical.
  • ECC RAM in servers uses Hamming-style codes to silently fix single-bit memory errors.

Block codes like Hamming(7,4) guard fixed chunks with parity arithmetic; convolutional codes guard streams with memory and Viterbi decoding. Both buy reliability with redundancy — and the syndrome trick, where the pattern of failed checks points at the culprit bit, remains one of the prettiest ideas in engineering.