Antenna Analyser


In part 2 of this series, I described the construction of the HF antenna analyser project I’m building, from Beric Dunn’s schematics and Arduino firmware. In this article, I’ll finish some small items of construction, and look at testing and driving the analyser. All resources, pictures and files for this project are available from the project GitHub repository, with driver software available from the driver GitHub repository.

Errata

The Scan LED wasn’t working, and this was because R12 was too large, so I replaced it with a 1K Ohm. Sorted. Also, the SIL headers I’d ordered originally were too small for the pins of the Arduino Micro and DDS module. It took some time to locate suitable replacements, and find a supplier who wasn’t going to charge me £4.95 just for placing an order as a private (hobbyist) customer. Fortunately, I discovered Proto-Pic, a UK supplier that could provide 10-pin and 6-pin SIL headers. I ordered 2×10 pin Stackable Arduino Headers (PPPRT-11376) and 6×6 pin Stackable Arduino Headers (PPPRT-09280) for £4.78 including P&P. When fitting the 6-pin headers for the Arduino Micro (three per side), you may find that they are quite tight together, so sand down the inner edges a little. The Arduino Micro was still quite a tight fit, but it’s far more secure than it was.

Boxing it up

I cut a few more tracks on the veroboard near the mounting holes so that the metal spacers and screws I found in my spares box wouldn’t short anything out, then started fitting the board into the enclosure, cutting holes as appropriate. I added a switch into the power line… the result looks like this:

And when the LetraSet goes on:

Software, Firmware

I’ve made a few changes to Beric’s original firmware (see here), but will keep the commands and output format compatible, so if you’re driving my modified firmware with Beric’s Windows driver, everything should still work.

I use Windows 2000 on an old laptop in the Shack: I couldn’t get it working with the Arduino drivers, so I couldn’t use Beric’s Windows driver software. I needed a Linux or Mac OSX solution, so started writing a Scala GUI driver that would run on Mac, Windows or Linux, and have got this to the point where I need to add serial drivers like RxTx, getting the native libraries packaged, etc., etc.

However, that’s on hold, since I was contacted by Simon Kennedy G0FCU, who reports that he’s built an analyser from my layout which worked first time!! He’s running on Linux, and has passed the transformed scan output into gnuplot to yield a nice graph. I hadn’t considered gnuplot, and the results look far better than I could write quickly.

So, I reused the code I wrote several years ago for serial line/data monitoring, and wrote an analyser driver in C that produces nice graphs via gnuplot. So far it builds on Mac OSX. In the near future I’ll provide downloadable packages for Debian/Ubuntu/Mint, Red Hat/CentOS and hopefully Raspberry Pi.

Testing

The analyser as it stands is not without problems – the first frequency set during a scan usually reports a very high SWR – I don’t think the setting of the DDS frequency after a reset is working reliably. From looking at the DDS data sheet timing diagrams, short delays are needed after resetting, and updating the frequency – these are not in the current firmware…

Also repeated scans tend to show quite different plots – however, there are points in these repeated plots that are similar, hopefully indicating the resonant frequencies.

Beric mentioned (on the k6bez_projects Yahoo! group) that “With the low powers being used, and the germanium diodes being used, it makes sense to take the square of the detected voltages before calculating the VSWR.”…

Simon pointed out that “the variable VSWR is defined as a double. This means that when REV >= FWD and VSWR is set to 999 it causes an overflow in the println command that multiplies VSWR by 1000 and turns it into an int. Making VSWR a long should fix this.” He also suggested some other changes to the VSWR calculation…

… these are changes I’m testing, and hope to commit soon.

I’ll add some options to the software/firmware to plot the detector voltages over time for a few seconds – an oscilloscope probing the FWD/REV detector output shows some digital noise. I had added an LED-fading effect to show that the board is active, and this exacerbates the noise. This noise makes it through to the VSWR measurement. I’ll try taking the mode of several measurements… Once the DDS is generating the relevant frequency, I’m expecting these voltages to be perfectly stable.

I’m investigating these issues, and hope to resolve them in software/firmware – I hope no changes are needed to the hardware to fix the problems I’m seeing, but can’t rule out shielding the DDS, and/or using shielded cable for the FWD/REV connections between the op-amp and Arduino Micro.

In the next article, I’ll show how to drive the analyser with the driver software, and hopefully resolve the noise issue.

Will M0CUV actually find the resonant frequency of his loft-based 20m dog-leg dipole made from speaker wire? Will the analyser show the tight bandwidth of the 80m loop? Stay tuned! (groan)

73 de Matt M0CUV

Previously, I described the HF antenna analyser project I’m building, from Beric Dunn K6BEZ’
schematics
and Arduino firmware, listed the costs of the components (around £50 in May 2014) and where I obtained them. In this article, I’ll show the veroboard layouts I’ve designed, and start with the construction. All resources, pictures and files for this project are available from the project GitHub repository.

Please contact me if you have any questions about the analyser and the plans shown here, I’d love to hear from anyone building it!

Errata

First, a correction and apology – the pin strips I chose for connecting the Arduino and DDS module are fine for connecting chips with thin pins, but are unfortunately too small for the thicker pins of the Arduino and DDS module. If you started buying components based on the previous post, I’m sorry for the mistake – I only spotted it when plugging the boards in. I’ve replaced them with sockets made from “springy” Dual-In-Line chip sockets – these are not ideal: the boards connect into them, but I’m not satisfied with their security. I’ll be looking for suitable, cheap replacements. You’ll see the changes throughout the rest of the article.

Power distribution

Also in the previous article I mentioned small changes I’d made to the original design – I omitted that I’m powering the Arduino Micro with 7-9v via its VIN input, rather than its 5.5v pin (I think this is a power output, rather than power input?) – the Arduino Micro page states:

Power

The Arduino Micro can be powered via the micro USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from a DC power supply or battery. Leads from a battery or DC power supply can be connected to the Gnd and Vin pins.

The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

  • VIN. The input voltage to the Arduino board when it’s using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin.
  • 5V. The regulated power supply used to power the microcontroller and other components on the board. This can come either from VIN via an on-board regulator, or be supplied by USB or another regulated 5V supply.
  • 3V. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
  • ⏚ Ground pins.

Construction Time!

OK, let’s start!

Firstly, prepare a piece of veroboard, 38 strips x 31 holes, 96mm x 81mm, 2.54mm hole spacing. Farnell sell a 121.92mm x 101.6mm 41 tracks x 44 holes board that can be cut to fit.

Carefully mark where you’ll cut tracks in the places shown by the red X’s in the diagram below, check them, then cut with a spot face cutter (or drill bit).

Here, I’ve used the solid tracks at the top (which I’ll later cut off), and the solid tracks cut from the bottom of the board as a guide to where to place track cut marks. I’ve marked the cuts with a CD marker pen before checking, then cutting.

I’ve placed mounting holes in the four corners of the board.

Clean the board by lightly sanding it with fine sandpaper to aid soldering, then check that you do NOT have continuity across each of the track cuts.

Here’s the board with tracks cut, mounting holes drilled and the top solid strip still attached.

Now it’s time to add all the wire jumpers, IC holder and pin strips for the Arduino Micro and DDS Module. Use CD marker pen first to mark these out on the component side of the board.

Here’s the board layout:

The DDS Module goes at the top left, with its trimmer at the top and crystal at the bottom. The Arduino Micro goes at the bottom left of the board, so that its USB socket can protrude through the case. The PSU is at the bottom right, and the SWR bridge circuitry is at the top right, connecting to the antenna UHF socket (the type that takes a PL-259 plug – feel free to change this to a 50 Ohm BNC socket). Power comes in via a barrel socket and switch.

When the wires, test pins and pin strips are done, the board should look like this:

Now would be a good time to check the continuity of the ground and +5v connections. Check that ground is connected to all the components connected by the purple tracks here:

Check that +5v is connected to all the components connected by the purple tracks here:

If all is OK, now add the components for the PSU: the electrolytic capacitors, 7805 and 7809 voltage regulators at the bottom right. Take note that in the layout diagrams, the square pin of the electrolytic capacitors is negative. The In/Ground/Out connections of the voltage regulators can be found here [PDF 78xx datasheet].

After fitting the PSU components, and connecting a 9V battery to the +V IN and GND IN pins on the right of the board, you should have a board like this:

Measuring the voltage between the GND test pin (between the DDS module and Arduino), and the +5V test pin, I had 5.02V, and between that GND and the +9V test pin near the Arduino Micro pin strip, I had 7.02V – which is fine, it’s within the 6-20V given in the Arduino Micro page – with a 12V DC wall adapter, I expect to have a nice, smooth 9V. Be careful with the GND test pin next to the +9V test pin – I added the one between DDS and Arduino because the one next to the +9V test pin is very close to GND, and you don’t want to accidentally short them out!

Next, add the rest of the components in the top right of the board forming the SWR bridge. Solder the diodes in last so they don’t get overheated, and remember to get them the right way round: the end with the line is the cathode, and matches the line in the diode circuit symbol. Take care with the C1 electrolytic capacitor – the square pin on the layout diagram is negative. I couldn’t find 5K Ohm resistors, so made them out of a pair of 10K Ohm resistors in parallel, mounted on their end next to each other. Add the R12 resistor on the left of the Arduino Micro.

When done, the board should look like:

Some detail on the SWR bridge components, in case the layout isn’t clear:

Connect the scan LED on long wires, as it’ll need to fit into a hole in the case (I used a LED mounting clip). Connect the power (I’m using a 9V battery for now) and antenna connector (I’m using a longish piece of RG174 cable from a previous project). When finished, the board will look like this (with the original pin strips replaced with homebrew ones made from “springy” Dual-In-Line chip sockets):

After adding the Arduino Micro and DDS module boards, the analyser looks like this:

Firmware

The firmware then needs loading into the Arduino Micro. I’m using version 1.0.5 of the Arduino programming software. I’ve made a few changes to Beric’s original firmware:

  • Added the “Scan in Progress” LED control.
  • Made the Arduino’s inbuilt LED pulse slowly when it’s waiting for serial input, as a way of showing that it’s working.
  • Fixed a bug in the reporting of the stop frequency in the ? report.

Testing

After uploading the firmware, and starting the Serial Monitor at 57600 baud, you should be able to issue commands to the analyser, and test that the DDS module is generating a signal at the RF test pin. I connected the analyser output to a 50 Ohm dummy load, and started a sweep at a low frequency (my old scope doesn’t handle high frequencies), and observed:

Next….

I haven’t covered testing the SWR bridge circuit yet, so that’s next. The “Scan in Progress” LED isn’t working; don’t know why yet. Also, I’ll finish off the construction, cover the software used to drive the analyser, showing SWR graphs, and hopefully give some background on what’s being measured here, and how you can use the analyser to adjust your antenna.

Acknowledgements

Thanks to Rick Murray for VeroDes, a very nice Windows program that I used to draw the board / track / continuity layout diagrams in these articles.

Every amateur radio operator should measure the SWR (Standing Wave Ratio) of their antennas – the SWR is an indication of how much power is being sent to the antenna (the forward power) and how much is being reflected back from the antenna if it is mismatched (the reverse power).

Ideally, with a well-matched antenna and feeder, no power is reflected, and all of it is transmitted. However it’s not always possible to achieve this. Different antennas have different bandwidths – the part of the intended frequency range over which the reflected power is acceptably low. Ideally, at the antenna’s resonant frequency, no power is reflected, with this increasing gradually as you move away from the resonant frequency. It’s unlikely the reflected power will be zero across the whole band.

When building an antenna – say, for example, a dipole – you cut the legs of the dipole according to the usual formulae relating wavelength, frequency and cable velocity factor, erect the antenna, feed it appropriately, then plot measurements of the SWR across the band, using a SWR meter and graph paper. This gives a graph that hopefully has a dip in reflected power at exactly the frequency you intend to use. Of course, it’s hard to get this right first time, and usually some trimming or extending is required, along with more measurements. This is time-consuming, and error-prone.

Enter the antenna analyser, a computer-controlled device that incorporates an RF signal generator that can transmit a low-power signal at a range of frequencies across the band, a SWR bridge that measures forward and reflected power, a microcontroller that records the SWR as the signal generator is swept across the desired range, and a display of the point in the frequency range at which the reflected power is lowest – the resonant frequency.

These are expensive – around £400 in May 2014 for a very well-made stand-alone, hand-held graphical analyser from a well-known manufacturer, for example.

However, it’s possible to build your own, so I set about looking to see if anyone had published circuits for homebrew antenna analysers. I was not disappointed!

The first circuit I found was in the book Ham Radio projects for Arduino and PICAXE, called Sweeper. However, the signal generator board (DDS: direct digital synthesizer) used in this project was not currently available.

Several projects mentioned the availability of extremely cheap DDS boards on eBay. Sure enough, many sellers were offering boards using the Analog Devices AD9850 chip, and a 125MHz crystal. In May 2014 there are two main types of board on offer. The most common looks like this:

I obtained one of these for £7.99 from eBay! One article I’ve read suggests that the reason they are so cheap is that the filter circuitry was incorrect for their intended purpose, so they’ve been dumped. However, the filtering is fine for HF amateur radio! The legitimacy of the boards has been brought up with Analog Devices by a columnist in Practical Wireless, with no response as yet. An excellent description of these boards may be found at EIModule AD9850 Signal Generator (with a cached copy here).

A project I found that used this board was by Beric Dunn, K6BEZ. Beric’s project page can be found at Antenna Analyser by Beric Dunn, K6BEZ.

Beric built three variations of the analyser: a PIC-controlled one with RS232 connection to a PC, an Arduino Micro-controlled one with USB connection to a PC, and a PIC+LCD self-contained one. The Arduino Micro version was costed at $50.

I chose to build the Arduino Micro-controlled one, since I have no PIC programming equipment, RS232 hardware is not so easy to work with on modern systems, and the Arduino programming environment requires only a USB cable and works cross-platform. Also, the challenge of building a useful piece of test equipment for $50 was too great to pass up!

Click the schematic below to view it full size. (Copied from Beric’s presentation).

The version of the circuit I’m building is almost the same as above, but adds a voltage stabilising PSU (9-12V to +5V, +8V), and a dedicated ‘Scan in Progress’ LED, rather than the Arduino Micro’s inbuilt LED. Note that in the schematic, the lower two connections between the DDS and Arduino are labelled the wrong way round: pin 9 of the DDS is W_CLK (CLK); pin 8 is FQ_UD (UPDATE).

Beric provides Windows-based software to drive the firmware on the Arduino; I hope to provide a version of control software that’s cross-platform, running on Mac OS X, Linux and Windows – since the current shack laptop is not a Windows one!

I had a problem with component availability. Beric used some values of resistor that I couldn’t buy from the two major suppliers I chose (Farnell/element14 and RS Components) – such as 5K Ohm and 648 Ohm. I don’t know if these are readily available in the US, but they’re not in the UK. I changed the 5K Ohm resistor for a pair of 10K resistors in parallel, and the 648 Ohm for a 647 Ohm. The germanium diodes Beric used – AA143 – were not available from my suppliers. I found another eBay seller offering 10 AA143’s for 60p each in a 10-pack. I looked at several SWR bridge circuits online (such as Wideband SWR Meter) and in books for advice, and most of them used more readily-available germanium diodes, but without detailed descriptions of Beric’s circuit, and the choices made when designing it – and my relative lack of expertise in electronics – I tried to obtain the closest matches to Beric’s.

A full component list giving UK prices accurate in May 2014 may be found here [PDF]. Prices are given from Farnell/element14, RS Components and eBay (with seller names).

I chose to build the circuit on veroboard, since designing a custom PCB is harder, I don’t have the equipment to do it, and veroboard is readily available – it makes it easier to build for hobbyists.

The total cost of components (excluding wire and test pins) was £47.43 – let’s call it £50! (I had some parts in my component store, from previous projects, but I’ve given current prices for everything.)

The next article in this series will give a veroboard layout, and notes on how to build the analyser.

All code, images, documents etc. can be found in the GitHub repository for this project, which you’ll find here.

My thanks to Beric Dunn, K6BEZ for the original circuit, and the inspiration to spend £50, and save £350! Also thanks to the authors of other articles that I’ve linked to in this post.

73 de Matt M0CUV