Introduction

A spectrum analyzer (SA) is a very useful tool when it comes to measure spectra of radio frequency signals. I recently acquired a 2004 era spectrum analyzer. It’s from a Japanese test equipment manufacturer Anritsu and the model number is MS2661N. Luckily there are operating manuals available online but I wasn’t able to find service manuals for this type of spectrum analyzer on the internet. There are some service manuals available for similar models of spectrum analyzers (e. g. MS2650/MS2660) which would allow troubleshooting but I would be lost if the instrument breaks.

However, I’ve been looking for a decent SA for a longer time and stumbled upon the Anritsu MS2661N. It had a bunch of very nice and useful features: frequency range 100 Hz to 3 GHz, 30 Hz resolution and video bandwidth, oven controlled crystal oscillator (OCXO), GPIB interface, 10 MHz reference IN/OUT and a tracking generator ranging from 9 kHz to 3 GHz. I was looking for a similar SA from HP/Agilent 8590 Series or Tektronix but there were no attractive offers at the time. Either the SA frequency range was too low for modern ages (1 GHz) or outside of my measurement capabilities (26 GHz), the price was either too high or it was partially broken. There were also 75 Ohm spectrum analyzers which aren’t very useful for what I’m doing. On the other side, the documentation for HP/Tek hardware is the real deal so leaving this kind of test equipment ecosystems was a tough decision.

Long story short: I wasn’t disappointed and the SA works perfectly fine. I don’t want to write a lengthily blog about it. One of the first experiments was connecting my GPS disciplined oscillator to the signal generator and spectrum analyzer simultaneously in order to provide the same external reference for both instruments and checking if the frequency (1.5 GHz) and the amplitude  (-35 dBm) are accurate. Acquiring measurements was super easy and the operation of the SA is very straight-forward.

Documentation of Measurements

I would consider the somewhat cumbersome recording of readings as a minor disadvantage of this SA. Taking a photograph of the display may be “quick and dirty” but you have to deal with bad image quality due to reflections, visible RGB pixels and picture alignment. It is possible to take screenshots in bitmap format (BMP) but one needs a special type of a Memory Card (basically a PCMCIA or PC Card) in order to save the screenshots on an external storage. That’s really unfortunate but measuring instruments of that era were either equipped by a floppy disk or Memory Carc. I was always afraid of damaging the fragile pins while pushing the PCMCIA card in its slot although it is rated for 10k mating cycles. The MS2661N type SA even has a 75 Ohm composite out – it’s possible to record video stills in the NTSC format. However, there are two elegant methods which I would like to show how to transfer the readout from the instrument to the personal computer (PC) by modern means.

Method 1: Sending a Hard Copy from SA to a PC

Back in the days, the measurement results such as frequency spectra would be printed on a piece of paper as a part of the documentation. A device called printer or plotter was needed and the process was called “hard copy”. The difference between a printer and plotter is how the drawing is generated: while the printer generates text and images line by line, a plotter can draw vectors in a X-Y-coordinate system. HP developed its own printer control language back in 1977 for this purpose – the HP-GL or Hewlett-Packard Graphics Language. HP-GL consists of a set of commands like PU (pen up), PD (pen down), PAxx,yy (plot absoute) and PRxx,yy (plot relative) in order to control a plotter, which is basically an electro-mechanically actuated pen. The commands are transmitted in plain ASCII via GPIB or RS-232C interfaces. If we were somehow able to capture the HP-GL ASCII code, it should be possible to generate a lossless vector graphics instead of a lossy bitmap.

Hardware Requirements

Besides the already mentioned spectrum analyzer one needs either a GPIB/USB or GPIB/Ethernet adapter. I have tested it successfully with a National Instruments GPIB-ENET/100 on a Windows 10 machine with NI 488.2 v17.6 drivers. It should also work with a NI GPIB-USB-HS+ (Chinese clone) adapter.

Software Requirements

I was looking for a quick solution how to acquire hard copies. Thanks to einball on a certain Discord channel 😉 for showing me the KE5FX 7470.EXE HP-GL/2 Plotter Emulator. John Miles, KE5FX, already wrote a software back in 2001 which does emulate a HP 7470A pen plotter. The 7470.EXE is still maintained by John and supports popular spectrum analyzers from HP and Tektronix. His software is able to fetch the HP-GL ASCII via GPIB and render the hard copy image on the screen. The image may be saved in a bitmap format (BMP, TIFF, GIF) or in a vector format (PLT, HGL). I have tested John’s software with Anritsu MS2661N and it worked perfectly fine. I suppose this could work on similar Anritsu spectrum analyzer models, such as MS2661C.

Setting up the Spectrum Analyzer

Here is a brief summary how to obtain a hard copy from an Anritsu MS2661N spectrum analyzer:

• Connect the spectrum analyzer to the GPIB adapter and boot up the device
• Go to the Interface menu and use settings as followed → GPIB My Address: 1, Connect to Controller: NONE, Connect to Prt/Plt: GPIB, Connect to Peripheral: NONE
The SA wants to send its data via GPIB to a plotter. It’s important to disable the “Connect to Controller” option, otherwise it won’t be possible to select GPIB as “Connect to Prt/Plt”. The GPIB address is set arbitrarily to 1
• Go to Copy Cont menu (Page 1) → Select Plotter
• Copy Cont menu (Page 2) → Plotter Setup → Select following options: HP-GL, Paper Size: A4 Full Size, Location: Auto, Item: AllPlotter Address: 2
It’s important to set the “Plotter Address” value to a different number than the “GPIB My Address“. If both addresses share the same number, the hard copy will result in a timeout error

Install John’s 7470.EXE software and start the HP 7470A Emulator. There is no need to change the settings of the GPIB controller, it works out of the box. Click on GPIBPlotter addressable at 2. The selected address in 7470.EXE should be identical as the previously set Plotter Address. In order to obtain a hard copy, press the button w and the 7470.EXE should display a message like shown in the screenshot below. Once you press the Copy button on the spectrum analyzer, a data transfer progress should be visible. It takes about 10-15 seconds to transfer the data (approx 7-10 kb) from the SA to the PC. Once it’s complete, an image of the current frequency spectrum is shown on the display. That’s it.

Creating Publication-Quality Vector Images

At this point, it’s possible to save the acquired hard copy in a bitmap image format. If one needs a publication quality images – which should be free of compression artifacts – one should save the images in a vector format such as PLT/HPGL. This workflow proved to be a little bit inconvenient but it’s perfectly doable. Save the hard copy as .PLT and open the image in a HP-GL supported viewer. John suggests few of them on his website – I’ve tried CERN’s HP-GL viewer. It’s distributed free of charge and still maintained by the developers. Download their viewer and load the PLT-image. If the colors seem wrong, there is a setting where you can change the pen colors. Once done, it’s possible to export the PLT image as PostScript (PS) or Encapsulated PostScript (EPS) or print as PDF. EPS files can be embedded in LaTeX documents or can be imported in a vector graphics editor such as Inkscape.

The results turned out to be really good. Especially the vector images are crisp and sharp. One can zoom in without any image quality losses. The printouts on my laser printer are perfect. A little downside would be few breaks in the workflow: one has to use three different applications in order to obtain, convert and process the images. But it’s worth it 😉

Method 2: Readout Data via pyvisa and Plot it via Matplotlib

A different method to plot the frequency spectra would be by downloading the acquired raw data via GPIB and plot it directly. This is exactly what I’ve done. I’ll share the Python code down below. It’s possible to refine the plot by automating more stuff: one can generate annotations directly from queried instrument settings. Just put enough time in it and you’ll get superb results. The plotted image can be saved directly in a Scalable Vector Graphics (SVG) or any supported bitmap/compressed format.

# -*- coding: utf-8 -*-
"""
Created on Tue Jan  3 16:45:39 2023

@author: DH7DN
"""
import numpy as np
import pyvisa
import pandas as pd
import matplotlib.pyplot as plt

#%% Open the pyvisa Resource Manager
rm = pyvisa.ResourceManager()
print(rm.list_resources())

#%% Create the Spectrum Analyzer object for Anritsu MS2661N at GPIB address 13
sa = rm.open_resource('GPIB0::13::INSTR')

# Print the *IDN? query
print(sa.query('*IDN?'))

#%% Take a measurement
# Set frequency mode to CENTER-SPAN
sa.write('FRQ 0')

# Set the center frequency in Hz
cf = 1.5E9
sa.write('CF ' + str(cf) + ' HZ')

# Set span in Hz
span = 10000
sa.write('SP ' + str(span) + ' HZ')

# Take a frequency sweep (TS)
sa.write('TS')

# Select ASCII DATA with 'BIN 0' according to Programming Manual
print(sa.write('BIN 0'))

# Create a Python pandas Series
data = pd.Series([], dtype=object)

# Fetch data, convert string to float, print the power level values
for i in np.arange(501):
data[i] = float(sa.query('XMA? ' + str(i) + ',1')) * 0.01
print(data[i])

#%% Plot the results
# Generate the frequency values for the x-axis
f = np.linspace(cf-span/2, cf+span/2, 501)

# Plot the results, set a title and label the axes
plt.plot(f, data)
plt.xlabel('f in Hz')
plt.ylabel('Power Level in dBm')
plt.title('CF: 1.5 GHz, Span: 10.0 kHz, RBW: 100 Hz, VBW: 100 Hz, \n Peak at 1.5 GHz and -35.85 dBm')
plt.grid(axis='both')
plt.minorticks_on()
plt.show()

Few things to consider when using Python to obtain data from the spectrum analyzer:

• Anritsu MS2661N acquires only 501 data points per sweep
• The frequency axis values need to be generated manually. I used numpy‘s linspace method. It was a bit tricky because you one has to change the generation of frequency step values depending on whether parameters “Center Frequency & Span” or “Start/Stop Frequency” are used
• Fetching the data takes quite some time (approx. 30 seconds). This is due to the fact that every single data point needs to be queried with the XMA? command in a for-loop. This is at least how it’s done in an example from Anritsu’s Programming Manual. I haven’t figured out yet how to fetch a block of data

Summary and Conclusion

I was clearly impressed how easy it was to obtain good quality frequency spectra images from a 20 year old instrument. I’ll refine the workflows and do further testing in Python. It should be possible to do all of this “automagically” via one little Python script. So far I’m really happy with the results where I don’t have to rely on smartphone pictures anymore. Thanks to einball for his help (basically googling for me) and to John (KE5FX) for writing his plotter emulator which helped me a lot to obtain hard copies from my SA. That’s it for today! Happy measurements! 😉

73 de Denis, DH7DN

Leo Bodnar Fast Risetime Pulse Generator

A new and useful addition to the lab is a (30 ± 2) ps Fast Risetime Pulse Generator from Leo Bodnar Electronics. A pulse generator is needed to test oscilloscopes for their analog frequency bandwidth and risetime. Other applications for pulse generators would be for example time domain reflectometry (TDR) or high-speed broadband measurements (radar, semiconductors). The function description and details of the Leo Bodnar Pulse Generator are very well explained in a YouTube video by Shahriar from TheSignalPath.

So, having all the informations I need, I made some photo(n)graphs and did a quick measurement on my Tektronix 2465B analog oscilloscope. Its specified bandwidth should be 400 MHz. By measuring the rise time $$T_\mathrm{r}$$, one may estimate the analog bandwidth $$\Delta f$$ by using the following equation:

$$\Delta f = \cfrac{0.35}{T_\mathrm{r}}.$$

For example, if the rise time is measured in nanoseconds, the bandwidth will be stated in GHz because… physics: $$f = 1/T$$.

The pulse generator is a very compact device. Its dimensions are approx. 24 mm x 24 mm. It is equipped with an USB and Trigger (SMA) connectors on the front side and a oscilloscope connector (BNC, SMA or 2.92 mm microwave) on the back side. In order to operate it, one needs a USB cable with a power supply (e. g. a PC or an USB power bank), various adapters (SMA to BNC) and a short coaxial cable in order to connect the trigger output to the oscilloscope.

I ordered a SMA version of the pulse generator, however they shipped me the 2.92 mm version which is slightly more expensive (99 pounds). The shipping from UK to Germany took approx. 2 weeks and added 20% costs due to customs and shipping. Yeah, Brexit has a price tag for all of us. The 2.92 mm version has a slightly higher upper frequency specifications (40 GHz) compared to SMA (18 GHz). They provided me a calibration chart with determined rise times of approx 30 ps (rising edge) and 28 ps (falling edge).

I’ve added some cool stereo microscope close-up pictures in my gallery, check them out! Here for example, one can see the center pin of the 2.92 mm connector. The center pin is surrounded by air as dielectric, as opposed to PTFE (Teflon) on a standard SMA connector. The center pin is very delicate and one has to handle it very carefully in order to minimize the wear out.

The pulser is powered via USB. The USB and SMA cables were not included. I powered the pulse generator via a battery/power bank. The RF output was connected into a 50 Ohm terminated Channel 1, the trigger output was connected to Channel 2. Trigger settings were set to Channel 2 rising edge.

The first signal one should see is a 10 MHz square wave with approx. 1 V peak to peak (1 Vpp) amplitude. If you’re using 1 MΩ termination instead of 50 Ω, the amplitude will be 2 Vpp.

Next step will be the determination of the rise time of the rising edge. One has to zoom in to the maximum value (e. g. 5 ns/div) and activate the x10 magnification. This will lead to a 500 ps/div time scale.

Taking the measurement is quite straight-forward. One has to determine the 10%-90% rise time. The lower image shows how the measurement is performed.

Now plugging in the measured value of $$T_\mathrm{r} = 0.84~\mathrm{ns}$$ into the Bandwidth Equation gives us:

$$\Delta f~ \mathrm{[GHz]} = \cfrac{0.35}{0.84~\mathrm{ns}} = 0.416~\mathrm{GHz} = 416~\mathrm{MHz}.$$

A resulting bandwidth of 416 MHz for a 400 MHz analog oscilloscope is quite acceptable! This is almost my fastest analog oscilloscope. Since I’ve acquired quite a few of Tektronix 7000 series oscilloscopes over time, I will test the pulse generator on my 500 MHz units. I’ll share the results here.

73, DH7DN

New Addition to the Lab: NanoVNA V2 Plus4

While browsing the Internet, I stumbled here and there upon a nice little gadget for ham radio amateurs called NanoVNA. This is a compact Vector Network Analyzer (VNA) — a piece of test equipment which allows to measure radio frequency (RF) properties of a Device Under Test (DUT) such as Magnitude and Phase. This is very useful in order to characterize RF components such as antennas, filters, cables or amplifiers – the usual ham radio stuff. Few weeks ago I ordered a NanoVNA in order to perform simple tests on my RF equipment. This article will be about  a quick set up of NanoVNA and doing some simple measurements.

Prices for “Maker/hobbyist level” VNAs  vary from 50ish EUR to ~550 EUR (DG8SAQ VNWA V3) depending on model and additional accessories. More sophisticated vintage test equipment (HP/Agilent, Rohde&Schwarz) may be found on eBay in the range from 1k+ EUR to ~3.5k EUR. Brand new entry level VNAs start at ~2k EUR without upper price limit,  depending on its measurement capabilities. As soon as you buy a VNA you will also need accessories such as torque wrench, lots of adapters (Type N to SMA to BNC and vice versa) and calibration standards (short/open/load/through, SOLT) in order to perform correct measurements. Professional calibration standards (e. g. metrology grade SOLT) are extremely expensive (~3…10k USD) and unaffordable for the low budget hobbyist – so yeah…

I didn’t want to spend 500+ EUR for a piece of test equipment which may result in even greater financial commitment. Based on the positive reviews and my requirements (easy to use, convincing measurements), I bought the NanoVNA V2 Plus4. It’s a compact 2-port VNA with integrated 4″ touch screen display, the specifications are listed here. The total price was ~215 EUR for NanoVNA + shipment + customs. The delivery from China to Germany took approx. 3 weeks from November till December 2021 (standard shipment, no express parcel).

The accessories are shown in the picture above: NanoVNA V2 Plus4 enclosed in a metal housing, two SMA cables, SOLT calibration set, USB cable and a small stylus for the 4″ touch screen. A 4/3 A type 18650 rechargeable Li-Ion battery was not provided due to transport restrictions of hazardous materials (exploding Li-Ion batteries on aircrafts…). The rechargeable battery had to be bought separately (+13 EUR). I’ve added few pictures of my NanoVNA V2 Plus4 here.

The usage of the VNA is pretty much straight-forward: turn it on, set sweep parameters, perform SOLT calibration and test your DUT. The basic measurement results provided by a VNA are Magnitude and Phase over the set frequency range. Those measurements are used to calculate very useful quantities such as  VSWR (voltage standing wave ratio), ESR (equivalent series resistance), LCR (inductance, capacitance, resistance) and plotting a Smith chart. The result can be seen directly on the 4″ display and read by different cursors. This is a perfect tool to do quick performance or sanity checks on RF components.

As soon as one wants to do systematic measurements on different components, it becomes a little bit inconvenient to photograph the Smith chart due to glare, mirror reflections and possible motion blur while taking photographs. However, it is possible to control the NanoVNA via USB and read out the measurements to the PC. The readouts can be stored and processed via standard software such as MS Excel, LibreOffice Calc, Python/matplotlib, MATLAB, GNU Octave and others. This is where the fun begins.

An user from the EEVBlog (joeqsmith) tested early versions of NanoVNA and was quite unhappy with the provided tools at the time. He developed a very useful software front end for the NanoVNA which is based on LabVIEW 2011. In his software, commands are sent via USB protocol to the NanoVNA in order to set measurement parameters and to perform SOLT-calibrations. After triggering the measurement, the data is transferred to to PC and displayed graphically and processed through math equations. He put a lot of effort in the development and the results are astonishing. His software is capable of controlling NanoVNA via comprehensible user interface, taking measurements, performing calibrations, calculating almost all imaginable RF quantities in time and frequency domain. This is very helpful for newbies like me who have never worked with a VNA before. His software can be found on GitHub, downloaded and used freely with no limitations or charge. Props to joeqsmith — he maintains an active and educational YouTube channel so check it out if you’re interested in RF or handheld Digital Multimeter testing methods.

First steps

Buy NanoVNA, plug in the USB cable and turn it on. If you’re using Windows 10, the device should be recognized as USB CDC (Communications Device Class) on a virtual serial port (e. g. COM6). Next steps will be a little bit annoying: create an account on the National Instruments (NI) homepage, download and install the NI LabVIEW Runtime Engine (Version 2011 SP1 32-bit, size ca. 215 MB) and NI VISA. I have installed VISA v17.0 which is a 750 MB chonker.  It contains drivers for USB/Serial communications any many others (also some important drivers for my obsolete GPIB test equipment which aren’t supported in the newer versions anymore). Install VISA and the Runtime Engine and spend your precious life with many reboots. I highly recommend to read Joe Smith’s User Manual, otherwise you may run into problems. Unfortunately, NI software is closed source/BLOB but everybody is encouraged to develop his own  free and open source software for NanoVNA.

After the Installation is complete, download, extract and run the Runtime Version Executable (NanoVNA_V2Plus.exe) from Joe’s GitHub. Execute the File (abort the file dialogue if you don’t have any stored calibration files) and you should see something similar to the screenshots below. Setup the connection parameters (COM-port) and establish a link to your NanoVNA.

Alright, now we’re ready to go. Next step: SOL(T) calibration, taking measurements and data analysis. The usage of this software is described in Joe Smith’s User Manual or on his YouTube channel. He has a plenty of demonstration videos how to make proper measurements with NanoVNA V2 Plus4. This is easily done by clicking on the “2PortCal” button followed by some dialogues. After the SOLT calibration is performed, it can be saved and reused. A calibration is necessary as soon as the frequency span changes.

Sanity Tests

It’s a good practice to somehow validate your measurements. This requires some additional gadgets like filters or self-made circuits. I’ll gather some over time. I’m currently checking if the attached SOL standards are displayed correctly.

Testing a coaxial cable

50 Ohm coaxial cables such as RG58 or RG174 are widely used as transmission lines for radio frequency signals. Some important electrical properties of this cable type are: characteristic impedance (typical 50 ± 2 Ohm), capacitance per unit of length (96 pF/m), attenuation per unit of length (0.67 dB/m) and its operating frequency range (DC – 1 GHz). Data taken from Radiall’s RF and Microwave assemblies. For amateur radio operators, the SWR (standing wave ratio) is another important quantity which determines the match between impedances of the source (e. g. transmitter) and the load (e. g. an antenna). In case of an impedance match Z = Z_0, we obtain a SWR close to 1:1. We can measure the impedance Z with a little help of a VNA over a wide frequency range.

This is what the measurement setup looks like. I’ve connected the NanoVNA ports to two SMA cables (blue) in order to perform a SOLT calibration. My DUT will be a Tektronix 012-0482-00 Precision Coaxial Cable which has a length of 36″ and an impedance very close to 50 Ohm. I’ll set up the measurement for 1 MHz to 300 MHz and check the SWR, attenuation/losses and its impedance. The measurement results can be seen in the figures below.

Conclusions

There you have it! Both cables show a similar performance. Tektronix 012-0482-00 shows an impedance slightly closer to 50 Ohms and a slightly better transmission compared to a no-name brand RG58 C/U. Well, maybe the sharp drop of the reflection coefficient coincides with the fact, that this cable has to be used along with Tektronix SG 503 Levelled Sine Wave Generator in order to perform oscilloscope bandwidth checks. Tek SG503  covers the frequency band from 250 kHz up to 250 MHz. Very interesting! Maybe this information may be useful to other Tektronix users. I’ll try to characterize the Tektronix coaxial cable with a “slightly better equipment” later this year, just to validate the NanoVNA measurements. Please take the provided information “as is”. It might be wrong after all.

NanoVNA – would recommend

The NanoVNA is a very useful, nice and affordable addition to a hobbyist electronics lab. Using Joe Smith’s NanoVNA software works pretty well and offers a rich repertoire of calculations and graphical diagrams. I didn’t experience any kinds problems on my Windows 10 machine while using Joe’s software. The installation and setup was straightforward and I was able to obtain plausible measurements. Unfortunately I don’t have coaxial cables with matching lengths in order to make comparison measurements with my Tektronix 012-0482-00 but that’s the part where one starts going down the RF rabbit hole…

Few things to consider

Please be aware that the components used in combination with NanoVNA are very cheap. The quality is “OK” or let’s put it in another way: “good enough for the job”. The devil is in the details. In order to perform reliable and comparable measurements, one needs quality cables, good connectors, good adapters, better calibration standards and a torque wrench. If you’re possessing good RF gear, please be careful when interchanging the components. It’s very easy to damage quality gear with cheap rubbish. I’m trying to maintain two ecosystems: the cheap components will be used for non-critical projects and quick and dirty measurements. The quality equipment will be used for careful measurements and calibration.

Going down the RF rabbit hole?

What if one already possesses quality accessories — a question might arise why not spending money on a good vintage VNA anyway? Unfortunately I’m not an RF engineer and I don’t test or develop commercial RF circuits. RF is just a hobby and not my daily business. This kind of affordable tool lets you make a first step into the world of RF components and circuit testing. I don’t need to emphasize its usefulness for testing and debugging of RF circuits or performing sanity checks. I’ll keep looking for a vintage HP/R&S VNA because the answer to this question is always YES.

73 de DH7DN