Dysfunctional Clock-Wired Duel rtl-sdr V3's For Relative Phase Measurement

As described in the rtl-sdr user projects forum, I need to measure the relative phase of two Rx plasma antennas for a test of special relativity.

However, when I install the krakensdr suite, including the GNU Radio block, I get basically noise as the phase difference through time even when the plasma is turned off and the only signals are coming in conventionally (ie: metal traces in the PCB):

Before installing the gr_krakensdr code’s GNU Radio KrakenSDR radio source block, I had succeeded in getting Kraken_DOA’s GUI to report that the sources were in sync. Moreover, they were generating the DOA graph with moderate consistency. I say “moderate” because over time there were such dramatic changes in the DOA graph that it was useless for discriminating even qualitative changes in phase. All I need is to detect qualitative changes in phase since when the plasma antennas are turned on, the theory predicts a rather large phase difference will appear between the plasma antennas. But since I couldn’t get Kraken DOA to stabilize its DOA graph, I couldn’t trust it as a detector of such phase change.

That’s why I resorted to gr_krakensdr: To simplify the system to basically get just Heimdall DAQ data but, presumably, with the advantage of Kraken DOA’s calibration.

Did you adjust the heimdall config file to specify only 2 receivers? I see a lot of “Failed to get IQ Samples” in your error log which means something is not quite right here.

Also I’m not quite clear on how are you getting heimdall to sync during the calibration phase? Do you have a noise source equally distributed to each of your RTL-SDRs for the calibration? And are you manually turning it on during calibration?

I do not have a noise source equally distributed to the RTL-SDRs. I have only a shared clock.

If this is necessary to maintain them in a constant relative phase relationship as a baseline phase difference against which to compare the experimental condition – not even with the clock of one driving the clock of the other – then I’m not going to be able to use this hardware configuration.

PS: Heimdall config file is set for 2 dongles. It did appear to “work” with Kraken DOA’s web gui since it did report not only a sync’ed system but it provided what it thought was a DOA graph:


I’m suprised heimdall synced without a noise source. Basically when you start up two RTL-SDRs their USB samples will be totally out of sync, even if the clocks are connected together.

So you need a noise source running in order for heimdall to be able correlate, and align the samples of the two RTL-SDRs through adjustments of the hardware resampler on the RTL-SDR.

Then once samples are aligned, you can now align the phase of the tuners, which is random upon each start. Again a noise source can be used to correlate, then you can calculate the phase differences, and multiply the IQ data of the second tuner to align the phases.

Heimdall does all this automatically, but it does need that noise source to properly correlate. The noise source has to be almost perfectly evenly distributed to each of the tuners.

I bought a KrakenSDR, modified the rtl_daq.c to turn on the noise source according to the directions for kraken_correlator_test.grc, which I then reduced to just two channels:

I then gathered phase difference information overnight with the following result:

Asided from the rather large change in relative phase over time; at the frequency I selected (103.1MHz) and the 2.5in distance between the antennas, the maximum possible phase difference should have been only 1.25degrees.

If you’re testing the phase of an external signal you need to have the noise source turned off. Turning the noise source on it to confirm the calibration of the KrakenSDR.

I’m surprised by the drift you see though. There will be some drift over time due to thermal changes, but it should not be that large. Also it should recalibrate it every few minutes if the phase is out.

Given two co-located antennas (close relative to the wavelength) the Heimdall DAQ calibration should result in a histogram centered about 0 degrees phase difference as calculated by this block, correct?:

Using a Mini-Circuits 15542 spliltter ZFSC-2-1, fed by a KrakenSDR antenna and, in turn, feeding ch0 and ch1 of the KrakenSDR, the KrakenSDR Cross Correlator block reports, after an initial large change, a relatively constant, non-zero, phase difference (ranging from -180 to 180) that randomly changes between initializations of the Heimdall DAQ software. I’ve tried this with Heimdall DAQ running on my Ubuntu laptop and also on my Raspberry Pi 4 with the stock SD image altered only by this change:

~/krakensdr_doa/heimdall_daq_fw/Firmware$ diff daq_chain_config.ini.default daq_chain_config.ini.2ch.eth
3c3
< config_name = kraken_default
---
> config_name = Custom
9,10c9,10
< num_ch = 5
< en_bias_tee = 0,0,0,0,0
---
> num_ch = 2
> en_bias_tee = 0,0
15c15
< center_freq = 700000000
---
> center_freq = 103100000
24c24
< fir_relative_bandwidth = 1.0
---
> fir_relative_bandwidth = 1
45,46c45,46
< iq_adjust_amplitude = 0,0,0,0
< iq_adjust_time_delay_ns = 0, 0, 0, 0
---
> iq_adjust_amplitude = 0
> iq_adjust_time_delay_ns = 0
51c51
< adpis_gains_init = 0,0,0,0,0
---
> adpis_gains_init = 0,0
54c54,55
< out_data_iface_type = shmem
---
> out_data_iface_type = eth
>

Are you running with the noise source on or off?

Off.

To assure myself that I was pointed at the right binary, I went into ~/krakensdr_doa/heimdall_daq_fw/Firmware/_daq_core/rtl_daq.c and turned on the noise source as per directions for kraken_correlator_test.grc and ran the test in the same way – resulting in the near-zero phase differences between ch0 and all other channels. I then changed it back to off and ran kraken_correlator_test.grc again with all 5 antennas wired to the KrakenSDR, and aligned toward the 103.1MHz broadcast tower (ch0-4 right to left):
image

The cardboard box is intended to avoid the contribution from a metallic surface. In this state, the phase differences from ch0 were all over the map. When, however, I removed the cardboard box and placed the antennas on a metallic surface, the calibration seemed to narrow the phase differences:

image

Presumably this is because the metallic surface acted as a groundplane and provided a better SNR as a result. This is something I’ve noticed with the AD8302: The better the SNR the more it converges on the right phase difference between the channels.

That said, I’m also seeing a lot of:

Failed to put IQ Samples into the Queue
Exception:

Which I suppose could render the KrakenSDR Cross Correlator block less accurate hence the phase less accurate.

To try to address this, I went into the krakensdr_source.py file and increased the Queue(10) to Queue(100) since I’m running this on a laptop (32GB RAM, 4200MHz 4 core geekbench6 mult-core score 4724) . However, I don’t think that change made it into the GnuRadio kraken_correlator_test.grc because even though I altered the exception message to include the size of the queue, that alteration doesn’t show up when the exception occurs. I went through an updatedb to find all places where the KrakenSDR Source file exists and changed ALL of them to have the larger Queue size and deleted all of the corresponding .pyc and .pyo files and ran a make from gr-krakensdr/build (the only place where a rebuild could be run on those files) and still no effect when I restarted GnuRadio and the .grc block.

I’m also occasionally getting:

Exception: could not broadcast input array from shape (65025,) into shape (1048065,)
Failed to write output_items

Yes you definitely do need sufficient SNR. The antennas are designed to work with a ground plane under them, so the cardboard is probably do more harm than good.

If you’re constantly getting dropped IQ samples, increasing the queue size won’t help. When you run the program, can you look at htop and see if all your cores are at 100%?

I’m not sure what the broadcasting shape error is from. My only guess is that your system somehow dropped samples in the middle of a transfer. Can you remind me, are you running the Kraken on your laptop directly or are you using a Raspberry Pi as an intermediate processing device?

Laptop directly. Other than DOA in my car I use the RBPi mainly to assure myself that I haven’t somehow messed up the Heimdall DAQ version running on my laptop.

While running just ch0 and ch1 phase difference (24db SNR):

While running all 5 channels:

PS: rtl-sdrV3 SNR=25.5db with same set up except the GR source source. I maxed out all 3 gains.

Using the above splitter, I think I’ve narrowed down the phase calculation problem to this difference in the daq_chain_config.ini between the 5 channel configuration (which works for finding the phase difference of ~0 between ch0 and ch1) and the 2 channel configuration( which ends up at some random phase difference between ch0 and ch1):

~/krakensdr_doa/heimdall_daq_fw/Firmware$ diff daq_chain_config.ini.5ch daq_chain_config.ini.2ch.eth
3c3
< config_name = kraken_default
---
> config_name = Custom
9,10c9,10
< num_ch = 5
< en_bias_tee = 0,0,0,0,0
---
> num_ch = 2
> en_bias_tee = 0,0
24c24
< fir_relative_bandwidth = 1.0
---
> fir_relative_bandwidth = 1
45,46c45,46
< iq_adjust_amplitude = 0,0,0,0
< iq_adjust_time_delay_ns = 0, 0, 0, 0
---
> iq_adjust_amplitude = 0
> iq_adjust_time_delay_ns = 0
51c51
< adpis_gains_init = 0,0,0,0,0
---
> adpis_gains_init = 0,0
54a55
>

I disconnected all the antennas but the one antenna split between ch0 and ch1, and ran the phase difference GnuRadio grc file test with the above two configurations. Only the 5ch worked as it is supposed to.

It appears that SNR isn’t the source of the difficulty of obtaining a reasonable phase relationship as evidenced by the following screenshots of an experiment comparing the signal splitter using a standard KrakenSDR antenna and the same system substituting a dual antenna PCB with similar SNR.

First the signal splitter experiment showing SNR of about 13.5dB for both channels (in all cases ch0 and ch1 of the KrakenSDR):

The phase difference for the splitter is consistent at around -2 degrees:

Then the dual antenna PCB shows SNR of about 17db (1db difference betweent he channels). There is a pretty much continual Overdrive detected on one of the 2 channels (ch0):

The dual antenna PCB phase difference is consistently about +24 degrees. However when I restarted the HeimdallDAQ I ended up with a different (consistent) phase difference.

I didn’t see any dropped samples during these test.