Documente Academic
Documente Profesional
Documente Cultură
This sketch will readout RF power and SWR from any SWR bridge (for example 'monimatch' type). As this 'monimatch' type of bridge is frequency dependant, the meter must be calibrated for
every band. Because my primary interest was for VHF/UHF/SHF, I have foreseen positions for 6m, 4m, 2m, 70 cm, 23cm and 13cm bands - but you can use the ARDUINO readout on HF as
well. If you intend to build a HF or VHF bridge yourself, there are several designs available on the web : I recommend to take a look at the information here, here , here and there !
When the band is selected/changed, the display indicated the 'full scale' of power readout. With my type of bridge (some breakout part of mobile radio base station I presume, but working well till
2.4 GHz - I purchased it on a local flea market...) the power ranges from 1kw (6m band) to 400mW (on 13cm). Other possibility is to build a directional coupler, many designs can be found on
the net. With my coupler, in the PEP power measurement mode, it is for example perfectly possible to measure the output of a WiFi access points ... Power range could be increased by adding
some resistive voltage dividing network, as the maximum input on ARDUINO is +5v. But is is essential that same power gives same voltage, both in 'forward' as 'reflected' mode (when the
coupler is turned around).
The meter is indented to be battery powered, therefore there is a circuit to control the LCD backlight (drawing a lot of current) and monitor the battery voltage.
Front panel of PWR & SWR meter. Left = power switch, middle = mode select push-button, right = band change push-button
Below is the sketch or download it here . It was compiled with IDE version 0022.- IMPORTANT : please use the same or you might get errors when compiling ! You still can download
previous versions from ARDUINO website . Download theconnection diagram (as pdf) here or a better schematic drawn by Vlado Z32AN here.
uncomment the calibration routine lines, this will show the VoltFWD value. Replace 2x the asterisks by a slash like below, and load the sketch in ARDUINO.
// /////////////////////////////////////////////////////
apply (for each band of interest) a known 'reference power', terminating the coupler by a dummy load (SWR = 1:1). This should produce a readout of VoltFWD, somewhere in the range
0 - 5000 (or just above 5000, as the diode voltage drop is added) - this is expressed in milliVolt. Ideally, this readout should be in the range 2000 - 4000 ('mid-scale'), adjust the
reference power accordingly. Let us assume that we measure on 145MHz 2500mV with 10w power, note this value.
repeat for each band
Now calculate - for each band - the calibration factor PowCALXX (XX= band), using the formula :
comment again the calibration routine, by replacing the two slashes by asterisks:
lcd.setCursor(0, 0);
lcd.print("VoltFWD= ");
lcd.print(VoltFWD, DEC);
delay(500);
*/ /////////////////////////////////////////////////////
Remarks :
it is be possible to measure the power not by using the 'FWD' voltage over the coupler, but directly by rectifying a sample of the RF, and measuring this voltage - which should be less
frequency dependant than the coupler method. I leave it up to you to implement this in your sketch... using another ARDUINO analog input port. This can be feasible on HF, VHF
... but might be more complex on UHF and above - therefore this approach was not realized in this project.
Depending on your coupler design, it can be required to 'load it' in order to have the output going to ground level when no RF-power is applied. ARDUINO analog inputs have a very
high impedance, so any stray voltage picked up can cause random readouts or 'beep-beep' when no RF-power is applied, in this case, put a 220k or 470k resistor from FWD and REFL
inputs to ground. Off course all wiring to coupler must be shielded and properly RF-decoupled !
The first time you power up the sketch, there is no ''last band/mode'' to retrieve from memory. Therefore, some fields will be empty on the display. After choice of band & mode for the
first time, this will show normal values ...
/*
**************************************************************
* POWER & SWR meter on 2x16 char LCD display *
* By ON7EQ Aug 2011 *
**************************************************************
The circuit:
* pin 13 = LCD backlight control (1= backlight ON). Use an emittor follower (like BC639) to control LCD backlight (this draws a
bout 120mA)
* pin A0 : SWR probe FWD voltage input (SWR bridge type 'MONIMATCH')
* pin A1 : SWR probe REFL voltage input
! Set the diode forward voltage in variable 'Diode'. For 1SS99 or other Schottky diodes, it is around 130mV @ 0,1mA
* pin Digital 2 : 'bip' Sound Switch : when grounded -> SWR 'bip' tone mode
* pin Digital 3 : PEP mode Switch : when grounded -> PEP mode
When switch in center position : normal power/swr mode, instant power & dBm readout
When using a center toggle switch, Pin 5 must be connected to +5v
If a 3-way toggle switch is present, it will be automatically detected and the variable 'PushButton' set accordingly.
* pin Digital 5 : Mode push button : when grounded (pulse), next mode is selected
BAND SELECT :
-------------
It can be necessary to apply different parameters / calibration factors per band.
* pin Digital 6 : BAND push button : when grounded (pulse), next band is selected
! the band is stored in EEPROM & memorized for next boot
*/
// variables
#define VoltSupplyMini (66) // minimum battery voltage expressed in 100mV (if lower, alarm is generated)
// // for µ7805, minimum 7v required
#define R1 (12) // from GND to A5, express in 100R (12 = 1200 Ohm)
#define R2 (47) // from + power supply to A5, express in 100R (47 = 4700 Ohm)
char* myStrings[]={" HF ", " 6m ", " 4m "," 2m ", " 70cm"," 23cm"," 13cm"};
////////////////////////////////////////////////////////////////////////////////////////////
// modes
byte PEP = (1); // 0 if PEP measured
byte Tone = (1); // 0 if tone SWR tune (bip)
byte MODE = (0); // Mode 0 = instant power / Mode 1 = PEP / Mode 2 = Bip
byte BAND =(0); // BAND 0 = HF / 1 = 6m / 2 = 4m / 3 = 2m / 4 = 70cm / 5 = 23cm / 6 = 13cm
float VoltFWD = 0;
float VoltFWDmax = 0;
float VoltPEP = 0;
float VoltREF = 0;
int VoltFWDmini = 0;
// *************************************************************
// ******************** S E T U P ************************
// *************************************************************
void setup() {
//setup pins
pinMode(LCDbacklight, OUTPUT); //Backlight LCD display
pinMode(PEPswitch, INPUT); // if grounded --> 'PEP' mode
pinMode(ToneSwitch, INPUT); // if grounded --> 'Bip' mode
pinMode(ModeSwitch, INPUT); // if grounded --> cycle through modes
pinMode(BANDSwitch, INPUT); // if grounded --> cycle through bands
// lcd.setCursor(0, 1);
// lcd.print("by ON7EQ 08/2011");
// delay (2000);
lcd.setCursor(2, 0);
lcd.print("QRV on");
lcd.print( myStrings[BAND]);
clearline1();
lcd.setCursor(2, 1);
lcd.print("Pmax = ");
else {
if (PWRmax < 1) {
else {
PowDis = PWRmax ;
//format PowDis
// set timers
DisplayTime = millis ();
BacklightTime = millis ();
} // end of setup
// *************************************************************
// *********************** L O O P ************************
// *************************************************************
void loop() {
beeponce = 0;
MODE = MODE + 1;
if (MODE >= 3) MODE = 0;
}
}
beepband = 0;
BAND = BAND + 1;
//show band
lcd.setCursor(11, 1);
lcd.print( myStrings[BAND]);
else {
if (PWRmax < 1) {
else {
PowDis = PWRmax ;
//format PowDis
// read sensors
// PEP detect
// decay
else if ((millis() - PeakTime) > 400) { // 400 = PEP Peak hold time
VoltFWDmax = VoltFWDmax / (decay + 0.3);
PeakTime = millis ();
decay = decay + 1; //decay
}
// =========================================================
// ************ Refresh LCD display Routine ****************
// =========================================================
void refreshdisplay () {
DisplayCycle = DisplayCycle ++ ;
// LCD Backlight
if (VoltFWD>0) {
digitalWrite(LCDbacklight,1) ; // turn backlight on
BacklightTime = millis (); //set timer
}
else if (((millis() - BacklightTime) > 8000)) { // 8 seconds backlight
digitalWrite(LCDbacklight, 0) ; // turn backlight off
}
// Overrange detect
else {
else {
//format PowDis
tone(TonePin,2500);
delay (200) ;
noTone(TonePin);
//process REF
// POWER Display
lcd.setCursor(0, 0);
lcd.print("Pwr ");
lcd.setCursor(0, 0);
lcd.print("VoltFWD= ");
lcd.print(VoltFWD, DEC);
delay(500);
*/ //////////////////////////////////////////////////////
else {
PowDis = PWR * 10;
else {
PowDis = PWR * 10;
if (PowDis/10 < 100) {
lcd.print(" ");
}
if (PowDis/10 < 10) {
lcd.print(" ");
}
lcd.print((PowDis/10), DEC);lcd.print(".");
lcd.print((PowDis)%10, DEC);
lcd.print("w (PEP)");
}
}
// SWR Display
lcd.setCursor(11, 1);
lcd.print( myStrings[BAND]);
lcd.setCursor(0, 1);
lcd.print("SWR ");
else if ( (VoltFWD > (Diode+1)) & (VoltFWD < (VoltFWDmini)) & (VoltREF <= (Diode+1))){ // at low power no SWR display or <
1.5
lcd.print("<1.5 ");
}
else {
Vratio = VoltREF / VoltFWD;
// Check ROUTINE
else {
SWRDis = SWR * 10;
lcd.print((SWRDis/10), DEC);lcd.print(".");
lcd.print((SWRDis)%10, DEC);
lcd.print(" ");
}
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Batt Volt=");
if (SupplyVoltage < 100) {
lcd.print(" ");
}
if (SupplyVoltage < 10) {
lcd.print(" ");
}
lcd.print((SupplyVoltage/10), DEC);
lcd.print(".");
lcd.print((SupplyVoltage)%10, DEC);
lcd.print("v");
if (SupplyVoltage <= VoltSupplyMini) {
lcd.setCursor(2, 1);
lcd.print("LOW BATTERY !");
}
delay (1500);
}