Introduction to RTL-SDR using
MATLAB/Simulink
EE423 Applications of Digital Signal Processing
Dr. Prust
4/14/2015
RTL-SDR Hardware
RTL-SDR Hardware
Rafael Micro R820T
(flexible RF front end)
Realtek RTL2832U
(ADC, I/Q Demod, USB data pump)
RTL-SDR Key Specs
Frequency range: 24 MHz 1766 MHz
Gain Settings:
Automatic Gain Control (AGC)
Manual Gain Settings: 0dB 49.6dB (29 settings)
8-bit I/Q samples (complex baseband)
delivered to host PC over USB
RTL-SDR Key Specs
Sample Rates:
Low speed: 225001 to 300000
High speed: 900001 to 3200000
Note: Sample rates above 2.4MSPS tend to drop
samples
Output data is complex baseband
Can choose int16 (raw I/Q samples), or
single/double (normalized to [-1,+1]) types
RTL-SDR in Matlab
SDRRTLReceiver system object
Specify radio parameters (e.g., fc, fs, gain)
View parameter settings and status
Receive data
% Create receiver and spectrum analyzer System objects
hRadio = comm.SDRRTLReceiver(
'CenterFrequency', 91.7e6, ...
'EnableTunerAGC', true, ...
'SampleRate', 1e6, ...
'OutputDataType', 'double');
RTL-SDR in Simulink
RTL-SDR Receiver block
Example flowgraph
in Simulink
Block Parameters
Block Parameters
Spectrum Analyzer Example
Open: sdrrSpectralAnalysisExample
Play Time
Some items to investigate:
Tuner gain setting
Relationship between sampling rate and BW
View some other FM radio stations
Tune to your favorite, OR do a web search to find local stations
Consider the theory:
Baseband spectra are NOT conjugate symmetric, therefore
time domain signals must be complex
Carsons Rule
FM Receiver (Mono)
Open: sdrrFMMonoExample
View Demodulated Waveform
Double-click FM Receiver block
In Simulink Library Browser, select
DSP System Toolbox
Sinks
Drag Spectrum Analyzer block to model
Connect it to output of FM Demodulator
Set RTL-SDR block to FM station (e.g. 91.7e6)
Run
Back to MATLAB
Download getRawData_RTLSDR.m
function [ data, t, infoRTLSDR] = getRawData_RTLSDR( freq, gain, fs, duration )
% function [ data, t, infoRTLSDR] = getRawData_RTLSDR( freq, gain, fs, duration )
%
% This function reads complex envelope data from the NooElec R820T SDR
% and returns the raw data to the Matlab workspace
%
% PARAMETERS:
% freq is the carrier frequency (in Hz)
% gain is the reciever gain (in dB)
% fs is the sampling rate (in Hz)
% duration is the record time (in seconds)
%
% RETURN VALUES:
% data is the vector of raw data samples
% t is the vector of time samples
% info is the data structure providing actual RTL-SDR settings for the
% recording
Example:
>>
>>
>>
>>
[data, t, infoR] = getRawData_RTLSDR(91.7e6,30,240e3,1);
plot(t,real(data),b)
hold on;
plot(t,imag(data),g)