CS434/534: Topics in Networked (Networking) Systems Wireless Foundation: Modulation and Demodulation Yang (Richard) Yang Computer Science Department Yale University 208A Watson Email: yry@cs.yale.edu http://zoo.cs.yale.edu/classes/cs434/
Outline Admin and recap Wireless background Frequency domain Basic concepts of modulation Amplitude modulation Amplitude demodulation
Admin PS1 deferred to Tuesday Feel free to stop by Chris Leet office at any time to discuss PS1
Recap: Fourier Series of Periodic Function A periodic function g(t) with period T on [a, a+T] can be decomposed as: For periodic function with period 1 on [0, 1] http://en.wikipedia.org/wiki/Fourier_series
Signals at undesirable frequencies Basic Question: Why Not Send Digital Signal in Wireless Communications? Signals at undesirable frequencies suppose digital frame repeat every T seconds, then according to Fourier series decomposition, signal decomposes into frequencies at 1/T, 2/T, 3/T, … let T = 1 ms, generates radio waves at frequencies of 1 KHz, 2 KHz, 3 KHz, … 1 digital signal t
Frequencies are Assigned and Regulated Europe USA Japan Cellular Phones GSM 450 - 457, 479 486/460 467,489 496, 890 915/935 960, 1710 1785/1805 1880 UMTS (FDD) 1920 1980, 2110 2190 (TDD) 1900 1920, 2020 2025 AMPS , TDMA CDMA 824 849, 869 894 1850 1910, 1930 1990 PDC 810 826, 940 956, 1429 1465, 1477 1513 Cordless CT1+ 885 887, 930 932 CT2 864 868 DECT 1900 PACS 1910, 1930 UB 1910 PHS 1895 1918 JCT 254 380 Wireless LANs IEEE 802.11 2400 2483 HIPERLAN 2 5150 5350, 5470 5725 902 928 I EEE 802.11 5350, 5725 5825 2471 2497 5250 Others RF Control 27, 128, 418, 433, 315, 915 426, 868 $22 billion: Amount operators paid the U.S. government over the past ten years for spectrum. Source Burton Group. US operator: http://wireless.fcc.gov/uls
Spectrum and Bandwidth: Shannon Channel Capacity The maximum number of bits that can be transmitted per second by a physical channel is: where W is the frequency range of the channel, and S/N is the signal noise ratio, assuming Gaussian noise
Why Not Send Digital Signal in Wireless Communications? Transmitter voice Antenna: size ~ wavelength 20-20KHz At 3 KHz, Antenna too large! Use modulation to transfer to higher frequency
Recap: Discrete Domain Analysis FFT: Transforming a sequence of numbers x0, x1, …, xN-1 to another sequence of numbers X0, X1, …, XN-1 Interpretation: consider x0, x1, …, xN-1 as sampled values of a periodical function defined on [0, 1] Xk is the coefficient (scaled by N) for k Hz harmonics if the FFT N samples span one sec Draw on blackboard [Nfft, Nfft, …] = Ns (defined for 1 sec)
FFT Analysis vs Sample Rate X1 X2 XNfft/2 Nfft=Nsample 1Hz 2Hz Nfft/2 Hz Relationship between FFT size N, and sample rate Ns. FFT Xk is for frequency at k * frequency of the N samples N/Ns. The freq. analysis resolution:
Frequency Domain Analysis Examples Using GNURadio spectrum_1_realsin_rawfft 1K real cosine wave 1024 FFT 32000 sample rate Prediction: Where is the peak of FFT? Commands ./plot/raw2numf signal.dat signal.show 0 1024 ./plot/raw2numfc fft.dat fft.show 0 1024 Relationship between FFT size N, and sample rate Ns. FFT Xk is for frequency at k * frequency of the N samples N/Ns.
Frequency Domain Analysis Examples Using GNURadio spectrum_2_realsin_plus.grc Two signal sources (350 + 440) Audio sink Scope Sink FFT Sink (1024 FFT) Prediction: What is a good sample rate to see the result? Relationship between FFT size N, and sample rate Ns. FFT Xk is for frequency at k * frequency of the N samples N/Ns.
Frequency Domain Analysis Examples Using GNURadio spectrum_2_realsin_multiply Multiplication of previous signal by another sine wave Relationship between FFT size N, and sample rate Ns. FFT Xk is for frequency at k * frequency of the N samples N/Ns.
Advantage of I/Q representation Advantages of I/Q representation Relationship between FFT size N, and sample rate Ns. FFT Xk is for frequency at k * frequency of the N samples N/Ns.
I/Q Multiplication Also Called Quadrature Mixing Relationship between FFT size N, and sample rate Ns. FFT Xk is for frequency at k * frequency of the N samples N/Ns. spectrum of complex signal x(t) spectrum of complex signal x(t)ej2f0t spectrum of complex signal x(t)e-j2f0t
Outline Recap Wireless background Frequency domain Modulation and demodulation
Basic Concepts of Modulation The information source Typically a low frequency signal Referred to as baseband signal Carrier A higher frequency sinusoid Example cos(2π10000t) Modulated signal Some parameter of the carrier is varied in accordance with the baseband signal
Types of Modulation Analog modulation Digital modulation Amplitude modulation (AM) Frequency modulation (FM) Double and signal sideband: DSB, SSB Digital modulation Amplitude shift keying (ASK) Frequency shift keying: FSK Phase shift keying: BPSK, QPSK, MSK Quadrature amplitude modulation (QAM)
Outline Recap Wireless background Frequency domain Modulation and demodulation Basic concepts Amplitude modulation
Example: Amplitude Modulation (AM) Block diagram Time domain Frequency domain
Example: am_modulation Example Setting Audio source (sample 32K) Signal source (300K, sample 800K) Multiply Two Scopes FFT Sink
Example AM Frequency Domain Note: There is always the negative freq. in the freq. domain.
Outline Recap Wireless background Frequency domain Modulation and demodulation Basic concepts Amplitude modulation Amplitude demodulation
Problem: How to Demodulate AM Signal?
Design Option 1 Step 1: Multiply signal by e-j2πfct Implication: Need to do complex multiple multiplication
Design Option 1 (After Step 1) -2fc
Design Option 1 (Step 2) Apply a Low Pass Filter to remove the extra frequencies at -2fc -2fc
Design Option 2: Quadrature Sampling
Quadrature Sampling: Upper Path (cos)
Quadrature Sampling: Upper Path (cos)
Quadrature Sampling: Upper Path (cos)
Quadrature Sampling: Lower Path (sin)
Quadrature Sampling: Lower Path (sin)
Quadrature Sampling: Lower Path (sin)
Quarature Sampling: Putting Together Relationship between FFT size N, and sample rate Ns. FFT Xk is for frequency at k * frequency of the N samples N/Ns.
Summary: Demod of AM Design option 1: multiply modulated signal by e-jfct, and then LPF Design option 2: quadrature sampling
Remaining Hole: How to Design LPF Frequency domain view freq B -B freq B -B
Design Option 1 compute freq zeroing out outband freq compute lower-pass time signal freq B -B This is essentially how image compression works. Problem(s) of Design Option 1?
Design Option 2: Impulse Response Filters GNU software radio implements filtering using Finite Impulse Response (FIR) filters Infinite Impulse Response (IIR) Filters FIR filters are more commonly used FIR/IIR is essentially online, streaming algorithms They are used in networks/communications/vision/robotics…
FIR Filter An N-th order FIR filter h is defined by an array of N+1 numbers: They are often stored backward (flipped) Assume input data stream is x0, x1, …, … hN h2 h1 h0
xn-3 xn-2 xn-1 xn xn+1 * * * * h3 h2 h1 h0 FIR Filter compute y[n]: 3rd-Order Filter h3 h2 h1 h0 compute y[n]:
FIR Filter xn-3 xn-2 xn-1 xn xn+1 * * * * h3 h2 h1 h0 compute y[n+1]
FIR Filter is also called convolution between x (as a vector) and h (as a vector), denoted as
Key Question Using h to Implement LPF How to determine h? Approach: Understand the effects of y=g*h in the frequency domain
Backup Slides
GNURadio: Design Objective A software development toolkit that provides signal processing blocks to implement software-defined radio systems.
GNURadio Hardware Arch Hardware Frontend Host Computer RF Frontend (Daugtherboard) ADC/DAC and Digital Frontend (USRP) GNU Radio Software http://mobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/software_testing/Gnu_radio_lecture.pdf
Basic Software Concepts Block Flow graph
Basic Software Concepts http://gnuradio.org/doc/doxygen/classgr__block.html gr_basic_block (name, in/out signature, msg queue) gr_block (Leaf block; key functions forecast/general_work) Example: http://www.gnu.org/software/gnuradio/doc/howto-write-a-block.html gr_hier_block2 (container block; key functions: connect/disconnect/lock/unlock) gr_top_block (flow graph; start/stop/wait)
Software/Execution Model Software model Python Application management (e.g., GUI) Flow graph construction Non-streaming code (e.g., MAC-layer) C++ Signal processing blocks Certain routines also coded in assembly Execution model Python thread for each top_block Python Application development Flow graph construction C++ Signal processing blocks Discussion: benefits/issues of the hybrid software structure?
Summary: GNURadio Interesting/key software design techniques you learned from GNURadio?