We seek to understand and document all radio transmissions, legal and otherwise, as part of the radio listening hobby. We do not encourage any radio operations contrary to regulations. Always consult with the appropriate authorities if you have questions concerning what is permissible in your locale.

Author Topic: Software Phasing with your SDR  (Read 15618 times)

Offline ChrisSmolinski

  • Administrator
  • Marconi Class DXer
  • *****
  • Posts: 31105
  • Westminster, MD USA
    • View Profile
    • Black Cat Systems
Software Phasing with your SDR
« on: November 26, 2016, 1729 UTC »
A few months ago, I picked up an AFE822 dual channel SDR, one of the reasons was to experiment with using it as a phaser for MW DXing.  It was a bit of a daunting task, having to essentially write an entire SDR app. I then realized I could instead write a "black box" app that sat between the SDR and the SDR app, which would take the pair of I/Q channels from the SDR, and adjust their relative amplitude and phase, and combine them into a single I/Q channel, and send that on to the SDR app. I played around a bit with that, and was quite impressed with the results. I passed on the general idea to the author of SdrDx, who has implemented it in a beta of the app, which is nice because now it is all self contained, rather than having to use my kludgy app in the middle  ;D

There's gain adjustments for each RF input, as well as a phase control, an invert switch to flip the phase 180 degrees, and switches to zero either of the RF inputs, useful when first roughly setting up the gains.

I am quite impressed with how well it is working. As an example, here is a recording of 1680 AM from earlier this morning. I toggled the invert on the phase control a few times, so you can hear reception flip between the two dominant stations on that frequency.

https://s3-us-west-1.amazonaws.com/contattafiles/tnt6387/3lpGJfIiOM4z7AM/phasing1680.mp3

This is going to be really nice for MW DXing. SdrDx is for both Windows and the Mac. If you've been considering getting an SDR, this feature alone in SdrDx is reason enough to get an AFEDRI AFE822. If you do buy one, be sure to let Alex of AFEDRI know the reason is because of SdrDx, we need to support the authors of third party SDR apps we use, and let the hardware manufacturers know how important they are.

The URL for the SdrDx page is http://fyngyrz.com/?p=915

The download link for the beta (Mac only right now, once this is confirmed to be working well, I am sure he will update the Windows version) is http://fyngyrz.com/beta.zip
« Last Edit: November 27, 2016, 1314 UTC by ChrisSmolinski »
Chris Smolinski
Westminster, MD
eQSLs appreciated! csmolinski@blackcatsystems.com
netSDR / AFE822x / AirSpy HF+ / KiwiSDR / 900 ft Horz skyloop / 500 ft NE beverage / 250 ft V Beam / 58 ft T2FD / 120 ft T2FD / 400 ft south beverage / 43m, 20m, 10m  dipoles / Crossed Parallel Loop / Discone in a tree

Offline ChrisSmolinski

  • Administrator
  • Marconi Class DXer
  • *****
  • Posts: 31105
  • Westminster, MD USA
    • View Profile
    • Black Cat Systems
Re: Software Phasing with your SDR
« Reply #1 on: November 26, 2016, 1747 UTC »
Chris Smolinski
Westminster, MD
eQSLs appreciated! csmolinski@blackcatsystems.com
netSDR / AFE822x / AirSpy HF+ / KiwiSDR / 900 ft Horz skyloop / 500 ft NE beverage / 250 ft V Beam / 58 ft T2FD / 120 ft T2FD / 400 ft south beverage / 43m, 20m, 10m  dipoles / Crossed Parallel Loop / Discone in a tree

Offline ChrisSmolinski

  • Administrator
  • Marconi Class DXer
  • *****
  • Posts: 31105
  • Westminster, MD USA
    • View Profile
    • Black Cat Systems
Re: Software Phasing with your SDR
« Reply #2 on: November 26, 2016, 1858 UTC »
How to use the phasing adjustment with SdrDx, an AFE822 SDR, and your Mac.

Download the Mac beta (Windows version coming soon) of SdrDx: http://fyngyrz.com/beta.zip
If you have not used SdrDx before or recently, first download the stable version, and run that: http://fyngyrz.com/SdrDx-AA7AS-Light.zip
SdrDx page: http://fyngyrz.com/?p=915

Familiarize yourself with SdrDx if you have not used it before. You need two antennas of course, one plugged into each of the AFE822 inputs.

To use phasing:

Click on the PHA button, turn on Dial Channel Phasing Mode. Click OK to close the window.

Click the Run button to get the SDR into Run mode. Tune in whatever MW frequency you want to use. Ideally one with two stations you can hear at the same time. Graveyard channels are great for this. Be sure to put the SDR center frequency offset from that. For example if you want to null 1300 AM, make the center frequency 1305 or something like that. Or the I/Q imbalance will cause problems.

Click the PHA button to open the phasing window again. You want to keep it open now.

Make sure the Invert checkbox is off, the Both Channels On radio button is on. Set the Phase slider to the middle, both Gains to zero, far left.

Adjust the first Gain slider to bring the signal level up to a reasonable level. S9. S9+10, whatever you want. Make a note of it.

Click Chan A Muted

Now adjust the second Gain slider to bring the signal level up to where it was before with the first RF input.   The goal here is to make the signal levels about the same, so you can begin the process of nulling out one of the stations, with some chance of it working.

Click Both Channels On now, so you have both RF inputs active.

Adjust the Phase control, until you notice a dip in the signal strength. Try to get it centered in the dip as close as possible.

Then adjust one of the gain sliders, I usually use the one with the largest value to make things easier, to increase the dip in the signal strength.

Then go back to the Phase control, and try to increase the dip. You may now notice the dominant station starting to be nulled, by listening to it.

Then, like washing your hair, lather, rinse, repeat. You have to iterate back and forth many many times. Eventually, if your two antennas produce different enough signals for the two stations, you will be able to null it out. There are cases where you cannot null out one station, because the antennas produce the same signal for both of them. So nulling out one also nulls out the other. But this is rare.

You can click in the invert checkbox, and reception should switch to the other station. Listen to some of my recordings to hear this in action. You are changing the phase by 180 degrees when you do this.


Chris Smolinski
Westminster, MD
eQSLs appreciated! csmolinski@blackcatsystems.com
netSDR / AFE822x / AirSpy HF+ / KiwiSDR / 900 ft Horz skyloop / 500 ft NE beverage / 250 ft V Beam / 58 ft T2FD / 120 ft T2FD / 400 ft south beverage / 43m, 20m, 10m  dipoles / Crossed Parallel Loop / Discone in a tree

Offline skeezix

  • Global Moderator
  • Marconi Class DXer
  • *****
  • Posts: 5544
  • Minneapolis, MN
  • What does 'RNO stand for?
    • View Profile
Re: Software Phasing with your SDR
« Reply #3 on: November 27, 2016, 0257 UTC »
This is great. Mine is on the way and this will be one of the first things that will be used.


Minneapolis, MN

Offline ChuckConner

  • Newbie
  • *
  • Posts: 15
  • Central Texas
    • View Profile
Re: Software Phasing with your SDR
« Reply #4 on: November 27, 2016, 0334 UTC »
This is a very exciting development, Chris (and Ben).   A while back I was considering dual receiver options so I could experiment with diversity reception.   I wound up ordering a LimeSDR which I hope will be usable for similar purposes.   I have at least another month to wait before the LimeSDR's start shipping.   If I understand correctly, it appears that SdrDx can't support LimeSDR (not sound card-based).   I am holding out hope that perhaps Simon Brown, GK4ELI, may add diversity reception capabilities to his SDR-Console application.   He has been a major LimeSDR proponent and certainly has the skills.

If appropriate support for the LimeSDR does not materialize quickly, I will probably order a dual-receiver Afedri and sell the LimeSDR!
Chuck Conner
Texas Hill Country
Elad FDM-S2, Airspy/Spyverter, Funcube Dongle Pro Plus, Drake R8
Wellbrook ALA1530LNP, RA0SMS mini-whip active antenna, MFJ-1026

Offline ChrisSmolinski

  • Administrator
  • Marconi Class DXer
  • *****
  • Posts: 31105
  • Westminster, MD USA
    • View Profile
    • Black Cat Systems
Chris Smolinski
Westminster, MD
eQSLs appreciated! csmolinski@blackcatsystems.com
netSDR / AFE822x / AirSpy HF+ / KiwiSDR / 900 ft Horz skyloop / 500 ft NE beverage / 250 ft V Beam / 58 ft T2FD / 120 ft T2FD / 400 ft south beverage / 43m, 20m, 10m  dipoles / Crossed Parallel Loop / Discone in a tree

Offline Josh

  • DXing Phenomena
  • *******
  • Posts: 4322
    • View Profile
Re: Software Phasing with your SDR
« Reply #6 on: November 29, 2016, 2211 UTC »
I wonder if this could be used to df?
We do not encourage any radio operations contrary to regulations.

Offline Token

  • Global Moderator
  • DX Legend
  • *****
  • Posts: 2118
    • View Profile
Re: Software Phasing with your SDR
« Reply #7 on: November 30, 2016, 1901 UTC »
I wonder if this could be used to df?

Probably.  However, it might not be straight forward.  Off the cuff here, and just throwing out things as they pop in my head.  Also keep in mind I have not tried this software yet, so some of this is guess work on how it might all function.

The best situation would be two small horizontal footprint identical antennas.  Call it two multiband verticals, or maybe two mag loops.  For argument and ease of example lets say this is two antennas spaced 50 meters apart and on a North / South line with antenna A (channel A in the software) at the North end and antenna B (channel B in the software) at the south end

The beam from an array of two such antennas is going to be pretty broad, with a not very well defined peak.  However the null should be much more sharply defined.  This means to me that DFing using the null instead of the peak would yield better results, assuming you have enough signal strength to do this.

If the feedlines are matched phased lengths (regardless of physical length, but with matched phase delay through the pair of feedlines) then a bearing perpendicular to the plane of the two antennas would yield 0 degrees of phase difference, with the antenna configuration I stated above and since this is only two antennas this would be bidirectional, meaning it could be either 090 or 270 degrees, with no way to be sure which.  But remember what I said about the null being sharper.

I think that means that if you put in 180 degrees of phase difference between the two channels of the SDR then you would generate a null that was perpendicular to the N/S line defined by the antennas, or now “point” the two  main nulls on 090 or 270 degrees bearing.

The perpendicular case is easy, because that is always a 0 degree phase difference signal on arrival. Anything off perpendicular is more complex.  If the two antennas are spaced exactly ½ wavelength apart  then the parallel, or end fire situation, is also pretty easy to define.  A signal arriving from a bearing in line with the two antennas will be 180 degrees delta between the two channels.  So 0 degrees of phase shift between the two SDR channels would place the null on the 000 / 180 line, and as shown above 180 degrees of phase shift would place the null along the 090 / 270 line.  So now, for this specific physical setup you can calculate any point around the circle.  For example with a phase shift in software of antenna A leading antenna B by 90 degrees in phase the nulls would be shifted to the 045 / 225 bearing lines.

But that easy math only applies if the two antennas are physically ½ wavelength apart and if the two feedlines are phase matched.  And of course wavelength and phase length depend on frequency.  So the electrical delay relationship between the two antennas and the relative phase length of the feedlines will change as you change frequency.

It should be relatively simple (a small matter of software, says the hardware oriented guy) to do automatic calculations based on known values.  For example assume that the feedlines are the same physical length and type of coax, in fact make that a requirement.  That removes that feedline variable from the equation.  Then if the spacing  of the antennas is known and the orientation of the antennas is known, the phase relationship for any given bearing on any frequency can be calculated.  That could be used to “steer” the null to any given bearing pair.

Now, the next step in thought.  Once you can control the null (or peak, if you want) to a known point what else can you do?  If you now cycle the phase relationship from zero to max +phase, back to zero, to max –phase, and back to zero, you have just “scanned” the beam (or null) in a full circle.  If you plot the amplitude of a given signal (and if there is only one signal on frequency) while scanning this circle you could plot what is basically the beam pattern of your two element array, and the peak of the pattern would point towards (and away) the signal source.  If you offset phases so that you are plotting the null then the null will point towards (and away) the signal source.

Next step in thought.  Once you can control the beam in this way and plot the results, electronically spin the array quickly and plot the results on a circular PPI like display.  Presto, you have a real time PPI or compass rose that can indicate direction of arrival.

Just some quick thoughts.

T!
« Last Edit: November 30, 2016, 1913 UTC by Token »
T!
Mojave Desert, California USA

Offline Josh

  • DXing Phenomena
  • *******
  • Posts: 4322
    • View Profile
Re: Software Phasing with your SDR
« Reply #8 on: November 30, 2016, 2008 UTC »
All what Token said. Plus, since we have a few zillion transmitters out there on ambc/hf that we know the precise location of, one could always test and adjust their df lashup bearings.

As the asm guys like to say, "code can do anything", as well as "it's only code".
We do not encourage any radio operations contrary to regulations.

Offline Billy the Mountain

  • Jr. Member
  • **
  • Posts: 46
  • MO
    • View Profile
    • Email
Re: Software Phasing with your SDR
« Reply #9 on: November 30, 2016, 2306 UTC »
. . .and if two aerials are good, four are definitely better.  More complicated?  Yes, but moah bettah.

A pair of guys in my QRP club build and electronically steered RDF unit for 2 meter rabbit hunts with 8 1/4-wave whips mounted on a frame that could be magnetically mounted to the roof of a vehicle.  They did this about 10-15 years ago, so there wasn't a lot of DSP software that they were using, it was more electromechanical, but it was still pretty slick. 

Of course, that's a somewhat easier case, given a very narrow RF bandwidth.
--
Somewhere in MO.
TR7/Sony 2010/SDRPlay/40m dipole/Various other aerials.
Ubuntu 14.04, FreeBSD 10.2, why am I putting OSs in my sig?

Offline skeezix

  • Global Moderator
  • Marconi Class DXer
  • *****
  • Posts: 5544
  • Minneapolis, MN
  • What does 'RNO stand for?
    • View Profile
Re: Software Phasing with your SDR
« Reply #10 on: December 01, 2016, 0115 UTC »
Some 25 years ago when I was talking flying lessons, the aircraft (Cessna 172) had an ADF in it. It had a loop antenna under the aircraft and a ~15' wire antenna for the sense antenna on top. The loop gets the figure 8 pattern and adding in the sense antenna turns it into a cardioid and removes the ambiguity.

Much better explanation:
http://www.aviationpros.com/article/10388955/automatic-direction-finders-the-grandfather-of-all-radio-navigation-aids

Today, I have a Collins ADF downstairs that I got from a friend that was upgrading his avionics. This one only has one pod for the antennas. It has three coax going to it, so there's something more than one loop in there, but I'm not sure exactly what. Its sealed & I will not pry it open, lest I break it. Its fully functioning & waterproof, and I want to keep it that way. Maybe even some day put it in the car.

I always loved the ADF, even though other nav equipment was more accurate & easier to use. LORAN-C was around, but we only had one aircraft with that and I didn't fly that one. GPS was not yet certified, but it did exist (and it had the purposefully degraded signal). A friend of mine is taking flying lessons today and I ask him about what they use. He said they have no ADF. That is a pity, as its great to tune in music while flying. Nav stations and their incessant beeping gets annoying.

Can two antenna be used for DF? I agree with Token, probably. Going to figure that out. And from what I've read about phasing, its best to have two antennas that are the same, ideally omni. I currently have an omni and a N-S loop. Some directions phasing works great, other directions, not at all (because the loop doesn't do well in picking up station E-W of here so there little to no signal to cancel out the signal from the other one). And I put absolute zero thought in coax length from the antenna to the radio, figuring that's what the phaser & its knobs were for. But that too shall be seen. Two crossed loops perhaps, plus the omni? A couple of loops or other directionals? Been wanting to try a pair of D-KAZ's and phase them for steering, but now with this SDR, can we do that mathematically instead of physically/electrically? And what actually are ideal antennas for phasing, DF, other?

Now my curiosity is piqued - what did Collins do for their antenna to need only one unit? Still won't disassemble it, but will research this thing. Oh my... use that antenna on the AFE822? What a truly fascinating idea. This weekend can't get here soon enough. Good thing I have Friday off.

Will have to refresh my memory about ADFs and experiment with the AFE822. Which is now sitting right next to me.  ;D

This is going to be a whole lot of fun.
« Last Edit: December 02, 2016, 0135 UTC by skeezix »
Minneapolis, MN

Offline ChuckConner

  • Newbie
  • *
  • Posts: 15
  • Central Texas
    • View Profile
Re: Software Phasing with your SDR
« Reply #11 on: December 01, 2016, 0405 UTC »
Great video, Chris!   Could you tell us what antennas were used for that demonstration (were they identical, etc.)?
Chuck Conner
Texas Hill Country
Elad FDM-S2, Airspy/Spyverter, Funcube Dongle Pro Plus, Drake R8
Wellbrook ALA1530LNP, RA0SMS mini-whip active antenna, MFJ-1026

Offline ChrisSmolinski

  • Administrator
  • Marconi Class DXer
  • *****
  • Posts: 31105
  • Westminster, MD USA
    • View Profile
    • Black Cat Systems
Re: Software Phasing with your SDR
« Reply #12 on: December 01, 2016, 1118 UTC »
The antennas I used were not identical, they were as close to different as possible :)   I used my 670 ft sky loop antenna, and 500 ft beverage.
Chris Smolinski
Westminster, MD
eQSLs appreciated! csmolinski@blackcatsystems.com
netSDR / AFE822x / AirSpy HF+ / KiwiSDR / 900 ft Horz skyloop / 500 ft NE beverage / 250 ft V Beam / 58 ft T2FD / 120 ft T2FD / 400 ft south beverage / 43m, 20m, 10m  dipoles / Crossed Parallel Loop / Discone in a tree

Offline Token

  • Global Moderator
  • DX Legend
  • *****
  • Posts: 2118
    • View Profile
Re: Software Phasing with your SDR
« Reply #13 on: December 01, 2016, 1818 UTC »
Further thought.

Assuming feedlines are matched, as I did in my previous post,  simplifies things, you just have to know the physical separation of the antennas to calculate maximum possible phase delta for any specific frequency.  But what about if the feedlines are not phase matched?

I would think it would be not too difficult in software (again, says the hardware oriented guy) to calibrate the system to “as installed” values.

You have two antennas, A and B.  Two points make a line.  Extend the line off either end and place a signal generator out along that line some distance away, the actual distance does not matter, but I would think you would want it at least as far as the distance between the two antennas, and probably beyond that.  The signal generator is set to CW, and by that I mean real continuous wave, not Morse code, I mean an unmodulated carrier on the frequency of interest.

In software you can tell the phase difference of the received signal between the two sources (antenna A and antenna B), including phase shift for the physical separation and feedline lengths.  If you know the physical separation you can back that value out and you now know the phase difference of the feedlines.  You also now have all the information required to get an angle of arrival for DF purposes.  You could also do this with the source located exactly in the middle between the two antennas, but the math behind the process would be slightly different.

Whichever way you did it you could also use this signal to calibrate the gain values for each antenna, the "in the middle" process might have better results for this aspect.

You could calibrate multiple frequencies across the bands and end up with a lookup table for any frequency you tune to.

Not everyone has a signal generator they can use.  However it would be a relatively easy project to use an AD9850 or 9851 DSS with an Arduino for control to build a simple programmable sig gen .  Total cost in parts would probably be less than $20, and the 9851 is good to 125 MHz, while the 9850 is only 30 MHz.

T!
« Last Edit: December 01, 2016, 1822 UTC by Token »
T!
Mojave Desert, California USA

Offline Token

  • Global Moderator
  • DX Legend
  • *****
  • Posts: 2118
    • View Profile
Re: Software Phasing with your SDR
« Reply #14 on: December 02, 2016, 0357 UTC »
Can two antenna be used for DF? I agree with Token, probably. Going to figure that out. And from what I've read about phasing, its best to have two antennas that are the same, ideally omni. I currently have an omni and a N-S loop. Some directions phasing works great, other directions, not at all (because the loop doesn't do well in picking up station E-W of here so there little to no signal to cancel out the signal from the other one). And I put absolute zero thought in coax length from the antenna to the radio, figuring that's what the phaser & its knobs were for. But that too shall be seen. Two crossed loops perhaps, plus the omni? A couple of loops or other directionals? Been wanting to try a pair of D-KAZ's and phase them for steering, but now with this SDR, can we do that mathematically instead of physically/electrically? And what actually are ideal antennas for phasing, DF, other?

My plan is to try 2 Wellbrook 1530+'s, mounted on rotors.  I currently have one, and have ordered another.  This should make two relatively wide banded antennas that are close in gain and radiation pattern.  And each can be turned independent of the other.

It seems to me when you null using the technique in Chris's video you are steering the "beam" formed by your two antennas, so that one of the two nulls is towards the direction you want to reduce.  I wonder what happens when you combine the electrically steered null with a mechanically steered null?  Using one loop and one other antenna would result in a mismatch in gain when you change the loop direction and get its nulling in the picture, would probably ruin the electronic steering unless you reset gains.  But using two loops... 

I think the process might go something like this.  With one antenna, mechanically turn the antenna and note the nulled direction to the station in question.  Now mechanically turn both antennas 90 degrees from that point, this should make the station maximized on each antenna / SDR channel.  Now null as shown in Chris's video.  Then turn both antennas to the mechanical nulled bearing first noted.  I am thinking that because the relative signal strength, or gain of each channel, is still in the ratio originally set in electronic steering you should get the combined nulling of the mechanical position and the electrical steering.

Maybe.

T!
T!
Mojave Desert, California USA