CS434/534: Topics in Networked (Networking)...
Transcript of CS434/534: Topics in Networked (Networking)...
CS434/534: Topics in Networked (Networking) Systems
Wireless Foundation: Modulation and Demodulation
Yang (Richard) YangComputer Science Department
Yale University208A Watson
Email: [email protected]
http://zoo.cs.yale.edu/classes/cs434/
2
Outline
❒ Admin and recap❒ Wireless background
❍ Frequency domain❍ Basic concepts of modulation
• Amplitude modulation• Amplitude demodulation
3
Admin
❒ PS1 deferred to Tuesday❒ Feel free to stop by Chris Leet office at
any time to discuss PS1
4
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]
g(t) = G[k]ej2π k
Tt
k=−∞
∞
∑
G[k]= 1T
g(t)e− j2π k
Ttdt
a
a+T∫
g(t) = G[k]e j2πk tk=−∞
∞
∑
G[k]= g(t)e− j2πk t dt0
1∫
5
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
0digital signal
t
6
Frequencies are Assigned and Regulated
Europe USA Japan
CellularPhones
GSM 450 - 457, 479 -486/460 - 467,489 -496, 890 - 915/935 -960,1710 - 1785/1805 -1880UMTS (FDD) 1920 -1980, 2110 - 2190UMTS (TDD) 1900 -1920, 2020 - 2025
AMPS , TDMA , CDMA824- 849, 869-894TDMA , CDMA , GSM1850 - 1910,1930 - 1990
PDC810- 826, 940- 956,1429 - 1465, 1477 - 1513
CordlessPhones
CT1+ 885 - 887, 930 -932CT2864-868DECT 1880 - 1900
PACS 1850 - 1910, 1930 -1990PACS -UB 1910 - 1930
PHS1895 - 1918JCT254-380
Wireless LANs
IEEE 802.112400 - 2483HIPERLAN 25150 - 5350, 5470 -5725
902-928I EEE 802.112400 - 24835150 - 5350, 5725 - 5825
IEEE 802.112471 - 24975150 - 5250
Others RF- Control27, 128, 418, 433,
868
RF- Control315, 915
RF- Control426, 868
US operator: http://wireless.fcc.gov/uls
7
Spectrum and Bandwidth: Shannon Channel Capacity❒ The maximum number of bits that can be
transmitted per second by a physical channelis:
where W is the frequency range of the channel, and S/N is the signal noise ratio, assuming Gaussian noise
)1(log2 NSW +
8
Why Not Send Digital Signal in Wireless Communications?
voice Transmitter
20-20KHzAntenna:
size ~ wavelength
At 3 KHz, λ =
cf
=3×108
3×103=100km
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
9
g(t) = G[k]e j2πk tk=−∞
∞
∑
G[k]= g(t)e− j2πk t dt0
1∫
10
FFT Analysis vs Sample Rate
X1
Nfft=Nsample
X2 XNfft/2
1Hz 2Hz Nfft/2 Hz
Nsample
N fft
2Nsample
N fft
Nsample
2
The freq. analysis resolution: Nsample
N fft
11
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
12
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?
13
Frequency Domain Analysis Examples Using GNURadio
❒ spectrum_2_realsin_multiply❍ Multiplication of previous signal by another sine
wave
14
Advantage of I/Q representation
❒ Advantages of I/Q representation
15
I/Q Multiplication Also Called Quadrature Mixing
spectrum of complexsignal x(t)
spectrum of complexsignal x(t)ej2f0t
spectrum of complexsignal x(t)e-j2f0t
16
Outline
❒ Recap❒ Wireless background
❍ Frequency domain❍ Modulation and demodulation
17
❒ The information source❍ Typically a low frequency signal❍ Referred to as baseband signal
q Carrierq A higher frequency sinusoidq Example cos(2π10000t)
q Modulated signalq Some parameter of the carrier is varied in accordance with the
baseband signal
Basic Concepts of ModulationBasic Concept of Modulation
The information source Typically a low frequency signal Referred to as the “baseband signal”
Carrier A higher frequency sinusoid Example: cos(2π10000t)
Modulated Signal Some parameter of the carrier (amplitude, frequency, phase) is varied in
accordance with the baseband signal
x(t)
t
X(f)
f
Modulator baseband
carrier Modulated signal
7/8/10 5 Flynn/Katz
Basic Concept of Modulation
The information source Typically a low frequency signal Referred to as the “baseband signal”
Carrier A higher frequency sinusoid Example: cos(2π10000t)
Modulated Signal Some parameter of the carrier (amplitude, frequency, phase) is varied in
accordance with the baseband signal
x(t)
t
X(f)
f
Modulator baseband
carrier Modulated signal
7/8/10 5 Flynn/Katz
Basic Concept of Modulation
The information source Typically a low frequency signal Referred to as the “baseband signal”
Carrier A higher frequency sinusoid Example: cos(2π10000t)
Modulated Signal Some parameter of the carrier (amplitude, frequency, phase) is varied in
accordance with the baseband signal
x(t)
t
X(f)
f
Modulator baseband
carrier Modulated signal
7/8/10 5 Flynn/Katz
Basic Concept of Modulation
The information source Typically a low frequency signal Referred to as the “baseband signal”
Carrier A higher frequency sinusoid Example: cos(2π10000t)
Modulated Signal Some parameter of the carrier (amplitude, frequency, phase) is varied in
accordance with the baseband signal
x(t)
t
X(f)
f
Modulator baseband
carrier Modulated signal
7/8/10 5 Flynn/Katz
18
Types of Modulation
❒ Analog 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)
19
Outline
❒ Recap❒ Wireless background
❍ Frequency domain❍ Modulation and demodulation
• Basic concepts• Amplitude modulation
Amplitude Modulation (AM) Block Diagram
Time Domain
Frequency Domain
m x +
Ac cos �ct
x(t) xAM(t)=Ac [1+mx(t)]cos �ct
X(f)
f -fm fm
XAM(f)
f -fc fc
Signal information is contained in the sidebands
7/8/10 7 Flynn/Katz 20
Example: Amplitude Modulation (AM)
❒ Block diagram
❒ Time domain
❒ Frequency domain
Amplitude Modulation (AM) Block Diagram
Time Domain
Frequency Domain
m x +
Ac cos �ct
x(t) xAM(t)=Ac [1+mx(t)]cos �ct
X(f)
f -fm fm
XAM(f)
f -fc fc
Signal information is contained in the sidebands
7/8/10 7 Flynn/Katz
Amplitude Modulation (AM) Block Diagram
Time Domain
Frequency Domain
m x +
Ac cos �ct
x(t) xAM(t)=Ac [1+mx(t)]cos �ct
X(f)
f -fm fm
XAM(f)
f -fc fc
Signal information is contained in the sidebands
7/8/10 7 Flynn/Katz
Amplitude Modulation (AM) Block Diagram
Time Domain
Frequency Domain
m x +
Ac cos �ct
x(t) xAM(t)=Ac [1+mx(t)]cos �ct
X(f)
f -fm fm
XAM(f)
f -fc fc
Signal information is contained in the sidebands
7/8/10 7 Flynn/Katz
Amplitude Modulation (AM) Block Diagram
Time Domain
Frequency Domain
m x +
Ac cos �ct
x(t) xAM(t)=Ac [1+mx(t)]cos �ct
X(f)
f -fm fm
XAM(f)
f -fc fc
Signal information is contained in the sidebands
7/8/10 7 Flynn/Katz
21
Example: am_modulation Example
❒ Setting❍ Audio source (sample 32K)❍ Signal source (300K, sample 800K)❍ Multiply
❒ Two Scopes
❒ FFT Sink
22
Example AM Frequency Domain
Note: There is always the negative freq. in the freq. domain.
23
Outline
❒ Recap❒ Wireless background
❍ Frequency domain❍ Modulation and demodulation
• Basic concepts• Amplitude modulation • Amplitude demodulation
24
Problem: How to Demodulate AM Signal?
Amplitude Modulation (AM) Block Diagram
Time Domain
Frequency Domain
m x +
Ac cos �ct
x(t) xAM(t)=Ac [1+mx(t)]cos �ct
X(f)
f -fm fm
XAM(f)
f -fc fc
Signal information is contained in the sidebands
7/8/10 7 Flynn/Katz
Amplitude Modulation (AM) Block Diagram
Time Domain
Frequency Domain
m x +
Ac cos �ct
x(t) xAM(t)=Ac [1+mx(t)]cos �ct
X(f)
f -fm fm
XAM(f)
f -fc fc
Signal information is contained in the sidebands
7/8/10 7 Flynn/Katz
25
Design Option 1
❒ Step 1: Multiply signal by e-j2πfct
❍ Implication: Need to do complex multiple multiplication
26
Design Option 1 (After Step 1)
-2fc
27
Design Option 1 (Step 2)
❒ Apply a Low Pass Filter to remove the extra frequencies at -2fc
-2fc
28
Design Option 2: Quadrature Sampling
29
Quadrature Sampling: Upper Path (cos)
30
Quadrature Sampling: Upper Path (cos)
31
Quadrature Sampling: Upper Path (cos)
32
Quadrature Sampling: Lower Path (sin)
33
Quadrature Sampling: Lower Path (sin)
34
Quadrature Sampling: Lower Path (sin)
35
Quarature Sampling: Putting Together
36
Summary: Demod of AM
❒ Design option 1: multiply modulated signal by e-jfct, and then LPF
❒ Design option 2: quadrature sampling
37
Remaining Hole: How to Design LPF
❒ Frequency domain view
freqB-B
freqB-B
38
Design Option 1
freqB-B
freqB-B
compute freq
zeroing outoutband freqcompute lower-pass
time signal
This is essentially how image compression works.Problem(s) of Design Option 1?
39
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…
40
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, …,
h = [h0,h2,...,hN ]
h0h1h2hN…
41
FIR Filter
xnxn-1xn-2xn-3
h0h1h2h3
****
xn+1
compute y[n]: yn = xnh0 + xn−1h1 +...+ xn−NhN
= xn−ihii=0
N
∑
3rd-OrderFilter
42
FIR Filter
xnxn-1xn-2xn-3
h0h1h2h3
****
xn+1
compute y[n+1]
43
FIR Filter
is also called convolution between x (as a vector) and h (as a vector), denoted as
yn = xnh0 + xn−1h1 +...+ xn−NhN
yn = xn *hn
44
Key Question Using h to Implement LPF
❒ Q: ❍ How to determine h?
❒ Approach:❍ Understand the effects of y=g*h in the
frequency domain
Backup Slides
45
46
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 andDigital Frontend
(USRP)
http://mobiledevices.kom.aau.dk/fileadmin/mobiledevices/teaching/software_testing/Gnu_radio_lecture.pdf
GNU RadioSoftware
Basic Software ConceptsrBlock
rFlow graph
Basic Software Conceptsrhttp://gnuradio.org/doc/doxygen/classgr
__block.html
rgr_basic_block (name, in/out signature, msg queue)r gr_block (Leaf block; key functions
forecast/general_work)r Example:
http://www.gnu.org/software/gnuradio/doc/howto-write-a-block.html
r gr_hier_block2 (container block; key functions: connect/disconnect/lock/unlock)r gr_top_block (flow graph; start/stop/wait)
Software/Execution Model
Python
Application developmentFlow graph construction
C++
Signal processing blocks
r Software modelr Python
m Application management (e.g., GUI)
m Flow graph constructionm Non-streaming code (e.g.,
MAC-layer)r C++
m Signal processing blocksm Certain routines also coded in
assembly
q Execution modelq Python thread for each
top_block
Discussion: benefits/issues of the hybrid software structure?
51
Summary: GNURadio
❒ Interesting/key software design techniques you learned from GNURadio?