rs1729 / RS

radiosonde decoding
GNU General Public License v3.0
170 stars 56 forks source link

RTL-SDR vs. HACKRF for RS #21

Closed renochoi closed 3 years ago

renochoi commented 4 years ago

Greetings,

I've been trying to receive RS41 signal with RS/rs41. With Daniel Estevez describes, it was successful to get (basic) telemetry and PTU info as follows,

(base) OFRDs-MacBook-Pro:rs41 ofrd$ rtlfm -f 405e6 -g 20 -s 48e3 - | sox -t s16 -r 48e3 -c 1 - -t wav - lowpass 2800 | ./rs41ptu --ecc --crc --ptu Found 1 device(s): sox WARN wav: Length in output .wav header will be wrong since can't seek to fix it 0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM Found Rafael Micro R820T tuner Tuner gain set to 19.70 dB. Tuned to 405252000 Hz. Oversampling input by: 21x. Oversampling output by: 1x. Buffer size: 8.13ms Exact sample rate is: 1008000.009613 Hz Sampling at 1008000 S/s. Output at 48000 Hz. sample_rate: 48000 bits : 16 channels : 1 samples/bit: 10.00 512,R2521089,Sa,2020-05-09, 08:50:59.000, 0.00000, 0.00000, 0.00, 0.0, 0.0, 0.0, -273.1, -1.0,# [00000] 513,R2521089,Sa,2020-05-09, 08:51:00.000, 0.00000, 0.00000, 0.00, 0.0, 0.0, 0.0, -273.1, -1.0,# [00000] 514,R2521089,Sa,2020-05-09, 08:51:01.000, 0.00000, 0.00000, 0.00, 0.0, 0.0, 0.0, 24.7, 60.6,# [00000] 515,R2521089,Sa,2020-05-09, 08:51:02.000, 0.00000, 0.00000, 0.00, 0.0, 0.0, 0.0, 24.7, 60.0,# [00000]

Then, I move onto HackRF to do the same and failed so far,

(base) OFRDs-MacBook-Pro:rs41 ofrd$ hackrftransfer -r - -f 405e6 -g 20 -s 48e3 | sox -t >s16 -r 48e3 -c 1 - -t wav - lowpass 2800 | ./rs41ptu --ecc --crc --ptu sox WARN wav: Length in output .wav header will be wrong since can't seek to fix it call hackrf_set_sample_rate(48000 Hz/0.048 MHz) call hackrf_set_freq(405000000 Hz/405.000 MHz) Stop with Ctrl-C sample_rate: 48000 bits : 16 channels : 1 samples/bit: 10.00 5.5 MiB / 1.005 sec = 5.5 MiB/second 5.8 MiB / 1.003 sec = 5.7 MiB/second 5.8 MiB / 1.000 sec = 5.8 MiB/second 5.5 MiB / 1.005 sec = 5.5 MiB/second 5.8 MiB / 1.001 sec = 5.8 MiB/second 5.5 MiB / 1.001 sec = 5.5 MiB/second 5.8 MiB / 1.004 sec = 5.7 MiB/second ^C 1.3 MiB / 0.220 sec = 6.0 MiB/second

Exiting... Total time: 7.24040 s hackrf_stop_rx() done hackrf_close() done hackrf_exit() done fclose(fd) done exit

It is still not clear whether I post this issue either here or mossmann/hackrf. Should anyone have similar experience or comments on this matter, please give me a shout.

Ta, Reno

rs1729 commented 4 years ago

Don't know the HackRF. Perhaps only the IQ channels are swapped such that the polarity is changed? Try also option -i. Or maybe there is some frequency offset. Can you upload a short output of "hackrf_transfer -r - -f 405e6 -g 20 -s 48e3", 10 seconds should be enough.

What does hackrf_transfer output, raw IQ samples or FM-demodulation?

EDIT: My first impression is that hackrf_transfer outputs IQ data. Don't see FM-demodulation option. You can try to output in a file with wav-header (have seen this option). If it is IQ-data, you have to do FM-demodulation, or you can use the decoder in https://github.com/rs1729/RS/tree/master/demod/mod It has better performance anyway. And you can decode IQ-data directly, also raw IQ-data without wav-header, so you don't need sox.

If it is 8bit IQ-output (as I assume) you could try something like: hackrf_transfer -r - -f 405e6 -g 20 -s 48e3 | ./rs41mod -v --IQ 0.0 - 48000 8 "- 48000 8" means: raw iq-data (2 channels, no wav header), 48k sample rate, 8bit samples.