‪Power and SWR Meter, rev II

-  Now including a TFT touch and graphics display.


Back to main page

2017-04-20 Uploaded revision 1.01 of the TFT version.  A minor adjustment to keep the firmware compatible with rev 1.36 of Teensyduino (updated ADC library)
2017-02-11 Uploaded revision 1.00 of the TFT version.  Floor function added for the displayed power level, user settable at 1mW, 0.01mW, 1uW or no floor (noise floor is typically around 100nW)
2017-02-11 Added detailed instructions to compile source code.  Also added some info and pictures describing the Tandem Match Coupler and AD8307 bridge.
2017-01-27 Uploaded revision 0.99 of the TFT version. Bugfix of Reverse Calibration feature, used for accurate calibration of the AD8307 for the Rev signal.
2017-01-22 Uploaded revision 0.98 of the TFT version. Added TFT backlight adjust feature, added Display Rotate feature, Log-amp slope can now be configured in PSWR_T.h file
2016-12-15 Uploaded revision 0.98 of the LCD version. Encoder bugfix.
2016-11-22 Uploaded revision 0.96 of the TFT version. Minor cleanup, Background Picture now shown in screensaver mode.
2016-11-22 Uploaded revision 0.97 of the LCD version. Minor cleanup, better pushbutton management.
2016-11-14 Uploaded revision 0.96 of the LCD version. Fixes a pin assignment discrepancy for the Enact switch.
2016-09-05 Uploaded revision 0.95 of the firmware. USB commands are now case-insensitive and can be terminated by a ';'
2016-08-21 Uploaded revision 0.93 of the firmware. Getting pretty good.
2016-08-19 Uploaded revision 0.91 of the firmware. Some further improvements.
2016-08-17 Uploaded revision 0.90 of the firmware. Bug fixes and improvements.
‪First publication of page 2016-06-11.


The project described below is an update to this one. 

This update replaces the Teensy ++ 2.0 Microcontroller with the much more powerful Teensy 3.2 (32 bit ARM Cortex-M4 running at 96 MHz, see https://www.pjrc.com/teensy/teensy31.html).  

The measurement sampling rate has been increased from 200 to 1000 times per second (1500x if the microcontroller is overclocked at 144 MHz).  

Also, unlike the classic Atmel 8bit microcontrollers which only have one 10 bit A/D converter, this one has two A/D converters in parallel, capable of a simultaneous sampling of both the forward and the reverse input signals at a 12bit resolution.

The same circuits can be used for the RF power coupler and the AD8307 as in the original Power and SWR Meter Project, however a few new builds are shown below.

Alternately, a coupler with diode detectors can also be used.  See appropriate #define[s] in the PSWR_X.h file, included in the source code.  In this case one could for instance use a coupler like shown in the examples contained in the "BOM and Building Instructions document" at the bottom of my Magnetic Loop Controller page.  However this approach will of course greatly limit the useful range of the meter.

Two display alternatives are provided below, one similar to the original 20x4 character based LCD, and a new, much nicer looking alternative, using a 2.8 inch TFT display and touch screen.

All screenshots below are actual snapshots of the TFT LCD alternative.

All other functions, including calibration, setup and other configuration menu management, as well as USB interface commands and data polling, are similar to those described on the webpage for the original project.

As before, the full source code for the firmware is provided, at the bottom of the webpage.  Two zipped folders:

  • PSWR_T_xxx.zip contains the TFT LCD version.  
  • PSWR_I_xxx.zip contains the 20x4 LCD version.  

See more detailed description below.



The TFT and touch screen version of the meter, all boxed up in a small aluminum enclosure.  

 

and here is a new function provided by the TFT version, a modulation scope:


Before assembly:

Below, cutouts have been made in the box, it spray painted black and the LCD + touchpanel has been inserted.  

Note that appropriate spacers have to be used to ensure that the edges of the touchpanel do not come into contact with the box.

(Click on image to enlarge)

The grey box is the same as shown in the original Power and SWR Meter Project description, under the heading: 

"A third version, a combined Tandem Match Coupler and Detector Circuit".


Only one of the three connectors on the back panel is used for this project.  The other two are for prototyping purposes, one for I2C and the other to bring out a couple of I/O pins.
(Click on image to enlarge)


Here is a picture of the prototyping and test setup, not complex at all:

 

 



Below are two builds by Johan, PD0LEW.  The one on the right hand side is actually a Magnetic Loop Controller, but on this picture it is showing a display identical to the 20x4 LCD version of the meter:


 

Like the previous version, this one provides for instantaneous power reading, 100ms peak reading, 100ms average, 1s average and PEP.

This screen shows a steady carrier of 103W at an SWR of 2.5.  The PEP reading is visualized by a second bar, going further than the first one – just barely visible on this picture as the difference is less than 1%.

 

The bargraph scale is auto ranging, from microwatts to kilowatts, in the same manner as described in the previous Power and SWR Meter project.  However, now the default scales have been set to 11, 22 and 55, for max scale indication of 1.1, 2.2, 5.5, 11, 22, 55, 110, 220, 550... microwatts, milliwatts, watts...

Below we have an indication of an SSB signal.  Here the PEP bar is visible beyond the Peak Power bar.  SWR is above the Alarm setting of 3.0, so the Power level is now shown in Red and an Alarm Output has been set.

 

A single tap on the lower 1/3rd of the Touch Panel is used to clear the SWR Alarm.  Clearing the SWR Alarm reverts the Power indication back to Yellow and de-asserts the Alarm output signal (see schematic).


 

To cycle between display modes, tap on the upper 2/3rd of the Touch Panel

Here we are in the 100ms Average mode.  This mode works rather like an analog meter, movement is smooth and free of sudden jerks. 


I am showing signals with high SWR in order to better depict the SWR bar.

Here is a Display Mode showing Forward and Reverse Power in separate bargraphs:

Actual output power, of course, is FWD - REF.

Here is a Modulation Scope showing an SSB signal.  Maximum full-screen sweep rate is a tad bit slow, at 300ms.  By overclocking the Microcontroller at 144 MHz it is possible to speed this up to 200ms (1500 samples per second):



Last display mode selected is stored in EEPROM and will become default mode when the meter is powered up.

 



This mode is a bit silly (only accessible through Config Menu). Since the two topmost graphs are dual graphs, this is effectively 8 bargraphs being displayed at once:





The TFT touch screen is divided into the following areas to navigate the various modes:


Tap anywhere within the yellow area to cycle through the various modes
  • 100ms Peak Power, useful for SSB
  • 100ms Average Power, closely emulates an analog needle meter, useful for all modes
  • 1s Average Power, not sure how useful this one is for anything :)
  • Instantaneous Power
  • Power in dBm
  • Three bargraphs, including separate bargraphs for forward and reflected power
  • Modulation Scope
Note that the PEP bar indication is also visible in every mode.  PEP period is selectable in the Configuration Menu as 1, 2.5 or 5 seconds.

Any of the modes above, will become the "Default Mode" if left running for over 10 seconds.  When powered on, the Meter will start in the Default Mode.

Tap anywhere within the green area to switch between the Default mode and the Modulation Scope.  In case the Modulation Scope has been selected as Default Mode, the last mode selected as Default before selecting Modulation Scope, will be the "other" mode.

Tapping anywhere within the blue area will deactivate the SWR Alarm if activated (Power indicated in Red)

A long push (>1 second) in the blue area will enter into the Configuration Mode, While in the Configuration Mode, the above areas are deactivated and on-screen touch buttons are used instead to navigate.  see below.



While the TFT version of the Configuration Menu looks a bit nicer than the LCD version it provides the same functions as before.  Below are pictures of the top level menu functions.  For a description of the lower level menu items, see the web pages on the original Power and SWR Meter Project.

Use the on-screen touch buttons to navigate:







Schematic of the TFT and Touch Panel version:

(Click on schematic to enlarge)

The graphics screen  module is an ILI9341 240x320 SPI with an XPT2046 touch controller, available at pjrc.com or on eBay by using the search criteria:

“2.8” TFT SPI XPT2046” 

or similar.

 

The mechanical encoder + pushbutton circuit shown is optional, but can be used instead of the touch panel. 

Signals identified but unconnected, are for potential future expansion of the project.

R4, shown as 10 ohms controls the current to the TFT backlight.  Some people find the backlight to be too bright when using 10 ohms.  In that case, 22 or 33 ohms may be a better value.  In any case, Digital Pin 6 (8) provides a PWM modulated output that can be used for Menu controlled TFT brightness adjustment.  This will require some additional hardware, such as two generic low power (~200mA) transistors (1xNPN, 1xPNP) and two resistors, or a "high side switch", such as MIC2005.

The meter is powered through the USB port.

 

 

Schematic of the 20x4 LCD alternative:

(Click on schematic to enlarge)

Signals identified but unconnected, are for potential future expansion of the project.

The meter is powered through the USB port.



A slightly updated Detector Circuit and Tandem Match Coupler:


(Click on schematic to enlarge)


The circuit above is the same as with the original Power and SWR meter project, however a 22pF variable capacitor has now been added on the forward output to minimize  coupling between forward and reverse outputs.  An even higher capacitance may improve the isolation further, but this will then also start to reduce the sensitivity of the SWR reading.  In other words, 22pF looks like a good maximum value when using the same cores as I do, and 30 turns on the secondaries. (Please disregard the RF sample output.  This was being used for a different purpose :)


With 30 turns on the secondaries and the capacitor at 22 pF I get lowest SWR at 1.03 at 28 MHz when transmitting into a good dummy load.  1.13 at 50 MHz.  Two 50 ohm dummy loads in parallel should give an SWR of 2.0.  I get just over 1.85 at both 28 and 50 MHz, good enough. 


However - If you are using the meter for power levels of 600W or less, then I would recommend that you change the transformers to 20 turns.  This will give a much better isolation at the higher end of the band and may even make the meter perform well at 50 MHz.  In this case, the capacitor will also help even further, but I suspect  about 5 - 10pF would be a good setting.


Here is one recent build of the coupler circuit, capacitor has not been added:


(Click on picture to enlarge)


An improved layout, including gerber files, by Johan PD0LEW, based on the above, is now available at the Yahoo group: Power_and_SWR_Meter.


Here is another recent prototype, this time with some additional bells and whistles, like LiPo battery management and other stuff.  Not fully mature, so no details to be published :)


(Click on picture to enlarge)





Firmware for the Power and SWR Meter

The firmware is written in C and C++, using the Arduino Environment, with Teensy Extensions available here:  https://www.pjrc.com/teensy/td_download.html

The firmware is is free software, released under the GNU General Public License.

There are two versions, both of which contain the complete source code:

  • TFT version:            PSWR_T_xxx.zip  
  • 20x4 LCD version:  PSWR_I_xxx.zip

Note that certain firmware features can be tailored through modification of parameters in the PSWR_x.h file included in the source code for the firmware.

The firmware source code is commented throughout and should hopefully be relatively easy to understand/modify/expand/adapt.




Detailed instructions to compile and upload the firmware

First, download the Arduino environment, including the Teensyduino extension: https://www.pjrc.com/teensy/teensyduino.html

Make sure to select all Libraries when you install the Teensyduino extensions, the source code uses several of those.

Once you have the Arduino environment installed, then:

1.     Extract the zip file containing the TFT or LCD source code version.  A number of files will extract into a folder with the same name.  These files are the source code.

2.     Browse into the folder and double click on the file called PSWR_T_xxx.ino or PSWR_I_xxx.ino, this is the “master” file.  The Arduino software environment should now open a window displaying the source code.  If Arduino opened another window as well, called sketch something, just close that one.

The Source code window will have a number of tabs.  The first tab is the “master” file, the second tab is the PSWR_X.h file.  In the PSWR_X.h file you can change or tailor many things.  For instance look for this line:

#define STARTUPDISPLAY5         "TF3LJ / VE2AO" // You may want to indicate your own callsign :)


Note that any text written after “//” is regarded as comments and is ignored.

3.     In the Arduino Tools tab, double check that Teensy 3.1/3.2 is selected as a "Board:"

4.      In the Arduino Tools tab, set "Optimize" to "Faster with LTO".  If LTO is not selected, then the firmware will not run correctly.

5.     Connect the Teensy 3.2 microcontroller to the computer with a USB cable.

6.     In the top left corner of the Arduino window, click on either the tick sign or the right arrow.  Now everything should hopefully compile without errors and automatically load itself to the microcontroller.  No worries, if something went wrong, then nothing will be uploaded. 

That’s it.




That is all covered in this update.  For more information, please refer to the original project.

 



Web Site Hit Counter

To download any of the files below, please click on the down arrow ďat the right hand side of the file.

ċ
PSWR_I_098.zip
(55k)
Loftur Jónasson,
Jan 22, 2017, 5:30 PM
ċ
PSWR_T_100.zip
(823k)
Loftur Jónasson,
Feb 11, 2017, 11:14 AM
ċ
PSWR_T_101.zip
(760k)
Loftur Jónasson,
Apr 20, 2017, 7:43 PM
Comments