Radarspotting

Mode-S Receivers => DVB-T Dongles and Self-Assembly Receivers => Topic started by: muriloconte on February 08, 2015, 12:46:16 PM

Title: Displaying rtl_sdr's I/Q raw file in Matlab / Octave
Post by: muriloconte on February 08, 2015, 12:46:16 PM
Hi folks,

I'm trying to display in Matlab the mode-s waveform using rtl_sdr's I/Q raw data. I used the following command to generate the I/Q raw file:

# rtl_sdr -f 1090e6 -s 2000e3  modes.bin

According rtl_sdr documentation, the I/Q values are 8-bit unsigned int encoded (0-255), with 'I' and 'Q' data interleaved (e.g. I Q I Q I Q ...). With this information, I used the Matlab code below to display the data:


% Matlab / GNU Octave code
N = 2000; % Number of samples to read
fid = fopen('modes.bin','r');
iq_data = fread(fid,[N 2],'uint8');
i_mag = iq_data(:,1) - 127; % Fix range to be in (+-127)
q_mag = iq_data(:,2) - 127; % Same as above
x = sqrt(i_mag.^2 + q_mag.^2); % Computing amplitude
plot(x)


The result does not look like anything like mode-s messages (see attachments between what I expected and what i actually got). Does it need demodulation / filtering or whatsoever? What did I miss?

For sanity check, I tested the I/Q file generated above with dump1090, and it decoded ADS-B messages successfully, so I guess the I/Q file is fine.

Thanks in advance.


[Attachment deleted by Admin to save file space]
Title: Re: Displaying rtl_sdr's I/Q raw file in Matlab / Octave
Post by: IanH on February 08, 2015, 04:26:22 PM
I'm impressed with what you have done  ;D.

You will have to wait for an answer from someone who understands and can help.

Seems complicated to me!

Might be worthwhile sending a PM to member "junglejet" since he wrote RTL_SDR and will know the details of the output.
Title: Re: Displaying rtl_sdr's I/Q raw file in Matlab / Octave
Post by: muriloconte on February 09, 2015, 11:18:30 AM
Thank you IanH for this input. I'm new to this community and such information is highly valuable  ;)

As soon as I figure out how to solve this puzzle, I'll post it here.