Skip to content
K7MDL edited this page May 8, 2024 · 35 revisions

RF-Power-Meter (aka RF Wattmeter) with Band Decoder

Arduino (Teensy 4.x, M5Stack) or PSoC5LP based RF wattmeter with optional Python based remote monitoring and control desktop app. OLED screen and/or Nextion Touchscreen is optional. The Teensy 4 version added highly flexible band decoder features. I use this one remotely located outdoors with a multiband transverter, hi power amps, antennas and RF coupler switches.

May 8, 2024

I am running the Python based Desktop app on Linux Mint with no changes. There is a slight difference in the font size squeezing some text areas a small amount but completely usable as is. I have also created an example desktop file with IP address and port changes to allow another instance to run for a 2nd board. You must make the matching changes in the Teensy firmware of that 2nd board.

The firmware and Desktop App now support bands 160M though 3cm (10Ghz). A new Edit Meter Table page in the Desktop_App created to allow selecting and editing any of the bands. EEPROM will have to be overwritten for exiting systems taking this upgrade. Save your calibration values (dump command/button). It is easiest to plug them into the Band Data Table structure in the firmware so they are written into the EEPROM for you.

April 15, 2022

A PCB was created to be RFI resistant and easy to build. Tested successfully without a case and 500W at 144MHz 20 feet away. Retested in a metal case with OLED display.

A new PCB version folder contains the PCB files and a complete copy of the dependent files, many of them for the optional Nextion display. Several pin assignments were changed for the PCB and configuration also for changes in input and output state inversions with the opto-couplers now used.

I have only built the first version PCB and so have not tested the later PCB files. A new version of code was spun off to suit the hardware changes on the PCB for the old prototype board which used ULN2803 drivers. This PCB uses lots of dual optocouplers. The WIKI pages are still 99% applicable to the new PCB.

A BOM (parts list) is at this page: https://github.com/K7MDL2/RF-Power-Meter-V1/wiki/PCB-V1.0-BOM.

One significant feature change: I used an external SwitchDocs Labs watchdog card since I operate remote often and had RFI issues locking up the CPU at times on the proto board. There is a WD library for an internal Teensy WD timer I have incorporated, it seems to work well so I am now using it. A #define chooses which one you want to use. If you do not want a WD timer, then choose the external WD, since there is no hardware, nothing will happen.

I had 8 boards made, one is built and in service now, the 7 others are available for interested builders. There are only a few board errors easily fixed.

  1. 3 intersecting traces shorted near J13. Cut the short vertical 3.3V trace to Pin 1 of J13 in 3 places to isolate the 2 horizontal J13 voltage input lines. The 3.3V is not used for anything so can be left cut.
  2. 1 missing 3.3V trace for the ADC module. Run a wire to a via hole.
  3. The wrong size 2x3 pin header (1mm pitch vs 2mm pitch) for the optional onboard ethernet/USB2 combo jack. I used a stock Teensy ethernet ribbon cable and cut off one connector, then soldered the wires into the holes. It is a bit delicate since the holes are only 1mm apart and ribbon cable insulation melts easily, just be quick. I routed traces for the USB and enet on the revised boards.
  4. A few parts may not fit perfectly depending on what you have in your junk box or is in stock.
  5. The D-Sub connecters are not spaced far enough apart to fit the bulkier connector shells I had here. They are spaced a bit more apart on the newer PCB files. I also allowed for standard axial leaded diodes as they can support larger currents and everything has some laying around. Many other improvements were made, mostly fine tuning parts placement and footprints and improving routing.
  6. I added low current and filtered switched 12V to pin 15 of each of the 2 stacked D-Sub 15 output port connectors (Port A and Port B). The onboard fuse I used is 1.5amp pico-fuse and the diodes you use should be large enough to match the fuse rating. The traces are plenty big.

The files are produced by ExpressPCBschematic editor and PCB layout tool and ordered online via their PCB tool. These are about 6" x 6" and 8 boards averaged about $38USD each. I had them quick in about 5 days. Most parts are available from DigiKey. The opto-couplers are MOCD223M dual 8 pin SMD. I will post a BOM to the WIKI page later.

Here is the V1 board on the test bench

Nov 2020

Release V2.3 issued Nov 2020.

Build your own RF milli-wattmeter for HF though microwave frequencies with low cost off the shelf modules and some glue wiring and a box. See Wiki page for System Components listing with source links and approximate costs.

Version 1.0 RF Power Meter code runs on a M5Stack (http://M5Stack.com) Arduino CPU module.

V1.02 added support for running headless on the Arduino Nano, added external ADS1100 16bit ADC for M5stack. Ported to Cypress Semiconductors PSoC5LP CY8CKIT-059 dev module (~$10 each) with a high quality internal 20bit AD converter for lower noise and higher accuracy in similar form factor as the Nano. An external I2C connected ADS1100 or ADS1115 module can be used with any platform, for the Arduinos it will improve performance compared the lower resolution and usually noisy Arduino internal AD converters. Added a Python Desktop app for remote config and monitoring. Added OLED and Nextion screens support to the PSoC5 version.

The latest version is Teensy 4.1 based Arduino with USB or ethernet remote operation. The Desktop UI app can also control my Arduino headless rotator controller (USB or ethernet also).

Optionally leverages WSJT-X status message UDP broadcasts to read the radio dial frequency and automatically command the meter to load the appropriate calibration values (10 bands supported). Using the awesome Python library to decode WSJT-X packets and is found at https://github.com/bmo/py-wsjtx.

This GitHub Project Wiki has several pages covering build, setup, and operation of the RF Wattmeter and the app. You should see the pages listed on the right. The newest features are on the PSoC5 platform followed by the Arduinos as time permits.

A web page with additional info on this project can be found at https://k7mdl2.wixsite.com/k7mdl/arduino-rf-remote-wattmeter

Here is the assembled M5Stack system minus the dual directional coupler:

Here is a screen snapshot of the companion Remote RF Power Meter application

You can also run it without the title bar. Use File -> Exit to quit the program. The position is hardcoded so you can change it in the code. To hide the title bar start the program from the command line with HIDE or hide as the 3rd argument. Example (usually used in a shortcut)

"C:\Program Files (x86)\Python38-32\python.exe" "D:\Documents\GitHub\RF-Power-Meter-V1\pyRFPowerMeter.py" COM11 100 HIDE

Desktop App running without title bar

The Desktop Application's Configuration Page:

Desktop App Configuration page

Here is a 2.4" Nextion touchscreen version driven by a PSoC5LP with 20bit internal ADC. This shows the main page but there are about 7 total pages, one is a graph of power and SWR, others are for configuration and calibration, and manual band selection. 2.4: Nextion with PSoC CPU, ADL5519 Detector, USB hub, 5V power 2.4" Nextion screen PSoC version in box.

Here I built a new 1296MHz RF amp in Nov 2020 and used a PSoC5 KitProg board to create a very compact OLED version of the RF Wattmeter. It has voltage dividers to measure the 14 and 28V inside, measured the ADL5519 dual power detector temperature. I configured a DAC and buffer amp to create a 0-4VDC signal representing SWR between 1 and 5 to trip the amplifier in case of HISWR > 3.0. 1296MHz Amplifier with Compact OLED Wattmeter mounted.

In November 2020 I added minor code to a 915Mhz LoRa radio link inserted between the Nextion screen and CPU. Remote commands and monitoring remove the requirement for a local display screen enabling this to run on simple inexpensive Arduino boards for lower cost, simpler packaging and remote placement of the detector and CPU. Enabling wireless will be that more compelling for remote placements.

Here is a 3.5" Screen updated to match the 2.4" showing OTRSP Band Decoder messages (From N1MM+ or other logging program).

3.5" Nextion Display with OTRSP Band Decoder Status

The meter features 11 “Bands” or sets of calibration values. Each set contains Band Name, Forward and Reflected Port Coupling Factor, slope and intercept numbers. The coupling factor is a value in dB representing the coupler port’s coupling factor plus any added attenuators and minor cabling and detector related variances at a given frequency.

Direct Band changes (11 bands) are possible using serial port 1 byte commands in addition to emulating the hardware buttons to change Band, Scale, SWR. Saves a lot of time cycling through 11 bands. Since this is VHF and microwave focused in my default config provided the first band is HF and is mostly a place to park the meter when the coupler is not connected. Most HF radios have SWR meters so I have focuses on VHF+ bands where off the shelf SWR meters are hard to find/afford/use at high power and UHF+ frequencies.

RF power detectors: 2 Log Power Detectors (2 single one 1 dual) are used with their outputs fed to the ADC input of the CPU module. They connect to a coupler of your choice. You could likely also use RF detector outputs built into some transverters and amps, or diode based detector designs (such as from W6PQL or W1GHZ).

I started this project using a pair of AD8318 based imported modules commonly found online. They are under $10 each these days. It covers up to 8GHz, might work well enough to 10GHz, I have not checked yet. You could use any RF detector as long as you stay within (or scale) the limits of your CPU's ADC input voltage spec. My latest hardware builds are using a ADL5519 dual detector rated for 10GHz. It is 2 AD8318s on the same chip. The current version now has a commands to calculate slope and intercept for any detector, inverted or not. The AD8318 outputs an inverted voltage curve between 0.5 and 2.2VDC compared to the AD8307 600MHz detector which outputs a normal rising slope voltage from 0 to 2.XVDC with rising power input level. Beware some Arduinos and other CPU ADCs may not read accurately at the extreme ends of the their ADC range. The 0.5V offset in the AD8318 type detectors avoid this problem.

The first version I built was based on the M5Stack CPU module. The detectors is external in a small metal box to house the detector module(s), includes 9V and 5V regulators, and is powered from 12V. The 5V is powered from the 9V to reduce heating and is used to supply the power to the M5Stack Arduino via the USB port. You could put the Arduino in the same box as the detector to save cabling and cost. That will be the case for the headless version planned (future). In later builds I used the PSoC5 dev module CY8CKIT-059 with OLED and Nextion LCD graphic displays (2.4" and 3.5"). The detector and CPU are in the same metal box with a 12V and USB connection. The display is 2 wire serial plus GND and +5V so can be remoted over some length of 2 pair shielded cable, say from near your RF cabling to your station desktop. Again, no display is required as the Python Desktop Remote monitor and Control app can replace any local screens. You can use all at the same time if desired.

RF Remote Power Meter application: The RF Remote Power Meter companion application is a small GUI display app that monitors the Power Meter USB serial data information messages. The typical message contains the Meter ID, a sequence number, Band Name, Forward Power, Reflected Power, a SWR value. The data values for both forward and reflected power are sent out in dBm and Watts for convenience. Other message types exist for dumping the cal table and certain status messages such as cal start and end. A configuration screen handles power cal for each band. Simply apply a RF carrier at 2 known power levels (one hi, one lo) and the CPU will calculate the calibration numbers at at that frequency. Do this for each band you will use.

One simple feature of the app is to turn the SWR value field background red for SWR value > 3.0 (or any number you want in the script). If using WSJT-X the app will automatically change the Power Meter’s calibration set to match the current radio frequency band. Otherwise there are manual band buttons in the app to change the meter’s current calibration set. The Python script code contains lots of usage and configuration details in the comments at top of the file. If using the Nextion graphics screens, there are similar controls for most config and calibration operations. The Nextion screen now features power and SWR graphing and voltage and temp setpoints for additional parameter monitoring in usage scenarios such as station power monitoring or embedding into a high power RF amplifier chassis.

Snapshot on 432Mhz with a well matched antenna

Sample on 1296 with a not so good antenna match. Over 3.0 and SWR will turn to RED.