a SWR meter (3..30MHz, 100W..2KW) for arduino and raspberry pi


Edsard Boelen, 20-feb-2015
Fox Delta sells digital SWR kits in two parts, an analogue and a display part. The display part uses a pic microcontroller with a 16x2 character display. That can be replaced by a much fancier arduino or raspberry pi. At the same time, with the AD8307, accurate power meters can be made. Nice to include that too.

build the hardware





calibrate it


To calibrate it, known values have to be used. i.e. a known amount of power should be sent to a known load of which the SWR is 0.
A dummy load will do that. To set the proper reverse power measurement, just switch the connectors.
The better the dummy load and the closer it is to the swr meter, the better the accuracy.
For me accuracy is not the biggest issue so I made a dummy load out of 20 5W resistors of 1k.


I have used an arduino with the lcd button shield in this test. But any lcd screen can be used. The code simply measures the peak voltage on 2 analog inputs. After 5 sec, the values are reset to zero.
The code is as follows and can be dowloaded here
//swr calibrate tool, connect to fox delta hf bridge (fd-hfb2) as follows:
// sub d pin 1 -> +5v on arduino
// pin 2 -> gnd
// pin 3 -> A1
// pin 4 -> A2

#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);           // select the pins used on the LCD panel

int peakForward;
int peakReverse;
int counter;

void setup(){
   pinMode(A0,INPUT);
   pinMode(A1,INPUT);
   pinMode(A2,INPUT);
   lcd.begin(16, 2);               // start the library
   peakForward =0;
   peakReverse =0;
   counter = 0;
}
 
void loop(){
  counter++;
  if(counter==1000){
    counter=0;
    peakForward=0; 
    peakReverse=0;
  }
   lcd.setCursor(9,1);             // move cursor to second line "1" and 9 spaces over
   lcd.print(millis()/1000);       // display seconds elapsed since power-up

   lcd.setCursor(0,0);
   char buffer[20];
   
   if(analogRead(1) > peakForward){
       peakForward = analogRead(1);
   }
   if(analogRead(2) > peakReverse){
       peakReverse = analogRead(2);
   }
   sprintf(buffer,"v1 %d v2 %d     ",peakForward,peakReverse );
   lcd.print(buffer);
   
}

here is an image of the swr bridge connected to the analog1 and analog 2 pins of the arduino.




Experiment !