ENع
←ASK and FSK
Lesson 61 · Digital modulation

ASK and FSK: switching amplitude and frequency

16 min11 steps5 questionsAdvanced
About this lesson

To send bits by radio, we change a carrier wave in step with them. Amplitude-shift keying (ASK) switches the wave's height; its simplest form, on-off keying, turns the carrier on for a 1 and off for a 0. Frequency-shift keying (FSK) switches between two tones instead. Follow the bits 1 0 1 1 through both, see their spectra computed with a DFT, then watch a correlator receiver get them back, and see why a weaker signal fools ASK with a fixed threshold but not FSK. Builds on the Hardware lesson on radio-frequency basics and the Networking lesson on wireless basics.

You'll learn to

Tick what you feel confident about. These self-checks do not affect your lesson score.

Fig 61 · Interactive
01 / 11

Bits to send

We want to send four bits, 1 0 1 1, one every millisecond: a bit time Tb = 1 ms, so 1000 bits per second. Bits cannot fly through the air on their own. They must ride on a radio wave.

bits      1 0 1 1
bit time  Tb = 1 ms
bit rate  Rb = 1 / Tb = 1000 bit/s

the numbers are scaled down so you can
see every wave cycle; a real radio link uses
carriers of MHz or GHz and far faster bits
Loading figure…
or ← →
Read the lesson step by step
  1. Bits to send

    We want to send four bits, 1 0 1 1, one every millisecond: a bit time Tb = 1 ms, so 1000 bits per second. Bits cannot fly through the air on their own. They must ride on a radio wave.

    bits      1 0 1 1
    bit time  Tb = 1 ms
    bit rate  Rb = 1 / Tb = 1000 bit/s
    
    the numbers are scaled down so you can
    see every wave cycle; a real radio link uses
    carriers of MHz or GHz and far faster bits
  2. The carrier wave

    An oscillator makes a steady cosine wave, the carrier: c(t) = cos(2π·4000·t). At 4 kHz it fits exactly 4 cycles into each bit. A steady wave carries no news: to send bits we must change something about it.

    c(t) = cos(2π·fc·t),  fc = 4 kHz
    period 1 / fc = 250 µs
    cycles per bit = fc · Tb = 4
    
    a cosine has three things we can change:
      amplitude  ->  ASK (this lesson)
      frequency  ->  FSK (this lesson)
      phase      ->  PSK (next lesson)
  3. ASK: switch the height

    Amplitude-shift keying changes the wave's height. Its simplest form, on-off keying, works like a switch: the carrier goes out for a 1 and is blocked for a 0. So s(t) = b·A·cos(2π·fc·t), with A = 1 V.

    ASK, on-off keying (OOK)
      s(t) = b_k · A · cos(2π·fc·t)
      b_k = bit k (1 or 0),  A = 1 V
    
    bit 1  ->  4 cycles of carrier
    bit 0  ->  nothing (0 V)
    
    other ASK uses two non-zero heights,
    e.g. 1 V for a 1 and 0.3 V for a 0
  4. Where ASK sits in frequency

    This is the average spectrum of a long random OOK stream, computed with a DFT. A spike sits at the carrier, 4 kHz. Around it, the main hump runs from 3 to 5 kHz: twice the bit rate wide.

    average of |DFT|² over 64 blocks
    of 16 random bits (512 samples, 62.5 Hz bins)
    
    spike at fc = 4 kHz: the carrier itself
      (switched on half of the time on average)
    main lobe 3 .. 5 kHz = 2·Rb wide
      nulls every Rb = 1 kHz from fc
    
    faster bits -> a wider hump
  5. FSK: switch the frequency

    Frequency-shift keying keeps the height and changes the pitch. The oscillator sends 5 kHz for a 1 (5 cycles per bit) and 3 kHz for a 0 (3 cycles). The wave is always 1 V tall.

    binary FSK
      s(t) = A · cos(2π·f_k·t)
      f_k = 5 kHz for a 1  (the "mark")
      f_k = 3 kHz for a 0  (the "space")
    
    whole cycles per bit, so the wave joins
    smoothly at every bit edge (continuous phase)
    
    the height (envelope) never changes
  6. Where FSK sits in frequency

    FSK has two spikes, at 3 and 5 kHz, each with its own hump. Its main lobes span 2 to 6 kHz: 4 kHz wide, twice ASK's (the white curve). FSK pays for its steady height with bandwidth.

    FSK = two OOK streams that take turns:
      5 kHz on for the 1s, 3 kHz on for the 0s
    
    main lobes  2 .. 6 kHz
    width = (f1 − f0) + 2·Rb
          = 2 + 2 = 4 kHz
    ASK (white): 3 .. 5 kHz = 2 kHz
    
    the tones are 2 kHz apart = 2/Tb:
    whole cycles of difference per bit
  7. Receiving ASK: multiply and add up

    The receiver multiplies what arrives by its own 4 kHz cosine and adds up (integrates) over each bit. A 1 builds up to 0.50 V·ms; a 0 stays at 0. Above 0.25 means 1: it reads 1 0 1 1.

    correlator, one bit:
      y = ∫ r(t) · cos(2π·fc·t) dt   over Tb
    
    bit 1:  ∫ A·cos² = A·Tb/2 = 0.50 V·ms
    bit 0:  0 V·ms
    
    threshold = half of a 1 = 0.25 V·ms
      y > 0.25  ->  1
    
    decided: 1 0 1 1   (sent 1 0 1 1)
  8. A weaker signal fools ASK

    Move the receiver farther away and only 40% of the height arrives. Now a 1 builds up to just 0.20 V·ms, below the fixed threshold of 0.25. All 3 ones are read as zeros: 0 0 0 0.

    received r(t) = 0.4 · s(t)
    
    bit 1:  0.4 × 0.50 = 0.20 V·ms  < 0.25
      -> read as 0
    
    decided: 0 0 0 0   (sent 1 0 1 1)
    errors:  3 of 4
    
    a real ASK receiver must track the
    signal strength to move its threshold
    (automatic gain control)
  9. FSK needs no threshold

    An FSK receiver runs two correlators, one at 5 kHz and one at 3 kHz, and picks the larger. At 40% strength they reach 0.20 and 0 V·ms: still 1 0 1 1. Only which one is bigger matters.

    two correlators, same 40% signal:
      y1 = ∫ r · cos(2π·5000·t)
      y0 = ∫ r · cos(2π·3000·t)
    
    bit 1:  y1 = 0.20,  y0 = 0
    bit 0:  y1 = 0,     y0 = 0.20
      (the tones are orthogonal over a bit)
    
    y1 > y0 -> 1
    decided: 1 0 1 1   (sent 1 0 1 1)
  10. FSK detection in Python

    In Python with numpy, one FSK decision takes four lines. Make 32 sample times, the two reference cosines, then compare r @ c1 with r @ c0. The @ multiplies sample by sample and adds up: a correlator.

    import numpy as np
    fs, A, g = 32000, 1.0, 0.4
    t = np.arange(32) / fs     # one bit
    c1 = np.cos(2*np.pi*5000*t)
    c0 = np.cos(2*np.pi*3000*t)
    for b in [1, 0, 1, 1]:
        r = g * A * (c1 if b else c0)
        y1 = r @ c1 / fs * 1000   # V·ms
        y0 = r @ c0 / fs * 1000
        print(f"{y1:.2f} {y0:.2f}", int(r @ c1 > r @ c0))
    
    0.20 -0.00 1
    -0.00 0.20 0
    0.20 -0.00 1
    0.20 -0.00 1
    (−0.00: a tiny rounding error, really 0)
  11. Choosing between them

    ASK is the simplest: garage remotes near 433.92 MHz use on-off keying. FSK needs more bandwidth but copes with changing signal strength; Bluetooth uses a smoothed FSK called GFSK. Next: keying the phase.

                ASK (OOK)          FSK
    changes     height             frequency
    main lobes  2·Rb  (2 kHz)      Δf + 2·Rb (4 kHz)
    receiver    one correlator     two correlators
                + a threshold      pick the larger
    weak signal threshold must     still works
                follow it
    used in     433.92 MHz remotes Bluetooth (GFSK)
                Morse code (CW)    caller ID (Bell 202)

Quiz Unlocks after the last step.