ASK and FSK: switching amplitude and frequency
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.
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
Read the lesson step by step
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 bitsThe 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)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 0Where 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 humpFSK: 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 changesWhere 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 bitReceiving 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)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)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)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)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)
5 quick questions
Choose one answer per question. You can change your choices before checking them.
01In on-off keying (OOK), what does the transmitter send for a 0 bit?
OOK is the simplest ASK: carrier present means 1, carrier absent means 0. A lower frequency would be FSK and a flipped carrier would be phase-shift keying.
02Bits go at 1000 bit/s. FSK uses 5 kHz for a 1 and 3 kHz for a 0. How many carrier cycles fit in one 0 bit?
Cycles per bit = f · Tb = 3000 Hz × 0.001 s = 3. A 1 bit gets 5 cycles.
03Why does the FSK spectrum in this lesson take about twice the bandwidth of the ASK spectrum?
Each tone is on for some bits and off for others, so each makes an OOK-like hump 2·Rb wide. The two humps sit Δf apart, so the main lobes span Δf + 2·Rb = 2 + 2 = 4 kHz, against 2 kHz for ASK.
04An OOK correlator gives 0.50 V·ms for a full-strength 1 and uses a fixed threshold of 0.25. The signal arrives at 40% strength. What happens to a 1 bit?
The correlator output scales with the received amplitude: 0.4 × 0.50 = 0.20 V·ms, which is below 0.25, so the 1 is wrongly read as 0. An ASK receiver must adjust its threshold to the signal strength.
05An FSK receiver has two correlators, at the mark and space frequencies. How does it decide a bit?
The tones are orthogonal over a bit, so only the matching correlator builds up. Comparing the two outputs needs no threshold, which is why a weaker signal does not change the decision (without noise).
Glossary
- Carrier
- A steady sine or cosine wave at a chosen frequency fc that is changed (modulated) to carry information.
- Amplitude-shift keying (ASK)
- Digital modulation that sends bits by changing the carrier's amplitude (height).
- On-off keying (OOK)
- The simplest ASK: the carrier is on for a 1 and off for a 0.
- Frequency-shift keying (FSK)
- Digital modulation that sends bits by switching the carrier between frequencies; binary FSK uses a mark tone for 1 and a space tone for 0.
- Bit time Tb and bit rate Rb
- Tb is how long one bit lasts; Rb = 1/Tb is bits per second.
- Main lobe
- The central hump of a spectrum around a tone, between the first nulls on each side; here 2·Rb wide for each tone.
- Correlator
- A receiver block that multiplies the received signal by a reference wave and adds up (integrates) the product over one bit.
- Orthogonal
- Two waves whose product adds up to zero over a bit, so a correlator for one ignores the other.
Notes and sources
- The numbers are scaled down so each carrier cycle can be seen: 1000 bits per second on carriers of 3 to 5 kHz, 1 V tall, sampled 32000 times a second. Real radio links use carriers of MHz or GHz. Every value and curve in the figure is computed from this model.
- The waves in the air move in slow motion: a real radio wave crosses a room in a few nanoseconds. The 40% received strength is a chosen example, and noise is left out so the effect of strength alone is clear.
- The spectra are averages of |DFT|² over 64 blocks of 16 random bits, in decibels relative to the highest bin; values below -45 dB are drawn at -45 dB.
- J. G. Proakis, M. Salehi, Digital Communications, 5th ed., McGraw-Hill, 2008 (book preface page)
- B. P. Lathi, Modern Digital and Analog Communication Systems (Internet Archive record)
- A. V. Oppenheim, A. S. Willsky, S. H. Nawab, Signals and Systems, 2nd ed., Pearson (ch. 8: communication systems, modulation)
- MIT OpenCourseWare 6.02 Digital Communication Systems (Fall 2012), readings: ch. 14 Modulation and Demodulation
- MIT OpenCourseWare 6.450 Principles of Digital Communications I (R. Gallager, L. Zheng)
- Amplitude-shift keying (Wikipedia)
- On-off keying (Wikipedia): Morse code by radio, 433.92 MHz remotes
- Frequency-shift keying (Wikipedia): mark and space, Bluetooth GFSK, Bell 202
- NumPy documentation: numpy.cos (angles in radians)
- NumPy documentation: numpy.arange
Quiz Unlocks after the last step.