Radio
1. Device communication
No one knows
2. Reading data
type: uint8_t
First processing , change char type (uint8_t) to int8 or double (better double)
[ToDo]: how to find f0? (power spectral density)
3. Converting to complex
Device return data as a stream of sequentially IQ data like I1, Q1, I2, Q2 ... etc.
Convert data to complex value like Zn = In + i*Qn.
4. Shifting to baseband
complex_signal * exp(-i*w)
w = 2PI*fc/fs*t - as vector of discrete values with dt step
Euler's formul: exp(i*w) = cos(w) + i*sin(w)
+ filtering IIR:
var | 0 | 1 | 2 | 3 | 4 |
---|---|---|---|---|---|
b | 0.0004 | 0.0015 | 0.0022 | 0.0015 | 0.0004 |
a | 1.0000 | -3.2070 | 3.9205 | -2.1578 | 0.4502 |
5. Downsampling/decimation
After filtering we discard unnecessary samples by decimation wih factor fs/bwSERV
fs - sample rate
bwSERV - bandwitch of FM service (256e3Hz)
6. FM demodulation
C(n) = C(n) * C*(n-1) <--- conjugate
demodulated(n) = atan2(C(n).Im / C(n).Re)
atan2 - Compute arc tangent with two parameters
Then, decimate signal with factor of bwSERV/bwAUDIO after filtering
b (*e-5):
0.0020 0.0162 0.0567 0.1134 0.1417 0.1134 0.0567 0.0162 0.0020
a:
1.0000 -7.2117 22.9518 -42.0901 48.6330 -36.2476 17.0156 -4.5989 0.5479
7. Mono
Now we have mono singal <3
Normalization is optional - ym = ym /(max(abs(ym))+0.001)
8. PLL
Pilot signal in FM modulation is 19kHz signal around 38kHz. This freq and second harmonic give us left and right channel.
PLL is used to find pilot phase.