Receive data from RTL-SDR
Communications System Toolbox Support Package for RTL-SDR
RTL-SDR Receiver block with default ports
RTL-SDR Receiver block with all ports enabled
The RTL-SDR Receiver block is a signal source that receives data from an RTL-SDR radio and outputs a column vector signal of fixed length specified by the samples per frame parameter.
The following block diagram illustrates the interaction between Simulink®, the RTL-SDR Receiver block, and the RTL SDR radio.
If your computer is not connected to any RTL-SDR hardware, you can still use this block to develop a model that propagates sample time and data type information. To propagate this information, select Edit > Update diagram; alternatively, you can press Ctrl + D.
To open the RTL-SDR Block library, enter the following at the MATLAB® prompt:
|Port||Supported Data Types|
The output port supports these complex data types only:
USB address of the RTL receiver. Must be a string containing
a scalar, non-negative integer value. The default is
About USB port addresses USB address are not assigned in a manner that it is intuitive. If a device is plugged into the first USB port, it is always at address 0. But if there is a device plugged into a second or third port, the address varies depending on whether there is a device in any of the previous ports. See the following illustrations for a visual explanation.
This diagram illustrates how the USB port addresses are assigned when devices are added and then removed in FIFO order.
This diagram illustrates how the USB port addresses are assigned when devices are added and then removed from port 0. Note that the radio address for the second RTL device changes based on whether or not the first port has a device in it. You must keep track of the plugged-in devices in order to access a radio with the correct radio address.
Update block parameters in model. Clicking this button also causes the Hardware Information panel to be updated with current radio information.
You can verify that your RTL-SDR Receiver block is connected to the RTL device with the Initialize button on the block.
Open the block mask.
Click the Initialize button.
If the block is not connected, the panel will show the following message:
No attached SDR hardware or unable to retrieve hardware information.
Specifies the center frequency of the input signal for the RTL-SDR radio. You can specify this parameter using the block dialog mask or a block input port. If you specify a value out of range for your device, you will get an error.
Specify the desired tuner gain as coming from a block parameter
Property), a block input port
Input Port), or via automatic gain control
AGC). The default is
The valid range of this property depends on the tuner chip of the
RTL-SDR radio. However, if you specify a value out of range for the
device, the actual tuner gain value is quantized to the minimum or
maximum valid value.
Specify the desired sampling rate as a double-precision, nonnegative
scalar. The allowed range is
225-300 kHz and
2800 kHz, you might lose
samples. The default is
Specify the frequency correction value in ppm as an integer.
The valid range is
[-1e4 1e4] ppm. The default
0. This parameter value is used to correct
for frequency shifts that occur as a result of local oscillator offsets
or clock rate inaccuracies.
Select this parameter to instruct the RTL-SDR Receiver block to output the number of lost samples during host-hardware data transfers.
Zero indicates no data loss.
A positive number indicates that overruns occurred.
The default value is not selected, which means that the port is not enabled and no information about dropped packets is displayed.
If your model runs in real-time, the lost samples output is always zero. This port is a useful diagnostic tool for determining real time operation of the block. See Real Time Operation.
Select this parameter to instruct the RTL-SDR Receiver block to indicate latency during host-hardware data transfers in number of frames.
Even when your model runs in real-time, received signals may experience latency. This port is a useful diagnostic tool for determining real time operation of the block. See Real Time Operation.
Specify the complex output data type as
int16. When you select
the output data type, the complex values are scaled to the range of
[-1,1]. When you select
int16, the complex values
are the raw 16–bit I and Q samples from the board. The default
This block supports the following complex output data types:
Double-precision floating point
Single-precision floating point
16-bit signed integers
Specify the number of samples in a frame for the block to output. This value must be a positive, scalar integer that is an integer multiple of 256. The default value is 1024.
See either of the following RTL-SDR Radio featured examples for an example of the RTL-SDR Receiver block in action:
FM Monophonic Receiver with RTL-SDR Hardware
FM Stereo Receiver with RTL-SDR Hardware
For more examples featuring the RTL-SDR Receiver block,
sdrexamples at the MATLAB command prompt.