ZL2PD Digital HF Antenna Analyser

This
instrument measures complex impedance over the 1.6 - 33 MHz HF
spectrum. It also calculates and displays the VSWR of the impedance
referenced to 50 ohms. The most common application of the meter is as
an antenna analyser. The design was published in 'Break-In', New
Zealand's amateur radio magazine in Jan/Feb 2006, and is republished
here with the permission of the editor.
Note:
'Break-In' is a term used in amateur radio to describe a system which
allows another person's signal to be heard in the brief intervals
between transmitted Morse Code symbols.
Introduction
Why is
it that having reached the top of the mountain and just begun to enjoy
the rewards of the climb, you realise that there’s another peak just
that little bit higher to be seen in the distance? Such was the case a
month or so after I completed an analog
antenna analyser.
The analog meter did everything demanded of it, but there were times
when a little more information would have been useful. I’d seen the
next mountain top. (The analog meter is described on another page
on this website)
I discovered, for example, that there are times when full information
about the complex impedance being measured can be useful. An impedance
is made up of two components; the real
or resistive part, ‘R’, and the reactive
part, ‘X’. The reactive component may be capacitive or inductive.
Complex impedance can be displayed in two ways; Either as a magnitude
plus a phase angle (i.e. A magnitude of "A" ohms at a phase angle of
"B" degrees) or as a series combination of real and reactive components
(i.e. C +/- jD ohms) where
‘j’ indicates the value of "D" is reactive. If "D" is positive, the
impedance is inductive. If negative, the impedance is capacitive.
While it is possible to measure and display these components of a
complex impedance using analog circuitry, this type of equipment can be
complex. It is possible however to build some simple circuitry, and by
making a careful series
of analog measurements, some calculations will allow the real and
reactive components of a complex impedance to be determined. An example
is the "three meter" method used by Peter Dodd, G3LDO (See references 1
and 2, for example) (Note: All references appear at the end of this
webpage). Another popular approach uses the bridge described in my page
on the analog antenna analyser.
These days, it's far easier to use a microprocessor to carry out both
measurements and calculations. Well, OK, it's easy to say, but more
difficult and time-consuming to do! (The calculations required are
briefly summarised in Appendix A for those interested in the details)
This page, then, describes this microprocessor-based antenna analyzer.
It uses the 87C552, a device from the 8051 family, and it uses a
standard two line LCD display to show frequency, resistive and reactive
impedance components, and VSWR, over the range 1.6 to 33 MHz. The
prototype was able to measure impedance typically within 5%, in line
with results reported for most amateur-grade commercial analysers.
Measuring Impedance at HF
Here's
the basic block diagram of an antenna analyser (See below - Right click
for a closer look) Those interested in further general information on
antenna analysers should also see my other page describing the analog
version of this instrument.
The
bridge and detector section is the key part of these meters. There are
a number of bridge designs available. One of the most commonly used
methods is the four element bridge. This is the type used in my other
earlier analog analyser.
In this case, however, I required a bridge which minimised the number
of complex calculations to be performed by the microprocessor. That
ruled out the four element type. It also ruled out the three-meter
bridge. This requires some coplicated sine and cosine calculations, or
the use of some large lookup tables.
In a touch of serendipity, I happened across some work by Jim
Tregellas, VK5JST at a timely moment. This was subsequently published
in WIA’s ‘Amateur Radio’ magazine (Reference 3) and has gone on to
become very popular, in part because the processor he uses is more
readily available. In his antenna analyser, based on the PIC
microprocessor and using embedded BASIC software, the bridge required
only a single resistor. This is shown in the diagram below. With some
minor changes, Jim’s oscillator and simple bridge were quickly adapted
for my analyser.
The
three bridge outputs measure the three components of the voltage vector
triangle shown in this diagram; the oscillator level, the voltage
across the 50 ohm resistor, and the voltage across the load impedance.
Of course, if the load is resistive, then V50 + VL
= Vin.
Reactive measurements are limited in this meter to those which resolve
to a VSWR of less than 20:1. This is simply for reasons of preserving
some level of accuracy. At extreme VSWR levels, the calculations become quite
inaccurate with this measurement method.
The bridge voltages detected by this bridge are amplified in the meter
using low cost LM324 op-amps. The bridge also uses the diode
compensation method described in reference 4. This further enhances
overall accuracy.
Circuit Details
The
schematics are shown below. Right click on the diagrams to see more
details.

RF oscillator section of the digital
antenna analyser

Bridge/detector and microprocessor
section of the digital antenna analyser
The Microprocessor
The
decision to use the Philips 87C552 device was due to a combination of
need, habit and circumstance. Most of my designs over the years have
been based on the 8051 family, popularised in New Zealand through the
tireless efforts of the local agent. As a result, I have acquired
fairly extensive development equipment and software for this family.
This made the 8051 device family a logical choice for me.
This meter also required a microprocessor with several analog to
digital (A/D) converters for measurement of the bridge voltages.
Several months before this project started, I was very grateful to Eric
Apperley, a fellow engineer, for the timely donation of some used
87C552 chips which were surplus to his requirements. These have eight
10-bit A/D converters on-board, and so these chips were ideal for the
task.
Sufficient accuracy is obtained by using the A/D inputs in 8-bit mode,
so other 8051 chips are readily able to be used. The code is well
commented, so converting it to use other 8051 chips should be fairly
easy for anyone keen to make use of their own 8051-type chips.
The software is all written in assembler. I had a variety of high level
language compilers available, but after experimenting with them for
this project briefly, I fell back on old habits and cranked out the
code over a few weeks of free evenings and some idle travel time during
some of my 'day job' work, designing networks for a couple of offshore
broadband wireless projects. This microprocessor development turned out
to be an ideal stress reliever, actually.
The nice thing about writing in assembler is that the software, even if
badly written, tends to end up being very compact compared with any
sort of code generated by a high level language compiler. This code is
written in the form of a series of subroutines for ease of development
and testing, and it ended up at around 2250 bytes in total. For those
looking to use other 8051 chips, the source code is available (see the
end of the article for download details) and it’s all thoroughly
commented, mainly for my own benefit.
As an aside, I find that, after a month or two away from a design,
unless the code is well commented, it’s hard for me to pick up from
where I left off.
The other benefit of using assembler is that the resulting code usually
runs very quickly. Very! It runs in just 8 mS from start to finish in
this case. It’s a little too fast in fact for the LCD display, so there
is a delay added in the code to allow for that limitation. This makes
this meter update at a very fast rate, quite handy in some cases.
Others
wanting to adapt this design to chips they may have should note that,
aside from the A/D code, no software relies on any special features of
the 87C552 chip. It is quite easy to use almost any other 8051 chip,
for example the Atmel AT89C4051, by replacement of the short A/D
subroutine.
Other than finding the time required, writing the code for the 87C552
proved to be relatively straightforward. Simple 16-bit integer add,
subtract, divide and square root routines are used. The latter, based
around an old school textbook method of successive subtractions, works
quickly and accurately. The divide routine is adapted from one given in
reference 5. Careful planning of the scaling factors used in the
various calculations took much of the time required. This ensures
16-bit overflows do not occur, and it maintains accuracy through the
various string of calculations. The VSWR calculations were probably the
most challenging in this respect.
A previously developed block of code was used for the five digit
frequency counter routine. The 74HC4040 chip divides the internal
oscillator frequency by 256 to allow the slow 87C552 to measure it
correctly. Philips brand HC devices are preferred for this device,
since they work up to 80 MHz. Fairchild chips should be avoided!! My
tests indicated they don’t like to operate much above 25 MHz.
The counter software assumes the use of an 11.052 MHz crystal on the
microprocessor, but other crystals can be used with very minor changes
to the constants used in the counter code. The source code contains the
details for those interested.
A final addition to the instrument was the battery voltage measurement.
It allows for a battery range of about 10 to 15 V. This value is only
displayed along with the initial startup message, just as a quick
indication of instrument life. It’s not a super-accurate measurement
but, this level of accuracy is quite adequate for this purpose. The battery
voltage displayed on my prototype was about 0.2V low. All we need
to know is if the battery has more than about 10V, the level at which
you'd want to be recharging those NiCds.
Those wanting more accuracy (i.e. Better than 2%) can carefully adjust
the value of the 22k resistor by a few hundred ohms. Be careful - An
incorrect value here can result in excessive voltages going into the
microprocessor.
The LCD Display
A
standard 2 line by 16 character alphanumeric LCD display module is
used, interfaced via the so-called "simple 4-line interface" according
to the makers of these displays. OK, so rather than using eight data
lines and a further three control lines, this "4-line" interface uses
only seven I/O lines, plus power supply and display contrast voltage
lines. Um, by my count that's 10 wires. OK, so it's better than the
"8-line" interface which needs 14 wires. But still.....
While saving a few I/O lines (hardly necessary with this 64 pin 87C552
device, I know, but I was thinking of others trying to use chips with
an 8051 chip with fewer I/O pins), this interface has a reported
disadvantage of reduced display contrast. I tried the interface with
three different displays, and only noticed this effect with an older
display. The more recent LCD displays appear to have resolved this
particular issue.
One important aspect to note is that different LCD displays have
slightly different power and ground connections. While 100% code
compatible, one display I have from Dick Smith has the exact opposite
DC pin assignments to the display from Jaycar. I’ll let you figure out
how I discovered this fact. The schematic shows the pinout for the Dick
Smith display, but check your display interface connections carefully.
Construction
The
prototype was built partly using a PCB from a previous 87C552 project,
with the bridge and oscillator sections built using the ‘Mahattan" or
"dead insect" style. This mounts the ICs with their legs-up directly on
unetched PCB material. The photographs show the details of my analyser.
Keep the ground lines as short as possible around the oscillator and
amplifier stages.
Unlike
the analog design, the bridge diodes don’t really need to be matched.
Any minor mismatch can be taken up in the bridge adjustments. Also, as
for the previous design, coil details are not shown for the oscillator.
I just built the four coils using a couple of rewound 455 kHz IF
transformers again, and two coils recycled from a cordless phone.
The variable capacitor I used is a cheap standard plastic type as used
in AM/FM radios with both FM and AM capacitors used in parallel. You
can also use a recycled variable capacitor from any cheap AM/FM
portable radio.
The oscillator uses the same MC3346 transistor array I used in the
previous design, and the amplifier section used 2SC1906 and 2N2222A
devices. The MC3346 and 2SC1906 can be replaced by the low cost (but
seemingly hard to find) 2N3563, or by 2N918 or 2N5770 transistors.
Other devices are unlikely to perform as well.
The
12V NiCd battery (the black slab seen at the bottom of the "board
stack" in the picture to the left) is also recycled. It is a 2000mAH
battery from an old laptop, but it is still in good condition and is
able to power the meter for a number of hours of use between recharges.
I recharge the battery from my bench power supply which is set to
constant current. I can trickle charge it overnight with a 200mA
current.
The front panel layout artwork is also available from the Download
section below. This can be copied onto plain paper. The front panel
artwork can then be covered with clear self-adhesive plastic and glued
to the chassis to form a reasonably durable front panel for the
instrument.
The enclosure used for the prototype was made from scraps of MDF wood
in my garage. I tried to buy a suitable plastic box but the ones I
found were either not quite the right shape or size, or they were quite
expensive. I decided to try to make one from MDF, and the result is
quite satisfactory, and the enamel paint covers the odd error or two.
The electronics are contained in three layers, with the battery held in
the lowest section. The bridge is mounted on the top of the panel
holding the battery in place, and the microprocessor mounted on top
using short 20mm length dowels. The oscillator is mounted on a small
vertical piece of MDF and a slightly longer dowel.
While the final assembly is quite light, the woodwork did take some
time to build, and the instrument is probably slightly larger than it
needs to be as a result, in part because of my limited woodworking
skills. Others will no doubt be able to improve on this arrangement.
Alignment
BEFORE
you insert your microprocessor into its socket, you first have to align
the bridge section of the analyser. To do this:
1. Power up the oscillator and detector sections, and set the
oscillator anywhere from 20 to 30 MHz.
2. Short circuit the input load connector. Adjust RV1 and RV2 for 4.6V
at TP1 and TP2. (RV1, RV2 and RV3 are 10 turn presets).
3. Remove the short from the input load connector, and leave it open
circuit. Measure the voltage on TP1. Adjust RV3 so that the voltage at
TP3 is the same as the value measured at TP1.
4. Short the input load connector again, and check that the voltage
measured at TP3 is less than 0.1V.
5. Remove the short from the input load
connector, and leave it open circuit again. Check
that the voltages on TP1, TP2 and TP3 do not exceed 4.75V for any
oscillator frequency across the entire range. If necessary, reduce the
voltage set using RV1 and RV2 in step 1 and repeat the subsequent
alignment steps. (Steps 2 – 4 above)
6. Turn the power off, and install the processor chip.
7. Turn on the instrument, and adjust the LCD display contrast so the
display is clearly visible.
8. Check the alignment by connecting a 100 ohm resistor to the input
load connector. It should measure 90 to 110 ohms and a VSWR of 2:1 with
minimal reactive X values at any frequency across the 1.6 to 30 MHz
range.
Using the Analyser
Simplicity.
Turn the instrument on, connect the load, and read the LCD display.
I did not add additional software to allow the meter to determine if
the reactive value is inductive or capacitive. This is mainly due to
the type of oscillator used in the instrument. Since it is not readily
digitally controlled, it is more difficult to accurately determine this
parameter across the spectrum with the wide range of potential loads.
No, figuring out if it's capacitive or inductive is left to the user.
But it’s easy to see. If the reactive value decreases with increasing
frequency, then it’s capacitive. If the reactive value increases as the frequency rises,
it’s inductive.
Now, you might, at first glance, think
that some results don’t appear to be accurate. I was somewhat concerned
initially at some of my results. I found that, not unexpectedly,
resistors are not always perfectly resistive. My Bird dummy load, for
example, was within specification but measured 52 ohms and a little
capacitive at 30 MHz.
Also, when measuring loads with any reactive component, this and other
similar bridges tend to read the total impedance correctly, but with a
phase angle shift of typically up to 5%. This gets reflected in errors
in the final R+jX values calculated and displayed by the meter. If you
work the numbers out, you’ll find the result displayed is seldom off by
more than this margin in my experience.
I experimented with several popular bridges to see if one was better
than another, and came to the conclusion that they were all much the
same. ARRL tests (in 2005) of a number of commercially made antenna
analysersusing similar methods independently confirmed my conclusions.
Other more complex designs exist if you want errors of less than half
of my instrument, but they are more complex and costly to build. If
"cheap, easy to build and reasonably accurate" are your key criteria,
this meter is hard to beat.
Future Development Options
The
prototype processor PCB contains space for a small Philips I2C memory
chip with onboard real time clock, as well as interfaces for
transceiver audio I/O and RS232. These relate to the previous
applications of this PCB. I have no plans to add them to this meter
although they do suggest possible future upgrade options. It is
possible, for example, to add a date/time stamped memory feature, and
provide for remote control and measurement downloads with a PC, either
via RS232 or via wireless. Feel free to write the necessary code.
Credits
Sincere
thanks to Jim, VK5JST, for the bridge design and advice on the
oscillator amplifier at a critical moment, and especially to Eric
Apperley for providing the all-important microprocessor.
"Break-In"
is a bi-monthly magazine published by NZART, New Zealand's amateur
radio organisation. Details about the magazine can be found at www.nzart.org.nz
References
1.
Peter Dodd, G3LDO, “The Antenna Experimenter’s Guide”, 2nd Edition,
1996 RSGB (See Chapter 3)
2. W8CGD, “Measurement of R+jX”, QST, June 1966
3. Jim Tregellas, VK5JST, “An Experimental Antenna
Analyser”, ‘Amateur Radio’ magazine, WIA, May 2005.
4. John Grebenkemper, KI6WX, “Calibrating Diode
Detectors”, QEX, Aug 1990
5. S. Yeralan and A Ahluwalia, “Programming and
Interfacing the 8051 Microcontroller”, Addison Wesley, 1995 (Section
3.7.2)
Appendix A: Impedance Calculations
Click here here to
download the PDF (54kB) containing the methodology and maths behind
these calculations.
Downloads
Click here here to
download the Intel HEX file - Clicking on this link will
allow you to download a
zipped HEX file (3 kB) for programming an 87C552 chip for use in
this analyser
Click here to download
the Source file - This is a
zipped Metalink compatible ASCII TEXT format source file (14 kB) for
this instrument. This will allow the code to be modified by experienced
8051 programmers who may wish to add more features.
Click here here to
download the front panel artwork (3 kB)
Want to go back to the main page? Click
here to
return directly.