AD8317 based Intelligent Attenuator/Power Meter for 0.2 to 500 MHz

Back to main page

Mission Statement, Build A Three In One Gadget:

  1. RF power meter, 0.2 to 500MHz, input level -50 to +30dBm, 0.1dB resolution (can be extended with an additional 0 - 70dB attenuator in front).

  2. Step Attenuator, 0 - 121.5dB (151.5dB when first 30dB attenuator is engaged, primarily if input power exceeds 0dBm) in 0.5dB steps.

  3. "Intelligent Attenuator" or "Signal Level Generator" function, automatically adjusting to a preset output power.

The way this project started is kind of funny, somewhere I saw a comment about using Minicircuits ZX76-31-R5-PP+ step attenuators for another project I was working on:

I found four of these attenuators on eBay for relatively little money, got them and decided: Nah, too fancy for this purpose, need to create a problem worthy of this nice a solution :)))

Like most home brew experimenters, I already have a number of frequency adjustable oscillators scattered about. However to turn them into a convenient signal generator to be used at the test bench, including not only adjustable frequency but also adjustable and calibrated output, some sort of power calibration and conveniently controllable output attenuation needs to be added. Why not combine the two into an automatic process. Especially, since the alternative, purchasing a professional signal generator usually includes a rather hefty pain of wallet drain.

Ohh, did I mention? Previously when I had intended to order a couple of AD8307, I erroneously ordered AD8317 instead :)

A display of the Power Meter mode includes:

RMS average Power measurement in dBm averaged over 1 second (200 measurements, 1 every 5ms).

RMS average Power measurement in W (femtoWatts to kiloWatts), averaged over 1 second

Peak Power measurement in W pep, largest reading observed in a window of 1 second

Amplitude Modulation index measured within a window of 1 second (200 measurements)

RMS average Voltage measurement (in 50 ohms) measured over 1 second

Peak to Peak Voltage (in 50 ohms) measurement (as easily measured on an oscilloscope) measured over 1 second

When adding an appropriate attenuator in front, and adjusting through the Menu function, the power meter can show up to 5kW (70dB attenuator)

A display of the Attenuator includes:

Attenuator setting, 1.8 - 153.3dB + front attenuator value, if any

Power in (1 second average) in both dBm and W

Power out (1 second average) in both dBm and V into 50 ohms

The Signal Generator Display includes:

Power output in dBm (1s average)

Power output in V (1s average)... did you know that 1microVolt into 50 ohms equals 20 femtoWatts?

Amplitude Modulation index

Attenuator setting (automatic, power locked loop)

Quick And Dirty Project Description:

The AD8317 is good (accuracy to within +/-0.25dB) for approximately -7 to -50dBm power input and it is rated up to 10GHz. The useful range can be extended up to about 0 to -58dBm with some reduction in accuracy. Most of this accuracy reduction can actually be compensated for in the software when reading the A/D output, as the non-linear response at the extreme ends of the scale is known (datasheet).

To increase the range of the instrument, it is built with a 30dB "switch in/out" attenuator in front of the AD8317. If the input is sensed to be above a certain threshold, this attenuator is automatically switched in. Now the range becomes +30 to -58dBm.

Behind the AD8317, there are two more fixed "switch in/out" attenuators, the first one 30dB and the second one 60dB. Finally there is the Minicircuits ZX76-31-R5-PP+ step attenuator, 0 - 31.5dB in 32 switchable steps. The first three attenuators do not need to be spot on at 30 and 60dB, the only requirement is that the first one is approximately 30dB, the second one is equal to or less than 31.5dB and the third one is equal to or less than two times the second one. The firmware (software) just needs to be given the actual values of the attenuators.

A Rotary Encoder / Pushbutton enabled Menu system gives access to fiddle with all parameters, such as fine tuning the attenuators etc. Screenshots shown further down the page

The firmware has a one step auto calibrate feature, you calibrate against a known reference somewhere between -8 and -20dBm. Dial in the actual power with the rotary encoder, and then press the select button. Calibration consists of two consecutive and fully automatic measurements, one direct and another one with the 30dB "first" attenuator switched into the circuit in front of the AD8317.

Overall components count is low.

In addition to the attenuator board, there is a microcontroller circuit consisting of a Teensy 2 board from PJRC.COM (AT90USB646 or AT90USB1287), a 4.096V voltage reference for the A/D and three resistors/transistors to switch the attenuator relays in and out of the circuit. A couple of caps added for good measure and 3 diodes in series to drop the feed voltage for the Minicircuits ZX76-31R5-PP+ step attenuator down to 3V. There are a number of other alternative microcontroller boards available for easy prototyping with the AT90USB646/1287. The only basic requirement of this project is that the microcontroller uses a 16MHz clock, a lower clock rate will slow down the A/D sampling rate (set at 5ms).

Then there is the MiniCircuits ZX76-31R5-PP+, a 20x4 LCD, a pushbutton and a rotary encoder.

The instrument is powered through an USB connector, draws about 200mA maximum. The current version of the controller firmware is not USB enabled (except for uploads of new firmware), but future plans may include adding USB capability using a driverless HID interface, a simple task.

The output from the AD8317 changes by approximately 50mV per 1dB. The A/D is 10 bits and uses a 4.096V reference, which then gives a granularity of 4mV, or slightly better than 0.1dB. The A/D is read once every 5ms. Average is calculated from the 200 last measurements, and peak is found within the same 200 measurements (1 second window). This also allows to measure AM modulation index, if relevant.

Attenuation in 0.5dB steps, 1.8 - 153.3 dB (1.8dB fixed loss, mainly through the Minicircuits ZX76-31-R5-PP, can be adjusted). Shielding in the instrument itself is way above 135dB, but it may be a bit less than the full 153dB at UHF frequencies. The high degree of isolation took me by surprise actually.

The Signal Generator function keeps the output at a steady power level, using a "power" locked loop, to keep the output steady even if the input power changes. Output is kept steady against the 1second mean average input power, so signal modulation should be preserved. When using a relatively high input of about +10dBm, the shielding and isolation is still enough on 70cm to dial the output power down to below 0.1uV/50 ohms, for receiver sensitivity measurements. This I did not expect.

Verification of accuracy was an interesting exercise in itself, I found out that the instruments and meters I have, are all off by up to a dB or two. I had to build some interesting contraptions to do accurate (+/-0.2dB) calibration over the full range. Overall conclusion was that the instrument, after being calibrated at any frequency within its useful range, is spot on for any other frequency within the range (unlike the AD8307). Measurements on 435MHz may have indicated an error of +0.4dB. It is just as likely that my references were at fault.

Overall, the instrument is quite accurate. As far as I have been able to measure, it is within +/- 1dB or perhaps even within +/-0.5dB at all signal output levels and at all frequencies from 0.2 to 500 MHz.

The current version of the firmware is 1.00 (13 April 2012 - finally past the Beta stage :), and is available here. The firmware is written in C, and is currently just under 19kB in size when compiled. This may increase whenever I get around to coding a USB HID interface for remote computer control/read of the Instrument. The firmware, including source code is freely available for non-commercial use only - i.e. for research, homebrew and experimentation.

The firmware should also work with AD8307, one would just not get the same accuracy over as wide a frequency range.

Instrument Build Description:

Below is a schematic of the prototype AD8317 + attenuator board. Pricetag for the components is not too high, the AD8317 is approx USD $8 and the HF3 relays are about $4.40 each.

The first attenuator uses two 1/2 watt resistors at the input to handle a maximum input power of 1W. It would have been cleaner to realize the 30dB attenuators using the Minicircuits PAT30+ and LAT30+ fixed surface mount attenuators, but the result is good enough as is. The HF3 relays come in 50 ohm and 75 ohm varieties, I used 75 ohm relays in the prototype, as I had those available.

Below are VNA plots of the attenuator board. As can be seen, the attenuators are spot on at 30.0 and 60.0dB and the circuit performs well up to about 500 MHz, above 500 MHz things start to fall apart. It should be easy to extend the range up above 1GHz by using proper 50 ohm relays, 30dB SMD attenuators rather than the PI-R arrangement, and possibly an improved PCB layout. Four plots below, the first one with no attenuator in the circuit, the second with the first 30dB attenuator, the third plot has the second 30dB attenuator in the circuit, and finally the fourth plot has the 60dB attenuator in the circuit.

No attenuator selected

First attenuator selected

Second attenuator selected

Third attenuator selected

The prototype Microcontroller (CPU) control board looks like this:

I chose an AT90USB646 simply because I had a Teensy2 prototyping board (www.pjrc.com) lying around in my junk box waiting for a purpose. The firmware in its current incarnation is under 19kB in size, an ATmega32u4 would have been sufficient. However, as the attenuator is USB powered anyway, I will probably end up doing a HID USB interface for computer control and logging. This will probably eat up enough flash rom to justify the larger microcontroller (processor). Whether an ATmega32u4, AT90USB646 or an AT90USB1287 is used is rather irrelevant though, as long as a 16MHz crystal is used. One of the more critical functions of the firmware is to poll the A/D as often as possible, this can be done every 5ms with the microcontroller running at 16MHz.

The I/O pins used may look a bit irrational :) They are easily moved around by the firmware, this arrangement made sense when breadboarding the circuit.

The major drawback for this project to be presented as a kit is the size of the AD8317... it´s tiny!

A picture of the prototype attenuator printed circuit board:

The board is double sided, other side is unetched. A good number of holes need to be drilled between the two sides to connect them firmly together, especially close around any RF carrying paths (see the wide traces).

A picture of the test and development fixture:

If you look closely, you'll see that the HF3 relays used are actually 75 ohm type, hence a reduced frequency range, or only up to about 500 MHz. On this picture the attenuator board has been populated, but no shielding is in place yet. What looks like excessive solder splotches is stitching between the upper and under sides of the PCB, close to the traces conducting RF. Note the RG405 semi rigid coax used for the non-attenuated paths between the relays.

Here the shielding is mostly in place. Done with thin single sided PCB and aluminum tape.

Innards of the assembled project.

Another innards picture, showing the front panel as well, including the 20x4 LCD, push button and rotary encoder.

The assembled product is up and live. Wheee... here shown in "Signal Generator" mode.

Firmware Menu Functions:

All settings/parameters are controlled through a scroll-menu controlled by the push button and the rotary encoder. A short push is used to switch between the three main functions, the Power Meter, the Attenuator and the Signal Generator modes. A long push is used to enter the Configuration Menu. The rotary encoder is used to dial in the required attenuation, signal output levels or to select Menu Items in the Configuration Menu. The Configuration Menu Mode is used to adjust all relevant parameters. One of the Menu functions is the autocalibration feature, simply "dial in a known signal level" with the rotary encoder and push the button.

Some Menu examples follow:

The next two pictures below are old. The latest version of the firmware has facility to adjust 5 attenuator parameters:

  1. An External Front Attenuator of 0 - 70dB

  2. First attenuator, switch_in/switch_out in front of the AD8317

  3. Second attenuator (typically 30dB)

  4. Third attenuator (typically 60dB)

  5. Minimum attenuation when the Minicircuits ZX76-31R5-PP+ is set to 0dB.

Back to main page Back to main page

Back to main page

Back to main page

Back to main page

Back to main page