HDB3 Code

High-Density Bipolar 3-zero code, an enhancement of AMI that avoids long zero sequences.

The Problem: The Silence of Zeros in AMI

The is excellent at eliminating the DC component in a signal. However, it has a critical weakness: a long, uninterrupted sequence of zeros (000000...000000...) results in a flat, unchanging zero-volt signal.

This "silence" is problematic because the receiver relies on signal transitions (changes in voltage) to synchronize its internal clock with the sender's. Without transitions, the receiver's clock can drift, leading to timing errors and misinterpretation of the data. HDB3 was invented to solve exactly this problem.

HDB3: High-Density Bipolar 3-Zero Code

HDB3 is a "smart" modification of the AMI code, widely used in European E1E1 telecommunication systems. Its name perfectly describes its function:

  • High-Density Bipolar: It's a bipolar code (using +V, 0, -V) that can handle "high densities" of zeros without losing synchronization.
  • 3-Zero: It guarantees that there will never be more than three consecutive zeros in the output signal, regardless of the input data.

For most of the data, HDB3 behaves exactly like AMI. The clever part lies in how it handles a sequence of four or more zeros.

The Core of HDB3: Substitution Rules

Whenever the encoder encounters a sequence of four consecutive zeros (00000000), it replaces this sequence with a special four-symbol pattern. There are two substitution patterns available: 000V and B00V.

Understanding the Special Pulses

  • V (Violation) Pulse: This is a non-zero pulse (+V or -V) that intentionally breaks the alternating polarity rule of AMI. A 'V' pulse always has the same polarity as the immediately preceding non-zero pulse. This intentional error is a special signal that the decoder recognizes.
  • B (Bipolar) Pulse: This is also a non-zero pulse (+V or -V) that substitutes for the first zero in the B00VB00V sequence. Unlike a 'V' pulse, the 'B' pulse conforms to the alternating polarity rule of AMI, maintaining the signal's overall DC balance.

The Balancing Act: Choosing the Right Substitution

The choice between using 000V or B00V is governed by a rule designed to keep the signal DC-balanced. The goal is to ensure that consecutive Violation ('V') pulses have alternating polarities.

The Rule: The encoder counts the number of non-zero pulses (regular '1's and any 'B' pulses) that have occurred since the last substitution.

If the count is ODD...

The 00000000 sequence is replaced with 000V. The 'V' pulse violates the AMI rule (it has the same polarity as the last pulse).

If the count is EVEN...

The 00000000 sequence is replaced with B00V. The 'B' pulse follows the AMI rule, and the 'V' pulse has the same polarity as the 'B' pulse.

HDB3 in Action: A Step-by-Step Example

Let's encode the following binary stream: 10100001100001010000110000

  1. Input 11: Last pulse was none. Start with ++.
    Encoded: +
  2. Input 00: No substitution needed.
    Encoded: + 0
  3. Input 11: Last pulse was ++. Alternate to −-.
    Encoded: + 0 -
  4. Input 00000000: Time for a substitution.
    - Count non-zero pulses since last substitution: 1 pulse (−-). This is an ODD number.
    - Rule for ODD: Use 000V000V.
    - Polarity of VV: Must be the same as the last pulse (−-).
    Encoded: + 0 - 0 0 0 -
  5. Input 11: Last pulse was VV, which had −- polarity. Alternate to ++.
    Encoded: + 0 - 0 0 0 - +
  6. Input 11: Last pulse was ++. Alternate to −-.
    Encoded: + 0 - 0 0 0 - + -
  7. Input 00000000: Another substitution.
    - Count non-zero pulses since last substitution (000−000-): 2 pulses (++ and −-). This is an EVEN number.
    - Rule for EVEN: Use B00VB00V.
    - Polarity of BB: Must alternate from the last pulse (−-), so BB is ++.
    - Polarity of VV: Must be the same as BB, so VV is also ++.
    Encoded: + 0 - 0 0 0 - + - + 0 0 +

Final Encoded Signal: + 0 - 0 0 0 - + - + 0 0 +

Interactive HDB3 Encoding

Enter binary sequence (0s and 1s only)

Current Bit: 1
+5V-5V0V1010000110000
HDB3: Replace 0000 with 000V (odd) or B00V (even)

DC Component

HDB3:0.00V

Spectral Information

Clock Frequency:1.00 Hz
Main Lobe Bandwidth:0 - 1.00 Hz
    HDB3 Code | Teleinf Edu