Jeija / renard-phy

Open Sigfox Stack Reference Implementation - Physical Layer for SDR
21 stars 11 forks source link

Question on making own recordings #2

Closed hollie closed 5 years ago

hollie commented 5 years ago

Hello Florian,

thanks for sharing the code you wrote. This is an interesting project to learn more about the internals of the Sigfox protocol!

I have a basic question regarding the recording of input data from my own Sigfox device. When I look at the sample recordings you have in this project, then all 3 frames of the messages are modulated on the same 'baseband' frequency in the WAV file. With this I mean that if I look at the spectral content of the samples, then the 3 subsequence frames 'beep' on the same frequency.

I wonder: how do you record this with GQRX given that the 3 successive frames of an actual Sigfox device are transmitted on a different carrier frequency? If you do the demodulation already in GQRX then you end up with 3 different frequencies in the WAV file, and moreover the recordings are not so clean due to the fact that the demodulation is not 100% locked onto the actual carrier frequency.

With the recordings I take using an AirSpy, the renard-phy software detects the correct frequency of the first radio frame but it fails to demodulate it correctly although the signal looks good in the wav file.

Is there any tip/trick you can share to obtain a recording with GQRX that is clean enough to feed into the software? I think I'm missing something obvious...

Thanks, Lieven.

Jeija commented 5 years ago

Hello Lieven,

good and not so obvious question actually, I haven't documented this. The obvious thing you are missing is that I just totally cheated ;)

I modified my Sigfox device (in my case: the Pycom SiPy or the STMicroelectronic's STEVAL-FKI868V2) so that it transmits the uplink frames at a constant frequency. If you're using the Pycom SiPy, you can do this by adding this code to your esp32/main.c in your pycom-micropython-sigfox firmware:

void __wrap_RADIO_change_frequency(unsigned long freq) {
    freq = 868120000;
    __real_RADIO_change_frequency(freq);
}

and then add -Wl,--wrap=RADIO_change_frequency to the LDFLAGS in your esp32/Makefile. For other devices, I'm afraid you will have to figure it out yourself and it might even be impossible, sorry :/

In that case, the solution would be of course to sample to complete uplink band and write some software that detects power bursts in the spectrogram. Whenever you find one of these bursts of signal power at a given frequency, you could mix the signal down to baseband, low-pass-filter it and pass the result on to renard-phy. It should be manageable, but I just haven't had the time to also take care of that...

If renard-phy in your case fails to demodulate the first frame, try to cut out the rest of the audio file so that I just contains the useful signal. You can also debug the demodulation / preamble detection using the -p flag (plot the baseband). UNB demodulation is kind of difficult since even minor carrier frequency offsets (that can occur during the course of a transmission) will result in relatively large (> 90°) phase offsets between subsequent symbols. And there is also certainly a lot of room for optimization in renard-phy...

Regards, Florian

hollie commented 5 years ago

Hello Florian,

The obvious thing you are missing is that I just totally cheated ;)

Allright, makes sense of course :-)

In that case, the solution would be of course to sample to complete uplink band and write some software that detects power bursts in the spectrogram. Whenever you find one of these bursts of signal power at a given frequency, you could mix the signal down to baseband, low-pass-filter it and pass the result on to renard-phy. It should be manageable, but I just haven't had the time to also take care of that...

Indeed, that would be the way to go. In fact, it is probably what Sigfox is doing in the Network Emulator Kit (https://www.sigfox.com/center/download/SIFOX%20network%20emulator%20User%20Guide_0.pdf)

I just wanted to check if I missed something obvious. Apparently I wasn't ;-)

I'll experiment with the sample lengths, and see if I can get a clean capture to get the demodulation working.

Thanks for the time to reply and for the extra information!

Best regards, Lieven.