hackrf icon indicating copy to clipboard operation
hackrf copied to clipboard

Detecting Pulsed Signals with hackrf_sweep - Understanding Timing and Sample Collection

Open UnseenBanana opened this issue 5 months ago • 5 comments
trafficstars

What would you like to know?

I'm trying to detect several pulsed signals using hackrf_sweep but they're not appearing in my spectrogram output. I suspect this might be related to timing mismatches between my pulse characteristics and hackrf_sweep's sampling behavior, so I'm trying to understand exactly how the sweep process works.

Context:

  • I have pulsed signals that I wish to capture in my spectrogram
  • For additional context, each pulse is about 0.5 ms, and repeats every 150 ms. BUT, I want this to work with pulses that have different durations and periods as well
  • The command I used is hackrf_sweep -f 5000:6000 -a 1 -l 24 -g 24 -B

My Understanding So Far:

  1. The sweep is initialized with hackrf_init_sweep() and parameters are sent to firmware via USB control transfer (HACKRF_VENDOR_REQUEST_INIT_SWEEP)
  2. Firmware takes control of frequency changes and continuously streams data to the rx_callback function
  3. The rx_callback processes the data stream and outputs it according to the specified format

Specific Questions for Pulsed Signal Detection:

  1. FFT Processing and Timing:

    • How long does hackrf_sweep dwell at each frequency step?
    • With my 0.5ms pulses every 150ms, what's the probability of capturing a pulse per frequency step?
    • Is each FFT window computed from a single time snapshot, or averaged over multiple captures?
  2. Output Format Understanding: In hackrf_sweep.c, I see the FFT output is written in offset chunks:

    // First chunk
    fwrite(&pwr[1 + (fftSize * 5) / 8], sizeof(float), fftSize / 4, outfile);
    // Second chunk
    fwrite(&pwr[1 + fftSize / 8], sizeof(float), fftSize / 4, outfile);
    
    • Are these chunks in correct frequency order for spectrum analysis?
    • Could short pulses be getting lost in the FFT averaging process?
    • This relates to issue #412 point 2: do I need to reorder these chunks to get a coherent spectrum? If this point has already been answered, please let me know where I can find the answer too!
  3. Optimization for Pulsed Signals:

    • Would increasing dwell time (reducing sweep speed) improve pulse detection?
    • Are there better alternatives to hackrf_sweep for intermittent pulsed signals if I wish to cover large frequency ranges (like 5-6 GHz)?

My Concern: I suspect my pulsed signals might be averaged out by the FFT process, and understanding hackrf_sweep's exact timing and sample collection behavior will help me determine if the issue is timing-related or if I need a different approach entirely.

Any insights into these timing relationships and suggestions for optimising pulsed signal detection would be greatly appreciated!

UnseenBanana avatar May 29 '25 11:05 UnseenBanana