Improving the Performance of UKHASnet

Introduction

For a long period of time I’ve suspected that the UKHASnet network is underperforming, both on a local scale but also when we’ve tried long range tests such as high altitude balloons. The RF side of the network is suprisingly complex, far more then just bitrate and frequency and was originally setup based upon some previous trials and a little bit of ‘this works the best’ approach. Other systems that use the RFM69 radio module have used different settings but its a challenge to compare them as performance is influenced by a so many environmental factors.

Aim

I therefore set out to design and run an experiment to see if we could optimise our RFM69 settings and ideally make it back compatible with the current network (especially as some nodes cannot be reprogrammed with out significant effort).

Method

To easily test the performance of a UKHASnet network it was necessary to make it as simple as possible, I turned off all my local nodes and then selected 2 nodes which we would use for the experiments.

Node 1 – AB (Ebulobo PCB, ESP8266 + RFM69HW)

Node 2 – AC0 (Ebeko PCB, STM32F0 + RFM69HW)

While different architecture they use similar code and they use the same RFM69Config.h which meant that they could be interchangeable.

The actual experiment involved setting up the 2 nodes with the same RFM69Config.h file containing the settings and measuring the number of packets they received. They were placed in seperate rooms on the same floor and had 1/2 wave whips attached, the nodes weren’t moved during the experiments and were reflashed with the new settings each time. Initially I just counted the number of loops of ‘b’-‘z’ they went through but then switched to counting the number of of packets transmitted and received allowing me to calculate how efficient the system was functioning. I’ve included both sets of experiments as the more data the better.

Results

Experiment 1

SettingsVersionAB LoopsAB RxPer LoopAC0 LoopsAC0 RxPer LoopTotal Packet (approx)Total Rx%Rx
Standard0619632.6818322.970037954.1%
5Khz FDev, 2K baud, 10Khz BW1613121.8711716.765024838.1%
Standard + AFC Off3634757.8834843.570069599.3%
Standard + AFC On + Clear on each packet Off46599.87131.96507211.1%

Experiment 2

SettingsVersionAB TxAB RxPer PacketAC0 TxAC0 RxPer PacketTotal TxTotal Rx% Rx
Standard02911830.633131760.5660435959.4
Standard + AFC Off33883800.983883850.9977676598.6

 

rfexperiment

Conclusion

Looking at the current standard settings it seems that only about 55-59% of the packets get through – this seems to confirm real life experience. The nodes themselves are only 1 room apart so you would expect a far better success rate. Switching off the AFC makes an enormous difference to the packets received – up to 99% of packets transmitted were received. I suspect that the AFC is easily thrown off by local interference and actually the wide shift means that actually you don’t need the AFC.

I did try using an alternative setting as suggested by the datasheet and found that it was even worse (though it did have the AFC still turned on).

What is nice is that turning the AFC off can nearly double the efficiency of a local network yet remains backward compatible with the current network settings. It is probably worth testing this simple change on other local networks to see if the results are replicable. If there is an improvement it would be worth trialling the high altitude balloon flights and long range ground testing again.

New Settings (RFMConfig.h):

#ifndef RFM69Config_h
#define RFM69Config_h

#include "RFM69.h"

#define PACKET_VERSION 3

/*PROGMEM */ static const uint8_t CONFIG[][2] =
{
 { RFM69_REG_01_OPMODE, RF_OPMODE_SEQUENCER_ON | RF_OPMODE_LISTEN_OFF | RFM69_MODE_RX },
 { RFM69_REG_02_DATA_MODUL, RF_DATAMODUL_DATAMODE_PACKET | RF_DATAMODUL_MODULATIONTYPE_FSK | RF_DATAMODUL_MODULATIONSHAPING_00 },
 
 { RFM69_REG_03_BITRATE_MSB, 0x3E}, // 2000 bps
 { RFM69_REG_04_BITRATE_LSB, 0x80},
 
 { RFM69_REG_05_FDEV_MSB, 0x00}, // 12000 hz (24000 hz shift)
 { RFM69_REG_06_FDEV_LSB, 0xC5},
 //{ RFM69_REG_06_FDEV_LSB, 0x52},
 
 { RFM69_REG_07_FRF_MSB, 0xD9 }, // 869.5 MHz
 { RFM69_REG_08_FRF_MID, 0x60 }, // calculated: 0x80? 0x5F
 { RFM69_REG_09_FRF_LSB, 0x12 }, //0xBD
 
 //{ RFM69_REG_0B_AFC_CTRL, RF_AFCLOWBETA_ON }, // AFC Offset On
 { RFM69_REG_0B_AFC_CTRL, RF_AFCLOWBETA_OFF }, // AFC Offset Off
 
 // PA Settings
 // +20dBm formula: Pout=-11+OutputPower[dBmW] (with PA1 and PA2)** and high power PA settings (section 3.3.7 in datasheet)
 // Without extra flags: Pout=-14+OutputPower[dBmW]
 //{ RFM69_REG_11_PA_LEVEL, RF_PALEVEL_PA0_OFF | RF_PALEVEL_PA1_ON | RF_PALEVEL_PA2_ON | 0x18}, // 10mW
 { RFM69_REG_11_PA_LEVEL, RF_PALEVEL_PA0_OFF | RF_PALEVEL_PA1_ON | RF_PALEVEL_PA2_ON | 0x1f},// 50mW
 
 { RFM69_REG_12_PA_RAMP, RF_PARAMP_500 }, // 500us PA ramp-up (1 bit)
 
 { RFM69_REG_13_OCP, RF_OCP_ON | RF_OCP_TRIM_95 },
 
 { RFM69_REG_18_LNA, RF_LNA_ZIN_50 }, // 50 ohm for matched antenna, 200 otherwise
 
 { RFM69_REG_19_RX_BW, RF_RXBW_DCCFREQ_010 | RF_RXBW_MANT_16 | RF_RXBW_EXP_2}, // Rx Bandwidth: 128KHz
 //{ RFM69_REG_19_RX_BW, RF_RXBW_DCCFREQ_010 | RF_RXBW_MANT_24 | RF_RXBW_EXP_5}, // Rx Bandwidth: 10kHz
 //{ RFM69_REG_19_RX_BW, RF_RXBW_DCCFREQ_010 | RF_RXBW_MANT_16 | RF_RXBW_EXP_4}, // Rx Bandwidth: 31.1KHz
 
 //{ RFM69_REG_1E_AFC_FEI, RF_AFCFEI_AFCAUTO_ON | RF_AFCFEI_AFCAUTOCLEAR_ON }, // Automatic AFC on, clear after each packet
 { RFM69_REG_1E_AFC_FEI, RF_AFCFEI_AFCAUTO_OFF | RF_AFCFEI_AFCAUTOCLEAR_OFF }, // Automatic AFC off, clear off after each packet
 //{RFM69_REG_1E_AFC_FEI, RF_AFCFEI_AFCAUTO_OFF}, //AFC off
 
 { RFM69_REG_25_DIO_MAPPING1, RF_DIOMAPPING1_DIO0_01 },
 { RFM69_REG_26_DIO_MAPPING2, RF_DIOMAPPING2_CLKOUT_OFF }, // Switch off Clkout
 
 /* receiver timeout:
 * max packet length is 72 octets
 * (3 preamble, 2 sync, 1 length, 64 message, 2 CRC)
 * timeout interrupt is generated (value*16*Tbit) after RSSI interrupt if
 * PayloadReady interrupt doesn't occur so a value of 36 would correspond
 * to the packet duration but not allow for any other delays hence set to
 * 40
 */
 { RFM69_REG_2B_RX_TIMEOUT2, 40 },
 
 // { RFM69_REG_2D_PREAMBLE_LSB, RF_PREAMBLESIZE_LSB_VALUE } // default 3 preamble bytes 0xAAAAAA
 
 //{ RFM69_REG_2E_SYNC_CONFIG, RF_SYNC_OFF | RF_SYNC_FIFOFILL_MANUAL }, // Sync bytes off
 { RFM69_REG_2E_SYNC_CONFIG, RF_SYNC_ON | RF_SYNC_FIFOFILL_AUTO | RF_SYNC_SIZE_2 | RF_SYNC_TOL_0 },
 { RFM69_REG_2F_SYNCVALUE1, 0x2D },
 { RFM69_REG_30_SYNCVALUE2, 0xAA },
 { RFM69_REG_37_PACKET_CONFIG1, RF_PACKET1_FORMAT_VARIABLE | RF_PACKET1_DCFREE_OFF | RF_PACKET1_CRC_ON | RF_PACKET1_CRCAUTOCLEAR_ON | RF_PACKET1_ADRSFILTERING_OFF },
 { RFM69_REG_38_PAYLOAD_LENGTH, RFM69_FIFO_SIZE }, // Full FIFO size for rx packet
 // { RFM69_REG_3B_AUTOMODES, RF_AUTOMODES_ENTER_FIFONOTEMPTY | RF_AUTOMODES_EXIT_PACKETSENT | RF_AUTOMODES_INTERMEDIATE_TRANSMITTER },
 { RFM69_REG_3C_FIFO_THRESHOLD, RF_FIFOTHRESH_TXSTART_FIFONOTEMPTY | 0x05 }, //TX on FIFO not empty
 { RFM69_REG_3D_PACKET_CONFIG2, RF_PACKET2_RXRESTARTDELAY_2BITS | RF_PACKET2_AUTORXRESTART_ON | RF_PACKET2_AES_OFF }, //RXRESTARTDELAY must match transmitter PA ramp-down time (bitrate dependent)
 { RFM69_REG_6F_TEST_DAGC, RF_DAGC_IMPROVED_LOWBETA0 }, // run DAGC continuously in RX mode, recommended default for AfcLowBetaOn=0
 // { RFM69_REG_71_TEST_AFC, 0x0E }, //14* 488hz = ~7KHz
 {255, 0}
};

#endif