A minimalistic 500MHz Wattmeter


Thanks to the availability of the brilliant AD8307 chip by Analog Devices, literally hundreds of projects have come up that use this chip to measure anything from picowatts to kilowatts, one of the more popular beeing the work of OZ2CPU, built around the PIC family of microcontrollers.

Personally, I am more familiar with AVR controllers and would not want to give up the additional flexibility of being able to re-program the chip myself so I wrote my own code.

The AD8307

In the unlikely case that you are not aware of the principle, the AD8307 is a chip that contains a logarithmic amplifier which transforms an RF input signal into a DC voltage which is proportional to the power of the input signal. 

It can do this for signals up to 500MHz and for levels between -75 to +17 dbm. The generated DC voltage increases by 25mV per db of input power so the chip can be used to easily construct RF power measuring equipment. In fact, it can be used with a simple multimeter to give a fairly precise reading.

In it's truly minimalistic form, the chip would just be fed directly through capacitors from a terminated input (see below). 

That already is a lovely instrument that can give plenty of insight into RF power levels.

minimalfrontend.jpg

So why do I need more?


Actually, you might not!

Although the chip's output is linear over it's input power range (except for the edges), the same input power level will not produce the same output voltage when the input FREQUENCY is varied.

A 0 dbm input signal fed at 500 MHz will produce an output voltage that is significantly (>8db) lower than when feeding the same signal at 1 MHz.

Does that matter to you? Only if you want to use the full frequency range. If your measurements are limited to a narrow area, say "only HF" or "only 2m", then the error is fairly insignificant. If you limit your measurements to <50MHz for example, the error should remain in the 1db range. You can then skip the next section and proceed to the CPU interface section further down.

schraeglage_vor.jpg

(1) see below

Compensation network

To fix this issue, or better, to minimize it's impact, we'll add a compensation network which has an attenuation slope of opposite inclination to the frequency response of the chip. In other words, we will add a network that attenuates lower frequencies higher than higher ones. When feeding the resulting signal into the AD8307, we will overall have a (more) flat response curve. The attenuation network comes with a trim capacitor so the slope inclination can be fine tuned.

maxfrontend.jpg
There are several adequate circuits available, a nicely adjustable one has been published by OM Guenther Fromhagen, DK8OH on his website 

Guenther offers his version of a Wattmeter in USB stick format btw. in kit form via his website (through AATIS).

Of course the flat attenuation does not come without a price! First of all, as the network will always attenuate the input, we loose some of the circuit sensitivity. Where the unattenuated circuit measures down into the low 70 dbm's, the attenuated circuit will stop at the mid 60's. On the other side, we re-gain the amount we lost at the bottom by adding it to the top of the sensitivity range (be aware though, that the compensation network resistors need to be adequately dimensioned!)

The second factor to take into account is that in order to take advantage of the compensation network, the trim capacitor must be adjusted. In order to do that, you will need a reliable signal generator up to 500MHz. Should this not be accessible, what you might want to do is to either drop the network altogether (and live with HF only) or replace the trim capacitor with a 5pf fixed capacitor.
schraeglage_nach.jpg

(1) see below

Output processing

Of course you can measure the chip's output with a voltmeter and calculate the input power level manually. To do that, a reference level should be measured (say 0dbm) and the corresponding voltage noted. The chip's default slope is 0.025Volt per db.
 
To have this a bit nicer, I have chosen to interface the 8307 with an ATMEL ATMega 8 development board that I have used for other projects too. This of course is no prerequisite. Any ATMega board should do, for example an Arduino (http://www.arduino.cc/) is perfectly fine.
 
I have chosen to leave away any extra parts so the resulting circuit is so simple that it can easily be implemented by glueing the CPU on it's back dead-bug-style.
 
I have used an ATMega 8 dip version, no extra circuity. No pullup on the reset pin (the chip has an internal pullup), no external crystal or oscillator. The chip uses it's internal 1MHz oscillator, which is switched on by default when the chip comes from ATMEL. As voltage reference I use the internal bandgap reference and the display is addressed in 4 bit mode to further reduce complexity.
 
Before you start to solder the CPU dead bug style, beware that you need to program the chip first if you decide to leave away the ISP connector!
 
(there is a full scale download of the circuit further down in this article)
 
Please double check the data sheet of your LCD module as to which pinout it expects regarding pin 1 and pin 2. A standard LCD should have ground on pin 1 and +5V on pin 2. I have several modules however which have these pins inverted so the schematic is laid out accordingly. A simple way to verify this is by measuring both pins with an ohm meter against the metal frame that holds the actual LCD screen down. That always will be at ground potential.
 
 
fullcircuit.jpg

Software


The chip's firmware is written in C, using the AVR-GCC toolkit which is available for free. Although all source code is open, the attached zip file as well contains the compiled hex file that can directly be flashed into the chip.

The code is documented generously and can be easily extended with additional functions. Only interface component is a single push button which, when pushed while powering up, brings the device into calibration mode.

In my prototype I chose to leave the button inside the enclosure.

Note that the software can work with any kind of AD 8307 circuity, with or without compensation network, at this or any other range of input voltages or slopes. This should give enough flexibility for other designs.

Calibration


The calibration routine expects a signal of 0dbm and of -50dbm to be fed into the signal input and will compute the offset and slope values internally. When skipping the calibration, the chip will be initialized with values I found to work for my prototype.

If you have decided to add the compensation network, first turn the capacitor all the way out (minimizing its capacitance). Then calibrate the meter as described above with a 150 MHz signal from a signal generator. After that, feed a 0 dbm 450 MHz signal and turn the trim capacitor until the meter displays 0 dbm.

Building hints


The easiest way to build the watt meter is by using SMD components directly on a single sided PCB where "islands" have been cut with a Dremel tool.

This construction method is fairly adequate for frequencies in the desired range (see picture below).

Be careful when using wired components when operating at higher frequencies than HF.

To avoid issues with RF from the CPU being seen by the 8307, I have separated the RF and CPU section through a piece of PCB soldered perpendicularly to the main board, passing through only the output and power line. The AVR supports doing the analog to digital conversion within a sleep cycle which would further reduce QRM should this become necessary. So far I have not seen the need for this. When the enclosure is open, it is sensitive to QRM generated by the PC though (most likely the USB port on the programmer).

Be careful when using external power supplies as those can introduce additional RF noise into the circuit. Either be sure to filter the incoming voltage or to use a battery instead (compare OZ2CPU's page).

As is, the controller uses it's internal 2.56V bandgap reference. If you choose to use VCC or another voltage instead, the configuration needs to be adapted.

Measuring against my reliable 8640B, I have not seen deviations beyond 0.5dbm over the frequency and power ranges from the expected values. When under 30 MHz, the deviation is within +/- 0.1dbm

So, for fairly little effort and cost, I am very happy with the result!

compnetpcb.jpg

Source and Executable Files

Igor Zakharov, UR5EFX has pointed out a funny error where the schematics which I uploaded recently and the source code have the E and R/S lines of the LCD swapped.

The error was corrected and hex and source now have the same setup like in the schematics. Tnx Igor!

wattmeter.hex

Hex File for default fused ATMEGA8
hex, 19,8K, 06/16/11, 372 downloads

Wattmeter Source 1.1.zip

Source Code
zip, 16,6K, 06/16/11, 647 downloads

watt_9.jpg watt_8.jpg
watt_7.jpg watt_6.jpg
watt_5.jpg watt_4.jpg
watt_3.jpg watt_11.jpg
watt_10.jpg  

Pictures

Reference


(1) Guenther Fromhagen, DK8OH was so kind lo let me use the graphs of the compensation network that he presented at the HAM RADIO fair in Friedrichshafen 2009