Field Guide · algorithm

Also known as: Barker code, Barker sequence

A Barker code is a short binary sequence with a near-perfect autocorrelation: every off-peak (sidelobe) value has magnitude at most 1, while the on-peak value equals the code length N.1 That gives the sharpest, least ambiguous correlation spike any binary sequence of that length can produce, which is why Barker codes are the classic choice for frame synchronization, short-code spreading, and radar pulse compression.

Barker-7: + + + − − + − peak = 7 sidelobes ≤ ±1
The length-7 Barker code correlates to a peak of 7 with every sidelobe bounded to ±1 — the flat floor that makes the peak unmistakable.

How it works

Slide a copy of the sequence past itself and sum the products (a matched-filter correlation, mapping bits to ±1). At perfect alignment every term is +1, so the sum is N. At any other shift the aligned terms nearly cancel, and for a Barker code the leftover never exceeds ±1 in magnitude. The result is a tall central peak sitting on an almost flat floor — the ideal shape for deciding exactly where a known pattern begins in a noisy stream, because no false alignment comes close to the true peak.

The catch is that Barker codes are rare and short. Only a handful exist — lengths 2, 3, 4, 5, 7, 11, and 13 — and no longer binary Barker sequence is known to exist. The length-13 code (peak 13, sidelobes ±1, ~22 dB peak-to-sidelobe) is the longest and a workhorse in radar. For applications needing long codes, other families take over: m-sequences and Gold codes give good-but-not-perfect autocorrelation at arbitrary length, and are used where a large family or a long spreading code matters more than a strictly ±1 floor.

In practice

Barker codes fill three related roles:

  • Sync / preamble. A receiver correlates for the code to find frame boundaries and set symbol timing.
  • Spreading. Multiplying each data bit by a Barker code spreads it by the code length — the DSSS mode of early Wi-Fi.
  • Pulse compression. A radar transmits a long Barker-phase-coded pulse for energy, then compresses it on receive to Barker-code time resolution — decoupling range resolution from transmit power.

Relevance to SDR

The best-known RF use is 802.11b Wi-Fi, whose 1 and 2 Mbit/s DSSS modes spread each symbol with the length-11 Barker code (higher rates switch to CCK/OFDM). Radar systems use Barker phase coding, especially length 13, for pulse compression. More broadly, short sync/correlation sequences with sharp autocorrelation appear as preambles throughout digital Wi-Fi and other packet radios.

GopherTrunk’s land-mobile trunking targets (P25, DMR, NXDN, TETRA) do not use Barker spreading; they use their own frame sync words, and GopherTrunk correlates for those to find frame boundaries — the same peak-finding idea a Barker code embodies. So while the scanner ships no Barker-code decoder, the autocorrelation principle documented here is exactly what its sync detection relies on.

Sources

  1. Barker code — Wikipedia, for the sidelobe-≤1 property, the complete list of known Barker lengths, and 802.11b/radar uses. 

See also