ENع
→BPSK and QPSK
الدرس 62 · Digital modulation

Phase-shift keying: BPSK and QPSK

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

18 دقيقة11 خطوة5 أسئلةAdvanced
عن هذا الدرس

Phase-shift keying puts bits on a radio carrier by choosing where in its cycle the wave starts. Follow the bits 1 0 1 1 0 0 0 1 through a transmitter and a receiver: BPSK sends one bit per 1 ms symbol as a 3000 Hz carrier times +1 or −1, and a correlator (multiply by the carrier, then integrate) reads each bit back from its sign. Then QPSK puts a second bit on the sine, which the cosine correlator cannot see, and sends all eight bits in the same 4 ms. You will read BPSK and QPSK constellation diagrams, see why Gray coding helps, and build BPSK and its receiver in Python with numpy. Builds on the lessons "I and Q: two carriers in one channel" and "ASK and FSK" in this module, and goes deeper than the Hardware lesson on radio-frequency basics and the Networking lesson on wireless basics.

ستتعلّم

حدّد ما تشعر بأنك أتقنته. هذا التقييم الذاتي لا يؤثر في درجة الدرس.

شكل 62 · تفاعلي
01 / 11

The carrier: a steady wave

A radio sends bits by changing a carrier: a steady cosine, here c(t) = cos(2π·3000·t). A sine wave has three things to change: amplitude, frequency and phase. ASK and FSK change the first two. Phase-shift keying (PSK) changes the phase.

carrier  c(t) = A·cos(2π·fc·t)
         A  = 1 V
         fc = 3000 Hz  (period 0.333 ms)

three knobs:
  amplitude  -> ASK
  frequency  -> FSK
  phase      -> PSK   (this lesson)

phase = where in its cycle the wave starts
(a slowed teaching example: real carriers
 run at MHz to GHz)
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. The carrier: a steady wave

    A radio sends bits by changing a carrier: a steady cosine, here c(t) = cos(2π·3000·t). A sine wave has three things to change: amplitude, frequency and phase. ASK and FSK change the first two. Phase-shift keying (PSK) changes the phase.

    carrier  c(t) = A·cos(2π·fc·t)
             A  = 1 V
             fc = 3000 Hz  (period 0.333 ms)
    
    three knobs:
      amplitude  -> ASK
      frequency  -> FSK
      phase      -> PSK   (this lesson)
    
    phase = where in its cycle the wave starts
    (a slowed teaching example: real carriers
     run at MHz to GHz)
  2. BPSK: the bit picks the phase

    Binary PSK sends one bit per symbol. Bit 1 sends the carrier as it is: phase 0°. Bit 0 sends it half a cycle later: phase 180°. Each symbol lasts T = 1 ms, which is 3 carrier cycles here.

    symbol rate  1000 symbols/s,  T = 1 ms
    cycles per symbol  fc·T = 3
    
    bit 1 -> s(t) = A·cos(2π·fc·t + 0°)
    bit 0 -> s(t) = A·cos(2π·fc·t + 180°)
    
    bits     1    0    1    1
    phase    0°   180° 0°   0°   
    
    1 bit per symbol -> 1000 bit/s
  3. A phase flip is a sign flip

    Shifting a cosine by half a cycle turns it upside down: cos(ωt + π) = −cos(ωt). So BPSK is the carrier times +1 or −1. A mixer is a multiplier; where the bit changes, the wave jumps.

    ω = 2π·fc   (angular frequency, rad/s)
    
    cos(ωt + π) = −cos(ωt)
    
    so  s(t) = a·A·cos(ωt),  a = 2b − 1
        bit 1 -> a = +1
        bit 0 -> a = −1
    
    mixer = multiplier: carrier × a
    see t = 1 ms (1 -> 0) and t = 2 ms (0 -> 1):
    the wave reverses at the boundary
  4. Two points on a line

    Draw each symbol as a point: how much cosine it holds. BPSK has two points, +1 and −1, on the I axis (I for in-phase, the cosine). This picture is a constellation diagram. Its two points are 2.0 apart.

    constellation diagram
      x axis  I  (amount of cosine)
      y axis  Q  (amount of −sin, used later)
    
    BPSK points
      bit 1 -> (I, Q) = (+1, 0)
      bit 0 -> (I, Q) = (−1, 0)
    
    distance between them: 2.0
    (further apart = harder for noise to confuse)
  5. Multiply by the carrier, then add up

    The receiver multiplies what arrives by its own copy of the carrier. For bit 1 that gives cos², never negative; for bit 0, never positive. It then adds up (integrates) over the symbol. Multiply-then-integrate is a correlator.

    z(t) = (2/T)·∫ s(τ)·cos(ωτ) dτ
           from the symbol start to t
    
    bit 1: s·cos = A·cos²(ωt) >= 0  -> z climbs
    bit 0: s·cos = −A·cos²(ωt) <= 0 -> z falls
    
    cos² = (1 + cos 2ωt)/2: average 1/2,
    so after a whole symbol z = ±A
    
    the receiver's carrier must be in phase
    (coherent detection)
  6. Decide by the sign

    At the end of each symbol the correlator holds +1 or −1, then resets. Positive means 1, negative means 0. Noise would have to push the result past zero, a whole 1.0 away, to flip a bit.

    end of symbol k: z = 1.00, −1.00, 1.00, 1.00
    decision: z > 0 -> 1,  z < 0 -> 0
    bits out: 1 0 1 1
    
    the dot on the constellation is (z, 0):
    it runs from 0 out to its point
    
    margin to the threshold (0): 1.0
    half the distance between the points
  7. The sine is invisible to the cosine

    Now feed the cosine correlator −sin(ωt), the carrier shifted 90°. Over whole cycles cos·sin adds up to exactly 0. So a second bit stream can ride on the sine without disturbing the first. See the lesson “I and Q: two carriers in one channel”.

    (2/T)·∫ −sin(ωt)·cos(ωt) dt
      = −(1/T)·∫ sin(2ωt) dt
      = 0 over a symbol, since fc·T = 3 is whole
    
    largest wiggle inside the symbol: 0.053
    value at the end:                0.000
    
    cos and sin are orthogonal:
    the I branch never sees the Q branch
  8. QPSK: two bits per symbol

    Quadrature PSK sends two bits per symbol. The first bit sets the sign of the cosine part (I), the second the sign of the −sin part (Q), each 0.71 V. Added, they make one cosine with one of four phases.

    I = (2·b1 − 1)/√2,  Q = (2·b2 − 1)/√2
    s(t) = A·(I·cos ωt − Q·sin ωt)
         = A·cos(ωt + φ),  φ = atan2(Q, I)
    
    pair   I      Q      phase
    10     0.71  −0.71  315°
    11     0.71  0.71  45°
    00     −0.71  −0.71  225°
    01     −0.71  0.71  135°
    
    2 bits per symbol -> 2000 bit/s
  9. Four points on a circle

    QPSK's constellation has four points, all at radius 1. Going round, 11, 01, 00, 10, neighbours differ in one bit only: Gray coding. A small noise error that lands on a neighbour costs one bit, not two.

    points (I, Q) = (±0.71, ±0.71)
    radius √(I² + Q²) = 1   (same power as BPSK)
    
     45°  11    135°  01
    225°  00    315°  10
    
    neighbours 1.41 apart, one bit different
    (Gray code)
  10. Two correlators, twice the bits

    A cosine correlator reads I and a −sin correlator reads Q, at once. Eight bits arrive in 4 ms, not four: same symbol rate and bandwidth (range of frequencies used), twice the bit rate. At equal energy per bit, errors are as rare as BPSK.

    end of symbol k:
      z_I = 0.71, 0.71, −0.71, −0.71
      z_Q = −0.71, 0.71, −0.71, 0.71
    signs -> bits 1 0 1 1 0 0 0 1
    
    bit error rate in white noise (Gray QPSK = BPSK):
      Pb = Q(√(2·Eb/N0))
      Eb = energy per bit, N0 = noise level
    
    BPSK: GPS satellites (C/A code)
    BPSK: Wi-Fi 802.11g at 6 and 9 Mbit/s
  11. PSK in Python

    With numpy, np.outer builds one row of carrier per symbol, already times +1 or −1: that is BPSK. The last line multiplies by the carrier and averages each row, the correlator. Out come +1, −1, +1, +1: bits 1 0 1 1.

    import numpy as np
    b = np.array([1, 0, 1, 1])
    t = np.arange(48) / 48000
    c = np.cos(2*np.pi*3000*t)
    s = np.outer(2*b - 1, c)
    y = 2 * (s * c).mean(axis=1)
    
    >>> s.shape
    (4, 48)          # 4 symbols, 48 samples each
    >>> y
    array([ 1., -1.,  1.,  1.])
    
    48 000 samples/s, 1 ms symbols, 3 kHz carrier
    2 × mean = (2/T)·∫ ... dt
    (Python 3 with numpy)

اختبار يتاح بعد الخطوة الأخيرة.