Vector measurements with the HackRF

27.03.2021 20:09

Over the last year I slowly built up a small, one-port vector network analyzer. The instrument consists of a rtl-sdr USB receiver dongle, the ERASynth Micro frequency synthesizer, an RF bridge, a custom time multiplex board I designed and, of course, a whole lot of software that glues everything together and does final signal processing in the digital domain. In the past months I've written pretty extensively about its development here on this blog and I've also used the system in practice, mainly to measure VSWR and matching networks of various multiband LTE antennas.

The original instrument could perform S11 measurements up to around 2 GHz. However the 2 GHz limit was only due to the E4000 tuner in the rtl-sdr. Since ERASynth Micro can generate signals up to 6.4 GHz and I designed the multiplexer with signals up to 8 GHz in mind, getting measurements at higher frequencies was only a matter of upgrading the receiver. I was tempted to do that since the popular 2.4 GHz ISM band was just out of reach of my measurements. I did a lot of searching around for a suitable SDR that would cover that frequency range. The top of my list was an USRP B200, but amid the lockdowns and the general chaos in international shipping last year I couldn't find a supplier. In the end I settled for a HackRF One.

My small, home-made vector network analyzer, upgraded with a HackRF.

On one hand, moving from the rtl-sdr to HackRF was pretty simple. After I got hackrf_tcp up and running most of my old code just worked. Getting things to work reasonably well took longer though. I lost a lot of time figuring out why the gain in the system varied a lot from one measurement to the other. I would optimize signal levels for best dynamic range, only to try it again next day and find that they have changed considerably. In the end, I found out that the USB hub that I was using could not supply the additional current required by the HackRF. Interestingly, nothing obvious broke with the USB bus voltage wildly out of spec, only the analog performance became erratic.

I wish HackRF came with some hardware settings (jumpers or something) that would allow me to semi-permanently disable some of its more dangerous features. As it is right now I need to use a DC block to protect my multiplex board from a DC bias in case the antenna port power gets enabled by a software bug. I also had to put in a 20 dB attenuator to protect the HackRF in case its pre-amplifier gets turned on, since that would get damaged by the signal levels I'm commonly using.

Error network terms when using Henrik's bridge with HackRF.

Here are the error network terms with the upgraded system. The faded lines are the measurements by Henrik Forstén from whom I copied the RF bridge design. Up to 2 GHz the error terms match pretty well with those I measured with the rtl-sdr. As I noted in my previous blog post, the error terms are a measure of the whole measurement system, not only the bridge. Hence my results differ from Henrik's quite significantly since apart from the bridge his system is quite different.

Unfortunately, my new system still isn't very well behaved beyond 2 GHz. I suspect this has to do with the construction that has a lot of connectors everywhere and RG-316 cables of questionable quality. Every contact introduces some impedance mismatch and in the end it's hard to say what is causing what. I also know that I made an error in calculating the dimensions of the coplanar waveguides on my multiplex board. I'm sure that is not helping things.

Estimated dynamic range of the system.

This is an estimated dynamic range of the vector measurement, using the method described in this post. Let's say it's better than 50 dB below 1.5 GHz and better than 30 dB below 3.5 GHz. It quickly gets worse after that. At around 5.5 GHz I suspect there's some kind of a resonance in the 10 dB attenuator I have on the multiplex board that's made out of 0603 resistors. Beyond that point the signal that passes through the attenuator is stronger than the un-attenuated signal and I can't measure anything anymore.

I really would like to improve the dynamic range in the future. Basically all the practical measurements I did with this system was with the device-under-test being behind a U.FL connector. The problem with that is that the connector introduces a significant mismatch before the device-under-test. You can calibrate this out, but this comes at a cost of the effective dynamic range. Hence it may be true that 30 dB of dynamic range is enough for practical measurements. However as soon as you start moving the measurement plane away from the port of the instrument, you really want to start with as much dynamic range as possible.

I believe most of the total noise in the system now actually comes from the phase noise. Currently the signal source and the receiver use independent clocks and each of those clocks has its own drift and various artifacts introduced by individual phase locked loops. I suspect things would improve significantly if I could run both ERASynth Micro and HackRF from a common clock source, ideally from the ERASynth Micro's low phase noise TCXO. Unfortunately they use incompatible interfaces for reference clock in/out. I need to make an adapter circuit before I can try this out.

In the end, this is all kind of an endless rabbit's hole. Every measurement I take seems like it could be done better and there appears to be a lot of room for improvement. I've already accumulated a wish list of changes for the multiplex circuit. At one point I will likely make a new versions of the bridge and the multiplexer PCBs using the experience from the past year of experimenting.

Posted by Tomaž | Categories: Analog | Comments »

Characterizing the RF Demo Kit

19.03.2021 18:47

The RF Demo Kit is a small printed circuit board with several simple RF circuits on it. There are several variants out there from various sellers. It's cheap and commonly sold together with NanoVNA as a learning tool since it is nicely labeled. Among random circuits like filters and attenuators, it also contains a set of short, open, load and thru (SOLT) standards that can be used for VNA calibration. These are all accessible over U.FL surface mount coaxial connectors.

The "RF Demo Kit" circuit board, NWDZ Rev-01-10.

I've been using the SOLT standards on the Demo Kit for calibrating my home-made vector network analyzer. I've been measuring some circuits with an U.FL connection and I lack a better U.FL calibration kit at the moment.

Of course, for this price it's unrealistic to expect the Demo Kit to come with any detailed characterization of the standards. Initially I just assumed the standards were ideal in my calculations. However I suspected this wasn't very accurate. The most telling sign was that I would often get an S11 measurement of a passive circuit that had the absolute value larger than 1. This means that the circuit reflected more power than it received and that wasn't possible. Hence the calibration must have given my instrument a wrong idea of what a perfect signal reflection looks like.

The "RF Demo Kit" connected to my home-made vector network analyzer.

I suspected that my measurements would be more accurate if I could estimate some stray components of the standards on the Demo Kit and take them into account in my calibration. I did the estimation using a method that is roughly described in the Calibrating Standards for In-Fixture Device Characterization white paper from Agilent.

I did my measurements in the frequency range from 600 MHz to 3 GHz. First I used my SMA cal-kit to calibrate the VNA with the measurement plane on its SMA port. I then measured the S11 of the Demo Kit short standard, using a SMA-to-U.FL coax cable:

S11 for the short standard before port extension.

I used this measurement to calculate the port extension parameters to move the measurement plane from the VNA port to the position of the short on the Demo Kit PCB. I verified that the calculated port extension made sense. Calculated time delay was approximately 0.95 ns. With a velocity factor of 0.7 for the RG-316 cable, this gives a length of 19.9 cm which matches the length of the 20 cm cable I used almost exactly.

S11 for the short standard after port extension.

Using the port extension "unwinds" the Smith chart for the short standard. Ideally the whole graph should be in one spot at Z = 0 (red dot). In reality, noise of the VNA and various other imperfections make it a fuzzy blob around that point.

I then applied the same port extension to the measurement of the open standard. Ideally, this graph should be in one point at Z = infinity (again, marked with a red dot). This graph is still very noisy, like the previous one. However one important difference is that it clearly shows a systematic, frequency dependent deviation, not just random noise around the ideal point. Some calculation shows that this deviation is equivalent to a stray capacitance of about 0.58 pF. The simulated response of an open with 0.58 pF stray capacitance is shown in orange:

S11 for the open standard after port extension.

The Agilent white paper goes further and also estimates the stray inductance of the load standard. This is how my measurement of the Demo Kit load standard looks like with the same port extension applied as before. Again, the ideal value is marked with the red dot:

S11 for the load standard after port extension.

It looks pretty messy, with maximum reflection loss of about -12 dB at frequencies up to 3 GHz. Note that the U.FL connectors themselves are only specified up to about -18 dB reflection loss, so a lot of this is probably due to connector contacts. The white paper describes using time gating to isolate the effect of the load from the effect of contacts, but the mathematics of doing that based on my measurements escape me for the moment. I also suspect that my setup lacks the necessary bandwidth.

I stopped here. I suspect estimating the stray load inductance wouldn't make much difference. Keep in mind that the graph is drawn with port extension in place, which removes the effect of the cable. Hence the circling of the graph must be due to phase delays in the load resistor and the U.FL connector. The phase delay also cannot be due to the short length of microstrip between the U.FL and the 0603 resistor on the RF Demo Kit PCB. That shouldn't account for more than about 15° of phase shift at these frequencies.

At the very least I'm somewhat satisfied that the Figure 7(b) in the white paper shows a somewhat similarly messy measurement for their load standard. I'm sure they were using a much higher quality standard, but they were also measuring up to 20 GHz:

S11 measurement of the load standard from the Agilent white paper (Fig 7b)

Image by Agilent Technologies, Inc.

In the end, here is the practical effect of taking into account the estimated stray capacitance of the open standard when measuring S11 of a device:

S11 measurements calibrated using ideal open or open with stray capacitance.

When the VNA was calibrated with the assumption of a ideal open standard, the log magnitude of the measured S11 went above 0 dB at around 1400 MHz. This messed up all sorts of things when I wanted to use the measurement in some circuit modeling. However, when I took the stray capacitance of the open standard into account, the measured S11 correctly stayed below 0 dB over the entire frequency range. Since I don't have a known-good measurement I can't be sure in general whether one or the other is more accurate. However the fact that the limits seem correct now suggests that taking the estimated stray capacitance into account is an improvement.

Posted by Tomaž | Categories: Analog | Comments »

On fake 50 ohm coaxial cables

03.01.2021 11:50

I guess by now everyone is already aware that cheap no-name items often aren't what they claim to be. I've recently found out that BNC coaxial cables sold as having a 50 Ω characteristic impedance often are in fact 75 Ω. Since this is something that is not trivial for the customer to measure and a 75 Ω cable will sort of work even in a 50 Ω system I guess it's easy for sellers to get away with this kind of scam.

This article goes into the details of how to measure characteristic impedance of a transmission line. I used the Smith chart method. I connected each cable to the (50 Ω) NanoVNA CH0 on one end and a Zref = 50 Ω calibration load on the other end. I then measured S11 over the frequency range from 10 to 200 MHz. NanoVNA was calibrated using the calibration kit that came with it.

I found the point where the S11 plot on the Smith chart crosses the real axis. This is when the cable acts as a quarter-wave transformer. The point on the chart marks the impedance Zt. It is marked in orange on the plots below. Characteristic impedance Z0 of the cable can then be calculated using the following formula:

Z_0 = \sqrt{Z_t Z_{ref}}

The Seafront 100 cm BNC cable sold as "50 Ω Oscilloscope Test Probe Cable Lead" measured 71.1 Ω using this method. The second cable I got in the pair had a bad ground connection and couldn't be measured at all. The reviews on the Amazon product page mention bad mechanical construction of the connectors. The cable has a readable SYV 75--3--2 marking that already raises suspicions that this is indeed a 75 Ω cable.

Label on the Seafront 100 cm cable.

Characteristic impedance measurement of Seafront 100 cm cable.

The Goobay 50 cm BNC cable sold as 50 Ω RG-58 measured 79.6 Ω. This cable in fact has RG58 50 OHM COAXIAL CABLE printed on it. It was either marked incorrectly from the factory or was relabeled later. There is a review on the Amazon product page from R. Reuter that also reports that the cable they received was 75 Ω based on a NanoVNA measurement.

Label on the Goobay 50 cm cable.

Characteristic impedance measurement of Goobay 50 cm cable.

The 60 cm LMR-200 SMA cable that I got with the NanoVNA measures 50.4 Ω. I'm showing it here for comparison with the two results above. The cable construction is not that great - one of the two such cables I got in the kit wasn't crimped properly and the connector fell off the cable after a few uses. However the cable actually has the correct characteristic impedance within a reasonable tolerance.

Characteristic impedance measurement of LMR200 60 cm cable.

I'm curious why this is happening. I'm guessing because 75 Ω cables are cheaper for some reason. Maybe there is a bigger demand for 75 Ω cables for video applications and 50 Ω used in RF systems is more of a niche application? Also the cables I measured didn't have good matching even for use in 75 Ω systems. Maybe they're in fact quality control rejects from a failed factory run? Anyway, it's good to be aware of this practice and double check if using a cable in an application that is sensitive to this sort of thing.

Posted by Tomaž | Categories: Analog | Comments »

About the extra ohm in 50 Ω calibration loads

23.11.2020 19:30

I've recently stumbled upon this thread in the NanoVNA forums. Glen Jenkins points out that the 50 Ω calibration load that was shipped with the NanoVNA measures about 51 Ω on the multimeter. The thread contains quite a few replies that attack or dismiss this concern. It's sad that some see striving for better measurements as pointless for anyone outside of a metrology lab. Anyway, I think the question of why the load does not measure closer to 50 Ω is a valid one. I've written about cheap 50 Ω terminators before, but this story has more to it than someone simply using a standard E24 resistor.

I've found two interesting comments in that thread. Hugen replies that the loads shipped with NanoVNA-H4 are intentionally using a slightly too large resistor to offset parasitic effects at high frequencies. Supposedly they are designed so that the return loss is better than 40 dB up to 1 GHz and better than 30 dB up to 6 GHz. Later David Eckhardt shares some resistance measurements of precision Hewlett Packard calibration kits using different multimeters. Those kits don't measure perfectly 50 Ω at DC either, although it is unclear to me whether that is an error due to inaccurate multimeter measurements, or an intentional design decision.

The no-name SOLT calibration kit.

Earlier this year I bought this no-name SOLT calibration kit for around 50 €. The load from this kit measures 51.3 Ω at DC on my Keysight U1241C multimeter (with the effect of the leads nulled). For comparison, the load that came with my NanoVNA-H measures 51.0 Ω using the same method. My calibration kit also came with recorded measurements of all the included standards that look like they were made on a professional VNA. I have no means of verifying that these measurements are actually correct and have not, say, just been copied from some other more expensive set. Let's just assume they are genuine for a moment.

The load standard came with a 9-point VSWR measurement that looks like this:

VSWR measurement that came with the load standard.

Unfortunately, it's impossible to calculate the full complex impedance of the load back from the VSWR. However, if I take some liberty in choosing the sign of the reflection coefficient and assume that the load impedance only has the real component I can get the following impedance vs. frequency curve for the load that matches the VSWR measurement:

Load standard impedance derived from the VSWR measurement.

The impedance starts above 50 Ω, then dips below and starts rising again toward the high frequencies. The interesting thing here is that if you extend the impedance curve down to DC it indeed crosses the axis at about 51 Ω, just like my multimeter measurement.

Let's say that the shape of this impedance curve is constant, but we can arbitrary choose the starting point at DC. In other words, assume that the shape is due to some unavoidable parasitic effects inside the resistive material, SMA connector or the casing. However we can shift the curve up and down by choosing the dimensions of the deposited resistive trace.

This is how the worst 0 - 6 GHz return loss of the load looks like depending on the choice of the DC resistance:

Worst case return loss versus DC resistance.

As you can see, the optimum choice is right around 51.3 Ω, just like what I actually measured on the load. With DC resistance chosen like that, the load has -30 dB or better return loss from 0 to 6 GHz. The same load with DC resistance chosen to be perfectly 50 Ω would indeed have a better return loss at DC, but it would also have about 3.5 dB worse return loss overall. Hence it would not meet the same return loss specification.

Perhaps this explanation is a bit handwavy. I make some arbitrary assumptions and I've used data from a different calibration kit and not the one that comes with NanoVNA. However it does in principle support what Hugen said in the forum thread. The fact that a load does not measure 50 Ω at DC can be an intentional decision to meet some specification and not a sign of cost cutting or poor engineering.

Posted by Tomaž | Categories: Analog | Comments »

Measuring Henrik's RF bridge

19.11.2020 17:03

I've recently made a copy of a bridge-based directional coupler that was published by Henrik Forstén on his blog. After some difficulties with soldering the components I now have one fully assembled device. The question is of course whether it also functions correctly. Along with his designs Henrik also published the results of some measurements of his couplers with a professional VNA. Unfortunately I don't have access to an instrument like that. Nonetheless I performed some similar measurements with the equipment I have at hand and tried to compare the performance of my copy with the original.

Henrik's RF bridge connected to a NanoVNA-H.

The first test I did was to measure the S-parameters. I replicated Henrik's measurements with a NanoVNA-H. I measured the coupler as a two port device. For each pair of ports I connected one port to CH0 and the other to CH1 while terminating the third port on the coupler with the calibration load that came with the NanoVNA.

Measured gain S-parameters of Henrik's RF bridge.

Ports are numbered as following: 1 - DUT, 2 - IN and 3 - DET.

S12 is the through path from signal generator to the device-under-test. Ideally it should be 0 dB (I think a more correct value to show here would be S21, but Henrik shows S12 - in any case, the difference is minimal). S13 is the coupled path for the reflected wave to the detector. The design of the bridge sets this at -16 dB. S23 is unwanted coupling of the forward wave to the detector. Ideally it should be at minus infinity dB. My measurements are the thicker lines that go up to 1500 MHz (the limit of my NanoVNA). Henrik's measurements with a commercial VNA are the thinner lines. They extend up to 10 GHz so only a small part is shown.

As you can see, the gain measurements match almost perfectly for the small frequency range that I could cover. Directivity (S13 - S23) is better than 25 dB.

Measured reflection S-parameters of Henrik's RF bridge.

The reflection part of S-parameters doesn't match that well. Again, the bold traces that go to 1500 MHz are my measurements while the faded out lines are taken from Henrik's graphs. I'm seeing around 10 to 20 dB worse return loss.

I don't know whether this due to a problem with my measurement or a problem with my bridge construction. On one hand, I suspect that NanoVNA can't compensate for imperfect matching of CH1 in two-port measurements. It implements only one-half of a full two-port VNA and lacks the CH1 reflection measurement it needs to compensate for that. On the other hand, later measurements also show that impedance matching seem to be a persistent problem in my setups.


Next test I did was the same scalar directivity measurement that I did with the "Transverters Store" bridge. I used ERASynth Micro as a signal source connected to IN and a rtl-sdr DVB-T dongle as a power detector connected to DET. I measured the power when the DUT port was terminated with a short and when it was terminated with the calibration load from the NanoVNA set. Estimated directivity was the ratio of these two measurements.

Comparison of the directivity of Henrik's and Transverters store bridges.

Comparing the two bridges it appears that the Transverters bridge has a higher directivity at low frequencies. However above 1 GHz Henrik's bridge works better. Based on the construction of the two devices that kind of makes sense. I'm not sure what's with the directivity spiking up like that at 1500 MHz. Anyway, I don't plan to use this bridge for scalar measurements since I now have a vector setup. I was just curious how it compares to the old bridge.

Assembled rtl-sdr vector measurement setup with Henrik's bridge.

Finally I performed a 1-port short-open-load calibration of my vector measurement setup using the new bridge and the NanoVNA calibration kit. The graph below shows the error network terms that I calculated from the calibration measurements using scikit-rf. Again, Henrik's results are shown as well for comparison.

Error network terms when using Henrik's bridge.

This isn't a comparison of bridge performance but rather of the whole measurement system, since these error terms include the effects of other components as well. Obviously the two systems are completely different in these two cases, but still it gives some idea of how well my setup performs compared to Henrik's home-made VNA.

Note that the directivity in my previous scalar measurement is defined slightly differently than here. It is roughly equivalent to reflection tracking divided by directivity from the error terms graph. Slide 48 in the Agilent Network Analyzer Basics presentation has a good illustration of the meaning of the error terms.

A difference in reflection tracking is expected since my and Henrik's VNA probably have different overall gains in the system. I'm happy that it's reasonably flat, meaning that the losses in the bridge don't increase much towards higher frequencies.

My directivity seems slightly better and this result also shows a peak at around 1500 MHz that I saw in the scalar measurement. Source match is roughly 20 dB worse. This agrees with the NanoVNA measurements that have shown quite a bad reflection loss on all bridge ports and also my previous results showing that overall I have quite bad matching in the whole system. I might experiment a bit with this in the future and try to correct it.

Error network terms when using Transverters bridge.

For another comparison, here are the error terms calculated using the same method, but using the "Transverters Store" bridge. Here the bridge starts attenuating the signal towards higher frequencies, and hence losing the effective directivity. The source match seems to be better at low frequencies though.

In conclusion, my copy of the bridge design seems to work just fine. Its effective directivity is around 25 dB in the range I was able to measure. The multiplex board doesn't seem to affect it much and the only problem seems to be relatively poor 50 Ω matching, but that might be because of my other equipment. For low frequency measurements below 1 GHz using the Transverters Store bridge should yield better results. A true test of the new bridge however would be at higher frequencies, beyond the 2 GHz that my current setup is able to handle. The only limiting factor is the rtl-sdr receiver however. I plan to get a better one though in the future and that should enable me to make measurements up to 6 GHz. Judging by Henrik's results the new bridge should handle that as well.

Posted by Tomaž | Categories: Analog | Comments »

Assembling Henrik's RF bridge

15.11.2020 10:54

Last week I wrote some thoughts on the design of a bridge-based directional coupler that was published by Henrik Forstén. I re-drew his Gerber files with some minor modifications so that I could order a copy of the PCB and make a coupler to use with my measurement setup. The PCBs and the rest of the components arrived as planned and I spent a morning assembling everything together. As I suspected, it was quite a challenging soldering job. Here are some notes on how it went.

Bare printed circuit board for the RF bridge before assembly.

I ordered the PCBs at AISLER. I was surprised to see that they arrived in a little extra breakaway frame you can see above. The width of the PCB is right at the 15 mm limit of what they accept for manufacture, so the frame might be related to that. Or it might be to protect the thin and fragile-looking board from damage during shipping? In any case, all the PCBs arrived in good condition. Unfortunately, the breakaway tabs were again right at the spots where edge-mounted SMA connectors go, so some sanding was necessary after removing the frame.

Fully assembled RF bridge circuit board.

Soldering the components on the PCB was really tricky - it's a hellish combination of tiny 0402 components, large thermal mass of the SMA connectors and a coax cable with a heat-sensitive insulation. I did it all with my soldering iron and rosin-core Sn-Pn solder. Hot air seemed like a bad choice because it would be hard to avoid heating up the coax too much.

I soldered components in the following order:

  1. Tack each SMA connectors in one spot just to hold it in place. This is because if any solder gets (accidentally) deposited onto their footprints it's hard to fit them on the edge of the board.
  2. Solder all the 0402 resistors.
  3. Solder the coax cable on three spots, leaving only the ground/shield connection at the IN port unsoldered and unconnected. After the shield makes contact to the ground at that point it's impossible to measure with a multimeter if the R3, R4, R5 and R6 are correctly soldered.
  4. Finish up soldering of the SMA connectors.
  5. Verify that all legs of the bridge have their expected resistances, fix anything that's wrong.
  6. Solder the shield of the coax to the ground plane, verify that there is no short between coax core and shield.

Soldering 0402 parts requires a very fine soldering iron tip, however that will not have enough power to heat up the connector and the ground plane. Hence I ended up exchanging tips a few times during assembly. I also adjusted the temperature of the iron as low as I could get it while still melting the solder each time I was doing anything in proximity to the coax cable.

I still messed up the coax once and had to start over. Henrik lists RG-405 coax in his BOM, but I couldn't get this type for a reasonable price and used a type that looked similar. This one has FEP insulation and isn't as heat sensitive as some other cables I've worked with, but it will still soften and melt through if you're not careful.

Positions and values of resistors on the RF bridge board.

The spot that gave me the most trouble is the gap where R3 and R4 are placed. Here you have two tiny chips between two huge blobs of solder - the coax shield on one end and the SMA connector shield on the other. I was constantly getting a short with a solder bridge over the gap and the resistors simply floating away on the melted solder. Any solder bridge at that point is hard to remove since it's hard to melt both ends at the same time and not ruin the coax in the process. It took a lot of tries to get to something that wasn't absolutely terrible.

If I would be redoing the PCB I would leave a bit more space for R3 and R4. I had no such problems with R5 and R6 which only have one end embedded in the blob that's holding the coax shield. Also, there's really not enough space to properly land the coax core onto the PCB trace. On the input side the best I could do was to solder the core directly onto the connector pad. On the other side it landed onto the R1. So it would probably be better to leave out the small stubs altogether.

I also suggest changing the connectors to a gold-plated variant. I'm not sure if mine were dirty, but I had problems getting the solder to properly wet their pins. I had no such problems with similar, gold-plated ones on the multiplex board.

A minor thing that bothers me is that ferrite cores are just rattling around. By the ludicrous amount of packaging Mouser put them in for shipping I suspect they get chipped easily. Replacing them would be a nightmare. I'll probably make a small enclosure that will fit snugly over the cut-out to hold the rings and protect them.

In conclusion, assembling these bridges isn't simple. As promised, I've published my modified designs if you want to make your own. After some initial experiments I'm very happy with my copies. I'll publish some measurement results later, but so far they seem to behave very similarly to what Henrik's measurements show.

Posted by Tomaž | Categories: Analog | Comments »

NanoVNA-H output signal level

11.11.2020 19:13

When searching the web for the stimulus signal level that is present on port CH0 of NanoVNA, most results seem to refer to the RF output figure given in the User Guide: between -13 and -9 dBm. I've seen posts also specifically claim that NanoVNA is suitable for measuring active components because of the low signal level at which it performs measurements:

"Basic performance" section of the NanoVNA User Guide.

However there seem to be a lot of different NanoVNA variants floating around, differing in both hardware and software. It's always good to double check these things. This is how the output signal of a NanoVNA-H I have (firmware version 0.4.5-1-gfbbceca, PCB revision v3.4) looks on an oscilloscope. CH0 on NanoVNA was connected to a 50 Ω terminated input on the scope. NanoVNA was set to CW stimulus at 1 MHz:

Output waveform of NanoVNA-H CH0 at 1 MHz.

The measured RMS voltage is 326 mV, which is around 3.3 dBm at 50 Ω. Much higher than what is stated in the manual. It falls slightly with frequency. At 10 MHz I've measured 2.8 dBm. This is still uncomfortably high. For example, it will likely damage a HackRF if you tried to measure the return loss of its antenna input. The E4000 tuner in an rtl-sdr has a absolute maximum RF input level of 10 dBm, so strictly speaking it will probably survive. Still, any kind of S11 measurement will show much worse results than in real life for low-level signals since it will overdrive the RF front end of the receiver.

According to this post, some versions allow you to set the signal level from the user interface or by using serial commands. As far as I can see my version only supports the serial command method.

These are the output levels I measured at 1 MHz using different power settings. For some reason the power serial command doesn't work if the NanoVNA is in the CW stimulus mode - the command only had an effect if I sent it when full sweep was enabled on the device. However after the command was accepted, the output power in CW mode was also affected:

serial command RMS voltage [mV] power @ 50 Ω [dBm]
power 0 88.7 -8.0
power 1 173 -2.2
power 2 253 1.1
power 3 324 3.2

From this it seems that power 3 setting is the default at power on. As you can see, there's really not much difference between the settings in the logarithmic scale. Even the lowest setting is still higher than what is stated in the manual. I also wouldn't trust these results too much. From what I read the output power is adjusted relative to output frequency and I can only measure it at the very low end. Hence I don't plan on using NanoVNA for measuring any kind of sensitive components.

Posted by Tomaž | Categories: Analog | Comments »

S21 curves for SMD resistors

09.11.2020 20:19

Some time ago I've stumbled upon the following figure that appears in the Building VNA Calibration Loads video by W0QE. The discussion about it starts around the 13:42 mark. It supposedly comes from some work done at CERN. The "Fig 2" in the caption suggests it appears in a paper, but after searching for it I've failed to find a public source.

S21 curves for 1206 SMD resistors.

Image by W0QE

What this measurement shows is how the impedance of surface mount resistors of different values change with frequency. If the resistors would be ideal all values would have perfectly parallel horizontal lines. However at high frequency the plots for high value resistors curve upwards. The line that they approach asymptotically is one of a 50 fF parasitic capacitor that appears across the resistor. On the other hand, the line for a 0 Ω resistor curves downwards due to parasitic inductance. W0QE discusses the resistor model in more detail, so watch the video for the full explanation.

According to this result the 100 Ω resistor is best at maintaining constant S21 towards high frequencies. This is the base of the argument that making a 50 Ω termination with two parallel 100 Ω resistors is best, and more accurate than using a single 50 Ω resistor or four 200 Ω resistors.

Some thoughts on this: the caption says that S21 curves shown are for 1206 size resistors. Very likely they look differently for other sizes since the parasitics will change with physical dimensions. Hence the optimal choice of a termination resistor might be different if using other sizes.

Another thing that W0QE doesn't mention is that the lines also curve towards the low frequency end of the scale. I suspect this is some kind of a measurement error. I see no reason why a resistor would not have the correct value at DC. This feature also does not appear in W0QE's simulation that is also shown in the video alongside this experimental result.

Anyway, the whole video is well worth a watch. I just wanted to give some more visibility to this particular figure and also have it here for my reference. Since it only appears in a video it's kind of hard to search for it. I already forgot where I saw it once and it's frustrating not to be able to find a thing I know I've seen somewhere when I want to refer to it.

Posted by Tomaž | Categories: Analog | Comments »

Notes on Henrik Forstén's RF bridge

06.11.2020 19:03

For my tinkering with vector signal measurements I've needed a directional coupler. So far I've been using the "Transverters Store" RF bridge for this purpose. Unfortunately I found it to be less than ideal above 1 GHz. Its design also requires the use of a separate, reference 50 Ω load on a SMA connector, which over time proved to be unreliable and an unnecessary source of problems. I've been wanting to replace it with something better. Mini-Circuits ZHDC-10-63-S seems to be a popular directional coupler with good performance, but it's either perpetually out of stock or not shipping to my part of the world.

I've recently stumbled upon Henrik Forstén's blog. He made his own home brew VNA and generously shared all the design documents, including those for his directional couplers. The directivity measurements he posted show that his couplers are significantly better at high frequencies than what I currently have. He saw better than 25 dB directivity at up to 5.5 GHz. Compare this to the Transverters bridge where directivity falls below 25 dB at around 1 GHz. Making my own copies of his couplers seemed like a straightforward way of improving my measurement setup.

A render of Henrik's Gerber files.

Henrik's coupler design is based on a 2015 IEEE article by Drobotun Nikolay and Mikheev Philipp (at the moment, the paper is freely accessible here). Similar to the Transverters board, the principle of operation is a based on a Wheatstone bridge with a balun made from a coaxial cable and ferrite beads. However the bridge topology as well as the balun design are quite different. This balun uses only one coaxial cable instead of two, and interestingly uses 3 different types of ferrites. The 50 Ω reference is integrated onto the bridge itself. The PCB design uses 4 layers. The coupling factor is 16 dB.

At first I thought getting the PCB made would be as simple as zipping up Henrik's Gerber files and sending them off to AISLER. Unfortunately that didn't work out. As much as I fiddled with the Gerber files I couldn't get the AISLER's on-line ordering system to accept them. I tried deleting the "CUTOUT" letters on the board outline layer and it didn't help. In the end it might have been the fact that the board is slightly narrower than the 15 mm minimum.

I ended up redrawing the whole thing in a PCB design program that-shall-not-be-named and making a fresh new set of Gerbers. In the end I think that turned out for the best, because it made me look a bit deeper into this design and do a few modifications.

Approximate trace impedances on Henrik's coupler design.

Henrik had his PCBs made using OSH Park 4 layer service. This process uses a high-frequency, low permeability substrate FR408. My AISLER boards will be made with the 4-Layer HD stackup which uses just plain old FR-4. So when redrawing the designs it occurred to me to also adjust trace widths so that characteristic impedances would stay the same.

One thing I could not figure out were these narrowed sections of the traces around the bridge section. The wider part of the trace is approximately 50 Ω based on OSH Park's process parameters. The narrower part is closer to 75 Ω. I'm not sure why the narrow part is necessary. I can't see it in the figures in the original IEEE article either, although authors don't provide a good picture of the final design so it's hard to say.

The only reason I can think of is thermal relief, to avoid the SMA connectors from sinking too much heat when soldering the resistors and the balun. Since the whole divider part is only around 4 mm across I doubt trace impedances play much role in signal integrity. 1/10 wavelength rule gives a maximum frequency of around 4 GHz for traces without a controlled impedance.

Annotated Figure 3 "Divider model" from Nikolay 2015.

Image by Drobotun Nikolay and Mikheev Philipp (modified)

Where the traces meet the SMA connectors they need to be widened so that the connector pin lands properly. The IEEE article mentions using microstrip tapers for better matching in this part. Henrik's design doesn't use these, however it keeps the connector center pin footprint at about 50 Ω by dropping the ground plane by one layer beneath the footprint.

Another difference I found between the paper and Henrik's design were the resistor values. The paper mentions that the resistor next to the balun needs to be about 10% larger (10.3 Ω) than the theoretical value (9.3 Ω) due to some unspecified effect of the balun. Henrik lists the uncorrected value in his BOM.

Another thing to note about the resistors is that the pads on the PCB fit tiny 0402 size packages. I suspect these will be quite a challenge to solder manually, especially since they're very close to where the coaxial cable lands. Actually, the whole coupler is just 40 x 15 mm - much smaller than it appears on the photos.

3D render of my copy of Henrik's bridge design.

In my modified design I've re-calculated all the trace widths to 50 Ω at AISLER's process parameters and left out the narrowed sections. I also slightly enlarged to board so that it's now exactly 15 mm wide and made sure that it complies with the 0.3 mm edge clearance design rule. I was tempted to switch to larger 0603 resistors, but I'm guessing these come with worse high-frequency response as well, so I left them at 0402. In the end I also added some helpful labels on the silkscreen print layer.

Now I'm waiting for the PCBs to be delivered. Thankfully I didn't have any problems ordering the exact ferrite types. Again I'm really grateful that Henrik went through the trouble of documenting his instrument and publishing the designs. We'll see how well my copies perform. After I assemble one and check that it works reasonably well I plan to also publish my modified Gerbers and BOM for anyone else that wants to make a copy of these devices using a FR-4 process.

Posted by Tomaž | Categories: Analog | Comments »

Vector measurements with the rtl-sdr, 7

16.10.2020 18:44

Looking back at my last few posts I feel that I was going into increasingly theoretic guesswork about the impedance mismatches in my rtl-sdr measurement setup. Even though I still think it could perform better, I would like to share some actual antenna measurements I made with it. I've also now got my hands on a NanoVNA-H, one of the many variants of the popular low-cost vector network analyzer. It's interesting to compare the measurement results between the two instruments.

The collection of antennas I've measured.

Yesterday I've measured the VSWR of a few compact LTE antennas. These antennas have an adhesive backing and are meant to be mounted into mobile devices that use the cellular network for connectivity. All of these antennas come with a coax cable tail that terminates with a female U.FL connector. This was a bit problematic since both my instruments terminate in a SMA connector. So to make a connection I've used a U.FL-to-U.FL "thru" on a RF demo kit PCB I got with my NanoVNA and another short U.FL-to-SMA patch cable.

I've calibrated both my rtl-sdr setup (vect-meas-mux in the following) and the NanoVNA with the short-open-load one port method. I've used the U.FL calibration standards on the same RF demo kit. This resulted in the calibrated measurement plane on the U.FL end of the U.FL-to-SMA patch cable. Hence the measurements include effects of the "thru" and the coax cable tail that was attached to each antenna.

Calibrating the reflection measurement setup.

The vect-meas-mux setup consisted of the ERASynth Micro, rtl-sdr, my custom multiplex board and the Transverters RF bridge as the directional element. It allows measurements up to 2000 MHz, with a gap around 1200 MHz, defined by the rtl-sdr's tuning range. It's the same setup as I described in the past blog posts in this series. The NanoVNA-H was bought from Nooelec and the particular version I have is no longer listed on their website. It shows firmware version 0.4.5-1 and allows measurements up to 1500 MHz. I transferred the S11 measurements from the NanoVNA to the computer using code based on this example notebook and then calculated VSWR from S11.

In the graphs below, the VSWR measured with vect-meas-mux (orange) and NanoVNA (blue) is compared to the VSWR given in the datasheet (black) of the respective antenna. I was mostly interested in how both instruments agree with each other and how well the results were repeatable. The datasheet curve is there as a reference. I wasn't expecting to get a good match. I took care to have a reasonably clean measurement environment: as much open space in all directions around the antenna as possible, antennas mounted on a non-conductive plastic holder, etc. However obviously that can't compare with a measurement in an anechoic chamber and random objects in the vicinity were affecting the results. I also didn't use a choke on the coax tail to prevent it from radiating.

VSWR measurement results for 2JF0624P antenna.

VSWR measurement results for 2JF0924P antenna.

VSWR measurement results for 2JP0424P antenna.

VSWR measurement results for SRFC015 antenna.

I'm pretty happy with how these measurements turned out. The results from my own instrument match those from the NanoVNA quite well. The agreement with the datasheet is often reasonably good as well although, as I said before, that's probably due to my poorly improvised environment around the antenna.

After doing many measurements the main problem with the rtl-sdr method turned out to be its slowness. NanoVNA displays the result nearly instantaneously. On the other hand a 200-point sweep from 55 to 2000 MHz with vect-meas-mux takes around 7 minutes and 30 seconds. Most of this is due to hugely inefficient way I collect signal samples from the rtl-sdr: I run the rtl_sdr binary once for each of the 200 frequency points. This results in the setup and tear down time of the rtl_sdr binary dominating the total run time. I only need to dwell on each point for about 100 ms, which would mean a sweep time of about 20 seconds. I'll probably rewrite my code to use the rtl_tcp server to fetch the I/Q samples, which should reduce the overhead significantly.

In the future I would also like to be able to estimate the error intervals of the measurement, like I did with my scalar experiments. Because this was a vector measurement and I used calibration, the relatively poor directivity of my RF bridge affected the results much less than with scalar measurements. A bigger factor was probably the limited dynamic range of the rtl-sdr. scikit-rf has some support for estimating error intervals, but I still need to figure out how to integrate that with my code.

I'm also looking for extending the frequency range of my measurements, but that will require switching to a more expensive SDR. Perhaps something like the HackRF or an USRP.

Posted by Tomaž | Categories: Analog | Comments »

Vector measurements with the rtl-sdr, 6

06.10.2020 19:58

This is another update on my project where I'm developing a system for vector signal measurements with the rtl-sdr. Back in August I was testing the performance of the time multiplex board I made. One of the more puzzling things I discovered then was that apparently the signal losses in the multiplexer varied a lot with frequency. I measured a dip in signal level of almost 10 dB at 1700 MHz. I expected a mostly frequency-flat characteristic due to attenuation on the PCB and in the MMIC switches.

The unusual variation in measured signal power from my previous experiment.

My first suspicion was that I messed up the design of the grounded co-planar waveguides (GCPW) on the board. After some research however I found conflicting information on that. Some sources say that my design is correct and others say it's not. I also got the impression that even if the trace dimensions I used were slightly wrong, they shouldn't result in the signal losses I was seeing due to relatively short trace lengths.

I currently don't have any professional RF equipment at hand. My gain (i.e. S12) measurements were done by using ERASynth Micro as a signal source and rtl-sdr as the detector. I measured the losses in the circuit board by routing the signal through the board, sweeping the signal in frequency at a constant output power, and recording the received power at rtl-sdr using rtl-power-fftw. I used a measurement of a male-to-male SMA through as a reference in an attempt to subtract any variability of ERASynth's output power and rtl-sdr's sensitivity.

Since I suspected that the variability in the gain I measured might also be due to impedance mismatches I did some further measurements with ERASynth and rtl-sdr to better understand what is going on. These measurements were performed in the same way as my previous one. ERASynth Micro was set to -40 dBm output level and was swept in steps from 55 MHz to 2 GHz. On each step, the rtl-sdr was tuned to the same frequency and the baseband signal power was measured with rlt-power-fftw (RF gain was set to 15 dB).

The picture below shows the six signal paths I measured:

Explanation of measured signal paths.

"thru" measurement was a single rigid male-to-male SMA adapter. "thru3" was a combination of 3 adapters (male-to-male, female-to-female, male-to-male). "gcpw" was a measurement of a single leg of the PCB trace on a spare board where I soldered a SMA connector in place of the switch IC.

During the measurements involving the assembled multiplex board the switches were powered up and configured to allow the signal to pass in the measured direction. Also worth mentioning is that for measurements involving both PCBs, two male-to-male adapters were also in the signal path (one on the ERASynth side, the other on the rtl-sdr side).

Following graph shows the results. In contrast to the graph above from August, this graph is not normalized in any way and shows raw values returned by rtl-power-fftw. The gap between 1100 MHz and 1250 MHz is the band to which rtl-sdr can't tune to. The results for the "ref in - det out" path had +10 dB added on this graph to make it comparable with other traces since this path goes through a 10 dB attenuator on the board.

Measured received power versus frequency for various signal paths.

These results show several interesting things. The first good news is that the two identical paths through both switches show nearly identical results ("ref in - dut out" and "dut in - det out" traces). This is reassuring. It's unlikely that my board isn't soldered well or that I damaged one of the switches.

The other interesting part is that all other traces differ a lot from each other. Even just adding two adapters changes things significantly ("thru" and "thru3" traces). This suggests that the variability I was seeing is due to some mismatch between the ERASynth and rtl-sdr and not the fault in my board.

It's also telling that the only path that involves an attenuator ("ref in - det out") shows the least variability and also seems to be lower or equal to all other traces. The attenuator provides isolation between the source and the load and reduces the impact of their impedance mismatches. It changes the situation from the mismatched load and source (where gain varies with frequency) to a mismatched load and mismatched source separately (where gain does not vary with frequency). Also, in contrast to the GCPW traces, I'm pretty sure I got the 50 Ω impedance of the attenuator correct.

k = \frac{u_{max}}{u_{min}} = 2.5 \qquad [8 \mathrm{dB}]
|\Gamma_g\Gamma_l| = \frac{k-1}{k+1} = 0.43 \qquad [-7.3 \mathrm{dB}]

The measured power in the un-attenuated paths at frequencies above 1 GHz varies for about 8 dB. This translates to a product of reflection coefficients of ERASynth and rtl-sdr of about 0.4 (-7 dB). I don't have any data for ERASynth. The datasheet for E4000 tuner in the rtl-sdr states a typical return loss of 15 dB for a 50 Ω system, but my rtl-sdr has some components in front of the tuner which might make it worse. I measured the return loss of my rtl-sdr at about 11 dB at 70 MHz, so 7.3 dB at 1 GHz combined with ERASynth doesn't sound too much off.

In summary, this all points to the rtl-sdr's poor 50 Ω matching to be the culprit. There are some ways I could make the frequency response flatter. The simplest solution would be adding another attenuator to the board in front of the DET OUT connector. I'm using the lowest RF gain setting on the rtl-sdr so there should be enough reserve in terms of signal level. I don't want to do anything more elaborate like a rtl-sdr specific matching network since I want this board to be usable with other small SDRs as well.

Anyway, I think I'll leave the multiplex hardware as it is for now. I still have some planned improvements on the clock recovery code. I've also found Henrik's blog and his wonderful posts about the homemade VNA. His project is orders of magnitude more advanced than mine, but some of the details he writes about are still very useful for me. Thanks to him I found out about the scikit-rf Python library which I will gladly use instead of my home brew calibration code. I also found his directional coupler design very interesting and I might eventually make a copy of it to replace the RF bridge I'm currently using.

Posted by Tomaž | Categories: Analog | Comments »

Transmission line mismatched on both ends

14.09.2020 20:30

In one of my previous posts I mentioned a result of a RF gain-versus-frequency measurement that looked like a sine wave. I said the sine wave probably means that there is some impedance mismatch in the measured signal path. I wasn't completely sure back then so I did a quick refresh on transmission line theory. Indeed, if you have a transmission line that is driven by a mismatched source and also has a mismatched load on the other end at the same time, the amplitude on the load will vary periodically in relation to the signal frequency.

Consider the following circuit. You have a sine wave source ug with a source impedance that has a reflection coefficient Γg. The source is connected through a transmission line to a load with its own reflection coefficient Γl. The transmission line has a characteristic impedance Z0, length d and propagation speed c. I've also marked the forward voltage wave in the transmission line uf and the reverse voltage wave ur.

Transmission line with mismatched source and load.

We keep the amplitude of the signal source ug constant and vary the frequency. If we measure the amplitude of the signal on the load ul the amplitude will vary with applied frequency in a sinusoid like on the following graph. Note that the horizontal axis is frequency, not time. The vertical axis shows amplitude, not instantaneous voltage:

Signal amplitude on the load versus frequency.

The amplitude on the load ul will show peaks every Δf. At the peaks, the signal will have the amplitude umax and in the valleys it will have the amplitude umin.

It turns out that Δf has the following relation to transmission line length and propagation speed:

\Delta f = \frac{c}{2 d}

This equation can be useful in debugging since it can point to the part of the signal path where the mismatch is happening. For example, if you know the propagation speed it allows you to calculate the length of the mismatched segment.

The ratio of the maximum and minimum amplitude (in linear scale) on the load depends on the reflection coefficients at the source and the load ends of the transmission line:

\frac{u_{max}}{u_{min}} = \frac{1 + |\Gamma_g\Gamma_l|}{1 - |\Gamma_g\Gamma_l|}

This last equation is interesting. At the first glance it makes sense. If either of the ends is perfectly matched (Γg = 0 or Γl = 0), then the ratio is 1 and there is no dependency on frequency. This is the expected result. A transmission line that is mismatched on only one end still has a non-optimal power transfer but the amplitude on the load is constant and doesn't depend on the signal frequency.

A signal flow diagram, similar to the one mentioned in this article, can also be used to verify its correctness.

The equation for the ratio of amplitudes on the load is very similar to the equation for the voltage standing wave ratio:

\mathrm{VSWR} = \frac{1 + |\Gamma_l|}{1 - |\Gamma_l|}

In a VSWR calculation you only have a mismatched load. In the case where you have two mismatched ends, it then kind of makes sense that you multiply both reflection coefficients together.

However if you think about it, it's quite weird that it turns out this way. In the VSWR case you are calculating the ratio of the sum and difference of the forward wave (uf = 1) and the reflected wave (reflected once off the load, hence ur = Γl). Since the source is perfectly matched in that case, the reflected wave doesn't reflect back the second time. It's obvious that the formula for the ratio is this simple.

On the other hand in the case where both the source and load are mismatched, you get an infinite number of reflections. When the source first gets switched on, the first forward wave driven by the source reflects off the load with Γl. When the reflected wave gets to the source it reflects off the mismatched source impedance with Γg and travels back to the load superimposed on the original forward wave. This combination of the signal driven by the source and the first reflection again reflects off the load and so on to infinity. The steady-state amplitude of the signal on the load is the sum of all those infinite reflections.

If you think about it this way, it's surprising that the ratio ends up being this simple equation that is the same as if the signal only reflected once from the load and once from the source.

Posted by Tomaž | Categories: Analog | Comments »

P57 feed-through terminator

26.08.2020 17:57

A quick note about this thing. It's a BNC feed-through terminator I've bought for cheap off AliExpress when I was on a kind of an RF accessory buying binge. After months of shipping delays it recently dropped into my mailbox. This one is marked "P57 load resistor 50 Ω". I've seen very similar looking devices being sold under various other names and brands. I've bought it because my TDS 2002B scope does not have a low-impedance input option.

P57 load resistor

The label says that the terminator is rated from DC to 1 GHz. The analog bandwidth of my scope is only 60 MHz, so that shouldn't be an issue. The DC resistance between signal pin and ground measures exactly 50.0 Ω on my Keysight U1241C. That's a good sign that it doesn't just have a standard carbon 51 Ω resistor inside.

The build quality looks fine at the first glance, although with the plastic body I wouldn't use this where any kind of significant power would be dissipated on the load.

Measured amplitude versus frequency with and without the feed-through terminator.

This is the result of a quick test I did. I connected the ERASynth Micro to the oscilloscope CH 1 over a coax cable. The red plot shows the signal amplitude measured at various frequencies without the terminator (so terminated with 1 MΩ at the scope's probe input). The blue plot shows the amplitude with the cable terminated with P57 on the scope end. The amplitudes were measured with the FFT function and hence only take into account the base frequency, without any harmonics.

The ERASynth Micro was always set to 0 dBm output level. If everything would be perfect, the blue plot would be at -13 dBV and the red plot would be 6 dB higher (twice the amplitude). Falling amplitude beyond 60 MHz is expected because of the limited analog bandwidth of the scope's front end.

I've measured between 8 and 5 dB difference between the terminated and unterminated amplitudes, which seems fine. Or at least not excessively wrong. There's a lot of unknown errors in this measurement. Cable and adapter loss, ERASynth Micro output matching and level accuracy and so on.

In conclusion, it does what it says in the description and seems good enough for my purpose.

Posted by Tomaž | Categories: Analog | Comments »

Vector measurements with the rtl-sdr, 5

18.08.2020 18:01

Here is a quick update on my project to measure the phase of a reflected RF signal using rtl-sdr and what is basically a simple home-brew vector network analyzer. I'm using a cheap RF bridge from eBay as the directional element in the measurement and a board I've developed to multiplex two signals into the rtl-sdr's single ADC. In my last post I've assembled the time multiplex board. I've also shown some basic tests of its performance using the ERASynth Micro microwave synthesizer, such as signal attenuation on the PCB traces and cross talk through the switches. Now I finally have tests to show of the complete vector measurement system, although only in pass-through (i.e. S12) mode without using the reflection bridge.

Multiplex board connected to a rtl-sdr and ERASynth Micro.

To test out if I can correctly measure the phase of the signal using my system, I performed several tests where I connected the DUT IN to OUT with different lengths of a coaxial cable. In theory, different lengths of the cable should introduce different delays into the signal. I should be able to measure the delay as a difference in the phase of the signal arriving into the DUT IN input.

I've swept the frequency of the signal generator from 100 to 1000 MHz, which covers most of the useful region of the rtl-sdr. For each frequency, I performed the vector measurement using the delay-and-divide method I outlined earlier. I ran the test with three lengths of SMA patch cables I had at hand: 15, 30 and 45 cm.

Measured signal amplitude after passing through a coaxial cable.

The measured amplitude in all cases should be around +10 dB. The reference signal, against which the input signal is compared, is attenuated by 10 dB in the multiplex board. Because of this, an unattenuated 0 dB signal passing between DUT OUT and IN compared to a -10 dB reference is seen as +10 dB by my device. I did this to optimize the receiver dynamic range, since many directional couplers and RF bridges have around 10 dB of coupling.

Anyway, this measurement is about what I would expect. For all lengths of cable the mean is around 10 dB. Cable loss is too small to be visible. The variations in amplitude of around ±2 dB depending on the frequency are more than I would like. They are probably because of multiple bad impedance matches somewhere in the signal path. I've also seen these in my previous measurements.

Measured signal phase after passing through a coaxial cable.

This is the phase component of the same measurement. It shows that the input signal lags versus the reference and that the phase difference increases with frequency. It's also clearly visible that the slope depends on the length of the cable. Such a linear phase characteristic is exactly the expected result for a constant signal delay. The phase plot has been unwrapped here using the numpy.unwrap method.

By dividing the measured phase with the angular frequency, the measurement can be shown directly in terms of time delay:

Measured signal delay after passing through a coaxial cable.

This is a very nice result. Each lengthening of the cable by 15 cm increased the average time delay by about 0.8 ns. This gives a relative velocity of propagation through the cable of around 0.63 c, which is a reasonable number. I don't have the exact data for my no-name patch cables. A cable with a solid polyethylene dielectric, typical for low-end cables, has the velocity factor of 0.66. This is close enough to my result and the electrical length of my cables isn't very well defined anyway.

Another interesting thing I can get from these results is the delay for a theoretical cable of length 0 cm. This is the intrinsic signal delay in my system and is about 0.15 ns based on these measurements. This should correspond to the difference in electrical lengths on my multiplex board between the reference signal path and the DUT connector path. If I estimate the velocity factor of the coplanar waveguides to be:

VF = \frac{1}{\sqrt{\varepsilon_r}} = 0.48

This gives a length difference of about 22 mm. This is again a reasonable result. By measuring PCB trace and connector lengths I roughly estimate the real difference to be about 30 mm.

In conclusion, I'm quite happy with these results. They show that my basic time multiplex idea works correctly for vector measurements. As far as the whole system is concerned there are still several rough spots however. Clock recovery code still needs some more polishing since running it on real data revealed some corner cases that didn't show up in simulations. Thankfully I see nothing fundamentally wrong with it as far as I can see and fixing it should be just a matter of writing some better software.

The bigger problem is the bad overall RF performance of the multiplex board. I've discussed before that there seems to be something very wrong with impedance matching which causes large deviations in measured signal amplitude. I still haven't completely figured out what's wrong there. One mistake I did found on the PCB design was that my coplanar waveguides don't have the width much larger than height over the ground plane (see e.g. slide 41 in RF/Microwave PC Board Design and Layout). This is one of the assumptions of the equations for their Z0 I used. This error might be what's causing some of my problems, but fixing it unfortunately means making a new PCB.

Another, even more puzzling problem, is that the RF bridge seemingly loses its directivity when used in this system, even at low frequencies. Since I made this vector measurement system specifically for reflection measurements (S11) this is kind of disappointing. I don't really understand yet why that happens. It's not because of switch cross-talk. I've measured that and it should be negligible. The mismatches on the board also shouldn't be affecting the bridge in this way, especially at low frequencies where they don't have much effect. Scalar measurements work just fine with rtl-sdr and ERASynth Micro. I've also measured that my bridge has reasonable directivity below 1 GHz when used without the multiplex.

Posted by Tomaž | Categories: Analog | Comments »

Vector measurements with the rtl-sdr, 4

31.07.2020 15:29

I'm developing a method for performing vector reflection measurements using a cheap, single channel software-defined radio receiver. To measure the phase of the reflected signal I need to receive two RF signals coherently, a reference and the actual measured signal. I'm using time multiplexing to do that since I'm restricted to only a single analog-to-digital converter. In my last post I've described a circuit I developed that performs the multiplexing in the analog domain. The demultiplexer as well as all other signal processing is done by software in the digital domain.

Time multiplex circuit board assembled and powered on.

I ordered the bare printed circuit boards from AISLER using their 2-layer/HAL surface finish process. This is the first time I've used their service. I was looking to have the boards made in Europe since I'm seeing large shipping delays recently due to COVID-19 (I'm still waiting for some components I ordered from overseas back in April). After looking at a few local PCB prototyping services, AISLER looked like by far the best bet. I got the boards in my mailbox in less than a week for a price that was comparable to ordering them from China.

Between the HAL and ENIG surface finishes offered I decided on HAL since it should have better performance at high frequencies. I also removed the soldermask from the top of the 50Ω coplanar waveguides in an attempt to further reduce the losses. I was pleasantly surprised that AISLER offers precise stackup specifications, including εr. That's something that I've often missed in similar services and it probably made my trace impedance calculations somewhat more accurate. However this wasn't manufactured as a controlled impedance board.

I assembled the boards manually using a hot air station. The boards had some leftovers from panelization breakaways right at the locations of the edge-mounted SMA connectors. I had to smooth the edges with some sandpaper to get the connectors to fit nicely. The QFN packages of the MMIC switches were also a bit tricky to solder, but I recently got a lot of experience soldering tiny AVRs at work so that wasn't too troublesome. The only thing I'm never completely sure with QFNs is how well the ground pad gets connected. The datasheet says that is important for good RF performance of the switch.

Multiplex board connected to a rtl-sdr and ERASynth Micro.

The big question of course is whether it works or not. For testing I've connected the board to my rtl-sdr receiver and the ERASynth Micro microwave synthesizer. I've used short, rigid male-to-male SMA adapters between the instruments to keep down the losses. I've also shorted the device-under-test in/out (DUT) ports with a short length of a coax cable. In this setup the expected 100 Hz 3-state multiplex pattern is visible on the rtl-sdr baseband. The board switches between an off state (no signal), the reference signal which is the input attenuated by 10 dB, and the signal that passes through the DUT (which in this case is the full input signal, minus any attenuation in the coax cable):

Plot of the multiplexed complex baseband signal.

So the basic multiplex functionality appears to be working, but is it any good? What are the losses and crosstalk in the switches and the PCB? Estimating the RF performance is where it gets a bit tricky. I've attempted to do that using the setup pictured above. To estimate the attenuation of the signal I've swept the input frequency and measured the received signal power at the rtl-sdr using rtl-power-fftw. I've performed the same measurement with the multiplex board locked into dut state and into ref state.

Measured signal power versus frequency relative to the thru measurement.

Since the rtl-sdr isn't a calibrated power meter I've also performed a third measurement where I directly connected the rtl-sdr to the signal generator using one of the rigid SMA adapters. This was the reference against which I compared the other two measurements. It's shown as 0 dB and the dotted black plot in the figure above. This way I subtracted any variability in the rtl-sdr sensitivity versus frequency. In all cases I manually locked the gain of the rtl-sdr to 14 dB.

Ideally, I would expect the blue dut plot to be near 0 dB. It should show only the loss in the PCB, switches (around 0.7 dB according to the datasheet) and the coax cable. Similarly, the ideal orange ref plot should be near constant -10 dB, because the board includes a 10 dB attenuator in that signal path.

As you can see, the reality is not nearly as perfect as the theory. The gain of both signal paths varies quite a lot with frequency. There seem to be one slowly varying component that's common to both paths (with minimums at around 600 MHz and 1600 MHz) and one that's only on the dut path (with periodic minimums every 250 MHz or so). This seems to suggest that there is more than one bad impedance match somewhere. It's not necessarily in the design of the board itself. I don't know how well ERASynth Micro is matched to 50Ω and I also don't have any specs for the rtl-sdr (I've been speculating on it's return loss before). I also don't have much confidence in the quality of SMA adapters and the coax cable I was using.

Measured signal power in off state compared to the noise floor.

Finally, this is the result of the crosstalk test I did. Here I'm comparing the signal power with the board in the off state (blue plot) with the receiver noise floor (dotted black plot). The measurement in the off state was done with the same setup as above. I've measured the receiver noise floor by terminating the rtl-sdr input with a 50Ω terminator. As you can see, both plots are basically identical, which shows that there's no significant leakage of the signal when the switches are turned off.

Plot of the estimated switch crosstalk.

A better way to show this result is by subtracting the noise floor from the off measurement in linear scale. This new plot now gives directly the isolation of the signal when the board is in the off state. 0 dB on the graph is again the input signal level, same as on other graphs.

Ideally, this plot would be at minus infinity. It is not because the two switches are not perfect (around 60 - 70 dB isolation per switch according to the datasheet) and some signal also probably leaks through the PCB and the space around it. When I was measuring this I also realized that the layout where I have the signal generator and the detector right next to each other might not have been the best choice to keep isolation high. Neither ERASynth Micro nor the rtl-sdr have metallized enclosures, so some signal might also leak out that way.

In any case, I think 50 dB isolation is more than good enough for my purpose. It goes down to 40 dB near 2 GHz, but that might be because rtl-sdr sensitivity is getting really bad in that range. This measurement is not very precise, since the crosstalk signal is below the noise floor of the receiver. It's unlikely that I will be using this board with bridges or directional couplers that would have directivity better than 40 dB. Hence isolation in the multiplex board shouldn't be the limiting factor in the accuracy of my measurements.

I would like to better understand where the unexpected variations in the signal path attenuation come from. Did I make an error in the board design or is it caused by cables and other equipment I'm using? I have some more experiments planned related to this. I also still need to take my signal processing code out of the simulation I wrote and use it on the data from the real hardware. In the end the only thing that matters is the quality of the final measurement result.

Posted by Tomaž | Categories: Analog | Comments »