How do I transmit a continuous signal via the SDRuTransmitter Function

4 views (last 30 days)
I need to use the SDRuTransmitter function of MATLAB to transmit data using a B205mini USRP.
I've utilized the MATLAB Documentation for comm.SDRuTransmitter and Frequency Offset Calibration but none of the provided code produces a sustained signal, or even explains how one could achieve a continuous broadcast. I hope to be able to measure the signal with a Spectrum Analyzer or another USRP.
Any help in getting the signal from MATLAB to show up on a Spectrum Analyzer would be greatly appreciated. Thanks!

Answers (1)

Abhimenyu
Abhimenyu on 31 Jan 2024
Hi John,
I understand that you are trying to use the “comm.SDRuTransmitter” system object of MATLAB to transmit a continuous stream of data using a B205mini-I USRP. For a sustained broadcast, various system object parameters should be set appropirately and the generated signal must be large enough vector for continuous streaming and transmission.
Please follow the example code below to create a sustained broadcast:
% Define SDRuTransmitter system object parameters appropirately
centerFrequency = 2.4e9; % For example, 2.4 GHz
gain = 10; % Transmission gain
interpolationFactor = 512; % Depends on your USRP model
sampleRate = 1e6; % Sample rate of the generated signal
% Create the SDRuTransmitter system object with platform as B205mini as it is a variant of B200 series.
% Please ensure the proper USRP hardware driver (UHD) and MATLAB support packages are installed.
radio =comm.SDRuTransmitter('Platform','B205mini','SerialNum','YOUR_SERIAL_NUMBER','CenterFrequency', ...
centerFrequency,'Gain',gain, 'InterpolationFactor',interpolationFactor);
% Signal generation
% Ensure that the signal is generated in a loop or as a large enough vector
% to allow for continuous streaming.
signalLength = 1e4; % Length of each signal chunk
signalFrequency = 1e5; % Frequency of the sine wave
t = (0:signalLength-1)'/sampleRate; % Time vector
signal = exp(1i*2*pi*signalFrequency*t); % Complex exponential as an example
% Loop for continuous transmission
% This loop will keep the USRP buffer filled and maintain the transmission.
while true
% Transmit the signal
radio(signal);
% You can include a pause here if needed to match the USRP's data rate
% pause(0.01); % Adjust the pause duration as necessary
end
% Release the system object
release(radio);
The above code will help to achieve a continuous broadcast to the USRP. Please replace “YOUR_SERIAL_NUMBER” with the actual serial number of the B205mini USRP. The above-mentioned example code should also be monitored for overflow or underflow, which can occur if the host computer cannot keep up with the USRP’s data rate requirements. Please adjust the signal generation or processing rate to match the USRP’s capabilities.
Once the signal is transmitted, it can be viewed on a “spectrum analyzer”. The spectrum analyzer should be tuned to the same centre frequency as the transmission and that the span and resolution bandwidth should be set appropriately to observe the signal. If another USRP is used as a receiver, a corresponding “comm.SDRuReceiver” system object with matching parameters should be set to receive the signal.
Please refer to the below mentioned MATLAB R2023b documentation links to know more on “comm.SDRuTransmitter” object, “spectrum analyzer” and “comm.SDRuReceiver” object respectively:
I hope this helps to resolve the query.
Thanks,
Abhimenyu

Categories

Find more on Communications Toolbox in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!