IW3HEV embedded antenna analyser

The
IW3HEV
antenna analyser is a relatively simple antenna analyser. It has a 1-60MHz DDS signal generator
and uses a homebrew directional coupler plus the
Analog Devices
AD8302 IF Gain Phase detector. Controlled
through a PC's parallel port it can measure SWR, Return-loss, Phase and Z. It cannot determine
the real and imaginary parts of Z however.
I read about this design in the december 2004 issue of
Funkamateur
in an article written by IW3HEV and IW3IJZ. Together with two other radio-amateurs we started collecting
parts and producing the PCB. It turned out to be easy to reproduce the design. Once I started using the analyser
however, I wondered if I could make an embedded version so that I could do without the PC. Yes, I could
carry a laptop up on the roof to do antenna measurements, but a small self-contained box would be much
easier and I alway wanted to have a 'digital MFJ-259' anyway.
An embedded version has to emulate the essential functions of the PC:
- sweep the IW3HEV analyser accross a frequency range
- readout the ADC's and compute SWR etc.
- display the result on a small graphics display
I had a few 128x64 pixel graphics displays with a Toshiba T6963 controller. Bascom has routines for
controlling such a display. The display is quite small however, so I had to limit the embedded version in
several ways:
- the frequency is swept accross 115 points as opposed to 500 point in the PC program
- the frequency settings are controlled using six keys
- only the swr graph is displayed, Return-loss and Z is displayed only for the centre-frequency
I use an
Atmel
ATMega32 microcontroller in the 40-pin DIP version. This controller has enough I/O to control the
graphics display, the IW3HEV analyser and read the keys. This first version has some I/O pins left for
future enhancements. The controllers speed is app. 13.5MHz, resulting in app. two sweeps per second. Not too
fast, but considering the amount of arithmetic the ATMega32 has to perform, entirely satisfactory.
The first version of the program (v0.23) uses approximately half of the ATMega32 program memory, so there
is plenty of room for extras.
Frequency settings are controlled in a spectrum-analyser fashion. Two keys each are used to step the
centre-frequency, frequency-span and frequency-step up or down. Frequency-step can be set to 10, 20, 50, 100, 200, 500kHz,
1, 2, 5, 10MHz.
Frequency span can be set to 0, 20, 50, 100, 200, 500kHz, 1, 2, 5, 10, 20, 50MHz.
'Zero-span' means that a constant frequency is generated accross the sweep. The analyser could be used as a
(primitive) signal generator this way.
As the size of the built-in font of the T6963 display was too large, I made a smaller 5x5 pixel character set. This makes
reading the display a little harder, but also enables a larger graph area.
There is a seventh key on the box. This key can be used in future versions to call up a menu.
The schematic:

is quite simple, most of the complexity is in the software! The IW3HEV analyser is built
as standard, no changes are needed for this embedded version. You can build the analyser, test it with a PC and then
connect it unchanged to the controller. The Int pins and RS232 pins on PortD are not used in this version, they are
available for future enhancements. Also, pin 7 of PortA is free. This pin could be used for monitoring battery voltage.
The
Bascom program
is indeed a little more complex than the schematic. The program starts by clearing the graphics display and initialising
the DDS. It then cycles continually through the sweep mode until a key is pressed. A key press may result in a
change in the frequency setting after which the graph is updated and sweeping is resumed.
If the sweep is at the centre frequency all parameters are calculated, for the other points only SWR is calculated to
speed up the sweep. The ATMega32 is quite fast but it is not a floating-point number cruncher!
After experimenting on a
breadboard
I built everything into an
enclosure
I used is made of plastic and
contains
the IW3HEV analyser, the graphics display, the controller board
(in dead bug style),
a small board with seven keys, two switches: on/off and lcd backlight, two led's (currently unused), a small board with a
power supply, a 12V power supply entry and a 9-pin and a 25-pin DB connector (both unused).
The power supply uses a
National Semiconductor LM2825 one-chip integrated DC-DC converter. This chip has
a wide input voltage range and can easily supply 5V/300mA (backlight on). I am working on a 2x2-cell Li-Ion
battery charger circuit.
A few pictures of the graphics display:

The 'welcome' screen

A small magnetic-loop antenna.
The top line displays frequency-step value, SWR, Return-loss and Z.
Left axis show SWR ticks at 1, 1.2, 1.5, 1.7, 2 and "High".
Bottom line shows start-, centre- and stop-frequency.

Same as above, but with 'zero-span'.
Note: the ATMega32 fuses should look like this (using TWinAVR):

If you do not have Bascom, use the compiled
bin (what TWinAVR uses) or
hex file. You will not be able to improve the code though...
Guido Perotti also built this embedded version:

As he had to use a 240x64 display, he
modified the program to use the right half of the display for some additional data:

Here
is his program source and compiled hex file.
TOC