Forums

Visualizing the spectrum of a 433 MHz433 MHz signal in MATLAB

Started by NatiyaITD 2 years ago12 replieslatest reply 2 years ago445 views
I recorded a 433 MHz IQ signal with a SDR dongle as a .wav file and when I read it in #MATLAB, I see the following:

enter image description here

This is the code:

<code>[y,Fs] = audioread('HDSDR_SHORT_433920kHz_RF.wav',[5000000 10000000]);
Y=fft(y);
X=fftshift(Y);
xx=-5000000/2:1:5000000/2;
stem(xx,X)
</code>

I wonder if what I'm seeing is:

  • noise?
  • that I truncated the signal so it's incorrect?
  • the spectrum is shifted?

Here is the original recoding and the truncated signal I plotted. Basically, my experiment consists in recording a parking remote signal with my rtl2838 dongle, using the software HDSR which records the IQ data in a .wav file. I selected a centered frequency of 433 MHz433 MHz. The bandwidth is 192Khz.

Then, I want to process it in MATLAB to introduce it in a spectrum analyzer, but I need to understand what I've recoreded first, so I need help on that.

[ - ]
Reply by kazAugust 17, 2017

you better do the following:

<code>
Y=fft(y);
X=fftshift(Y);
f=linspace(-Fs/2,+Fs/2,length(X));
plot(f,20*log10(abs(X)));
</code>
also look at time domain
[ - ]
Reply by NatiyaITDAugust 19, 2017

thank you very much! This is the frequency plot I get:

spectrum_47354.jpg

and for the time domain, I used this code:

[y,Fs] = audioread('HDSDR_SHORT_433920kHz_RF.wav',[5000000 10000000]);
samples=0:1:5000000;
t=samples/Fs;
plot(t,y)

and I get:

time_domain_89972.jpg

I also represented the signal in the ARB Toolbox from Rohde & Schwarz:

arb_toolbox_61388.jpg

would you know if taking only the IQ samples from [5000000 10000000] is affecting what I see? Also, should I not see a peak in the spectrum at 433MHz? I'm a bit confused on that. When I recorded the signal with the SDR dongle, I selected the center frequency to be the 433MHz, so is that what I see in the 0?


Thanks a lot!

[ - ]
Reply by kazAugust 21, 2017

The data you pass to fft must represent your signal in a sufficient way and you may discard repeated patterns or any section that is not relevant to your observation.

Concerning 433MHz. This is RF centre frequency and assuming no carrier leakage then there would be no peak there. Moreover I expect you have down-converted to dc (433MHz will move to dc) and you got some dc in your spectrum.

Finally have you considered your sampling rate and any aliasing as result? what is your sampling rate exactly, I assume it is 3.2Msps based on your scaling of spectrum.

[ - ]
Reply by NatiyaITDAugust 21, 2017

Thank you very much! Yes, the sampling rate (Fs) is 3.2Msps and the bandwidth is a bit weird, because I selected in the HSDR sofware using this:


bandwidth_98580.jpg

 so as shown in the picture, when you click on bandwith, it says "sampling rate" and it's in Hz (also, there is an input and an output), so I assumed this is the bandwidth in Hz, and I selected the 192KHz in both (input and output).


Then, you also select the center frequency (433MHz):

8-15-2017 9-38-27 am_90306.png


so is my original signal converted to base band? So the peak in 0 Hz is the DC component? what about the rest of the tiny peaks we see in the spectrum? 


or maybe the way I record my signal is incorrect? As in, the parameters I select?

[ - ]
Reply by kazAugust 22, 2017

I can't help with your tool setup. You haven't explained your expectations or nature of capture and you seem trying study a signal by just eyeballing (not best way). I can see a frequency at +/-1.28MHz, +/- 0.83MHz and +/-150KHz on spectrum. Time domain shows this slow one is due to repetition of fast ones. Your spectrum should be that of complex signal but you have done it on real & imaginary separately.

You need to explain more details about your capture concepts away from tool specific setups

[ - ]
Reply by NatiyaITDAugust 22, 2017

Oh, I see... thank you. All that I wanted to do is recording a signal from my parking remote which carrier frequency is 433MHz (in Spain). 


I have the rtl2838 dongle to record the signal in my PC by using the software HDSDR, so I set the center frequency in 433MHz.

Then, I got the signal recorded as a .wav file in IQ samples. As I pressed the button of the remote a second after start the recording, I only take the middle IQ samples of my recording.


Then, I did that Matlab code that I showed you and also saved the IQ samples in an .txt file to be able to see it in the ARB Toolbox software, as I showed you as well. This software also converts the .txt file into a .wv file, so I can load it in a Spectrum Analyzer.


So my goal is recording the parking remote control with my dongle rtl2838, and find a way to make sure I did it properly.


If you need more information, let me know, please.


Thank you very much! 

[ - ]
Reply by kazAugust 22, 2017

OK I understand RF centre frequency is 433MHz. This is centre of signal at capture but what is the signal meant to be? is it meant to be a sine wave generated on/off or a band limited signal. Every man-made signal has some sort of standards or definitions on how it is created and this is missing from discussion.


[ - ]
Reply by NatiyaITDAugust 22, 2017

thank you. That's also what I'm looking for. At the moment, I just know the signal seems to be a kind of OOK, based on these codes. Regarding to the bandwith, I'm not sure if it's about 200KHz. I read this tutorial, where the author does something similar but designing his own SDR. But I'm not sure about the bandwidth and maybe that's a limitation of my recording software.

[ - ]
Reply by kazAugust 22, 2017

I will focus on time domain. You already have ON/OFF states in your signal with short and wider durations of sine wave ON followed by OFF noise. (Plot magnitude of signal to get both I/Q information)

Next is to work out if you want to recover a particular data sequence.

That requires detecting those ON/OFF segments and their durations and decode to a digital pattern.

[ - ]
Reply by NatiyaITDAugust 22, 2017

Thank you! So the magnitude of the signal would be the previous one I plotted? I mean, this one:

spectrum_70268.jpg


or you mean, I and Q separately? In that case, this is the magnitude of the I component:

magnitude_i_95352.jpg


and this is the Q component:

magnitude_q_8436.jpg


so there seem to be a different at 0 Hz.

and this is a screenshot of the IQ mangnitude when you play the waveform in the ARB Toolbox:

8-22-2017 7-03-04 pm_12772.jpg

I'm not surre if this last picture gives you relevant information.


My goal here is to record a garage door opener signal and deliver it in a format (.wv) that a spectrum analyzing can read. So I don't need to decode the information, I just want to make sure what I recorded makes sense.

Also, regarding to the bandwidth, when you record a signal in the PC using the HDSDR software, it shows you the spectrum so it adapts the relevant bandwidth to record, so I thought the signal bandwidth I recorded is the correct one.


Thank you very much for all your help!

[ - ]
Reply by kazAugust 22, 2017

I meant magnitude in time domain. I don't see why you want to see spectrum as it is useful for initial checks on moving from RF to baseband. The signal in the time domain now available to you directly (baseband) and if you look at samples from 1 million to end you will see the on/off signal. 

[ - ]
Reply by NatiyaITDAugust 22, 2017

oooh...I see what you mean! I plotted what you said and I think I start seeing something now.


Well, the signal's got many samples (22991297 samples, when not taking the first million). For example, this is the magnitude of the I component in the time domain:


time_domaini_37247.jpg

I highlighted in a square where I think the signal is, so probably I should plot only those samples?


Also, this is the zoom of that portion of the signal:

time_domaini_zoom_31304.jpg


that pattern is repeated in every pulse, so I guess that's the code?

Thank you very much!!! :)