Heltec Wireless Tracker to ESP32C3 Mini via LORA

Greetings humans. I'm attempting to have a Heltec Wireless Tracker communicate via Lora to an ESP32c3 Mini. While the infamous Sandeep Mistry Lora Library has worked for me previously I'm using the BeeGee Toyko library instead for this project (GitHub - beegee-tokyo/SX126x-Arduino: Arduino library to use Semtech SX126x LoRa chips and modules to communicate).

ESP32C3 Mini pinout

With my amateur, Grade 2 Wikipedia knowledge on the topic and endless acronyms I'm wondering if I have it set up correctly. Both pieces of hardware have previously successfully worked with other projects so I don't think this isn't a hardware or antenna issue. My Lora Parameters for both devices are as follows:

// Define LoRa parameters
#define RF_FREQUENCY 915000000  // Hz
#define TX_OUTPUT_POWER 20		// dBm
#define LORA_BANDWIDTH 0		// [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved]
#define LORA_SPREADING_FACTOR 7 // [SF7..SF12]
#define LORA_CODINGRATE 1		// [1: 4/5, 2: 4/6,  3: 4/7,  4: 4/8]
#define LORA_PREAMBLE_LENGTH 8  // Same for Tx and Rx
#define LORA_SYMBOL_TIMEOUT 0   // Symbols
#define LORA_FIX_LENGTH_PAYLOAD_ON false
#define LORA_IQ_INVERSION_ON false
#define RX_TIMEOUT_VALUE 3000
#define TX_TIMEOUT_VALUE 3000

The default Heltec pins match perfectly from the library provided out of the box. This leads to believe I have a software configuration issue specific to the Mini as I have to manually remap the pins for the ESP32C3 Mini. Here's what I have:

int PIN_LORA_RESET = 0;  // LORA RESET
int PIN_LORA_DIO_1 = 1; // LORA DIO_1
int PIN_LORA_BUSY = 2;  // LORA SPI BUSY
int PIN_LORA_NSS = 7;  // LORA SPI CS
int PIN_LORA_SCLK = 4;  // LORA SPI CLK /// same as SCK
int PIN_LORA_MISO = 5;  // LORA SPI MISO
int PIN_LORA_MOSI = 6;  // LORA SPI MOSI
int RADIO_TXEN = -1;	 // LORA ANTENNA TX ENABLE
int RADIO_RXEN = -1;	 // LORA ANTENNA RX ENABLE

Both devices accept my code and load properly however nothing happens after initially loading with some serial out put (both have identical output with the exception of the BoardId):

=====================================
SX126x PingPong test
=====================================
MCU Espressif ESP32
BoardId: 00-00-5C-F8-C0-23-B3-E4
Starting lora_hardware_init
Starting Radio.Rx
OnRxTimeout

Questions:
How's my pin configuration look?
Shouldn't the ping pong ping pong?
What else would you recommend I try to do to get these two devices to see each other?

I'm open to other libraries and suggestions on getting these two devices to play happy with each other. Any advice would be greatly appreciated. Thank you random people on the internet in advanced for reading my post and giving me some insight on what you think I should try next.

Worth Mentioning: The specific code I'm attempting to run from the above library is the Ping Pong example found here: SX126x-Arduino/examples/PingPong/PingPong.ino at master · beegee-tokyo/SX126x-Arduino · GitHub

What is the issue?

Thanks for the reply. When I run the example code nothing happens after some initial output. I thought a ping pong example would ping and pong. The only factor I can see affecting this is how I've configured my ESPC3 Mini pin remapping. The issue is lack of pinging and ponging.

It could help if you posted the actual code you are using and provided links to the LoRa modules you are using.

Fair. I actually did post the actual code - just not all of it. I thought posting only the relevant parts would save space and zero in on the issue as per my original post. Nevertheless here is the actual code:

#include <Arduino.h>

#include <SX126x-Arduino.h>
#include <SPI.h>

hw_config hwConfig;

#ifdef ESP32 
// ESP32 - SX126x pin configuration -- ESP32C3 MINI
int PIN_LORA_RESET = 0;  // LORA RESET
int PIN_LORA_DIO_1 = 1; // LORA DIO_1
int PIN_LORA_BUSY = 2;  // LORA SPI BUSY
int PIN_LORA_NSS = 7;	// LORA SPI CS
int PIN_LORA_SCLK = 4;  // LORA SPI CLK /// same as SCK
int PIN_LORA_MISO = 5;  // LORA SPI MISO
int PIN_LORA_MOSI = 6;  // LORA SPI MOSI
int RADIO_TXEN = -1;	 // LORA ANTENNA TX ENABLE
int RADIO_RXEN = -1;	 // LORA ANTENNA RX ENABLE
#endif

// #ifdef ESP32
// // ESP32 - SX126x pin configuration - Heltec V3
// int PIN_LORA_RESET = 12 ; // LORA RESET
// int PIN_LORA_DIO_1 = 14; // LORA DIO_1
// int PIN_LORA_BUSY = 13; // LORA SPI BUSY
// int PIN_LORA_NSS = 8; // LORA SPI CS
// int PIN_LORA_SCLK = 9; // LORA SPI CLK
// int PIN_LORA_MISO = 11; // LORA SPI MISO
// int PIN_LORA_MOSI = 10; // LORA SPI MOSI
// int RADIO_TXEN = -1; // LORA ANTENNA TX ENABLE
// int RADIO_RXEN = -1; // LORA ANTENNA RX ENABLE
// #endif

// Function declarations
void OnTxDone(void);
void OnRxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr);
void OnTxTimeout(void);
void OnRxTimeout(void);
void OnRxError(void);
void OnCadDone(bool cadResult);

// Check if the board has an LED port defined
#ifdef ESP32
#define LED_BUILTIN 8 //ESP32Mini Led
//#define LED_BUILTIN 21 Heltec Led
#endif

// Define LoRa parameters
#define RF_FREQUENCY 915000000  // Hz
#define TX_OUTPUT_POWER 20		// dBm
#define LORA_BANDWIDTH 0		// [0: 125 kHz, 1: 250 kHz, 2: 500 kHz, 3: Reserved]
#define LORA_SPREADING_FACTOR 7 // [SF7..SF12]
#define LORA_CODINGRATE 1		// [1: 4/5, 2: 4/6,  3: 4/7,  4: 4/8]
#define LORA_PREAMBLE_LENGTH 8  // Same for Tx and Rx
#define LORA_SYMBOL_TIMEOUT 0   // Symbols
#define LORA_FIX_LENGTH_PAYLOAD_ON false
#define LORA_IQ_INVERSION_ON false
#define RX_TIMEOUT_VALUE 3000
#define TX_TIMEOUT_VALUE 3000

#define BUFFER_SIZE 64 // Define the payload size here

static RadioEvents_t RadioEvents;
static uint16_t BufferSize = BUFFER_SIZE;
static uint8_t RcvBuffer[BUFFER_SIZE];
static uint8_t TxdBuffer[BUFFER_SIZE];
static bool isMaster = true;
const uint8_t PingMsg[] = "PING";
const uint8_t PongMsg[] = "PONG";

time_t timeToSend;

time_t cadTime;

uint8_t pingCnt = 0;
uint8_t pongCnt = 0;

void setup()
{
	pinMode(LED_BUILTIN, OUTPUT);
	digitalWrite(LED_BUILTIN, LOW);

	// Define the HW configuration between MCU and SX126x
	hwConfig.CHIP_TYPE = SX1262_CHIP;		  // Example uses an eByte E22 module with an SX1262
	hwConfig.PIN_LORA_RESET = PIN_LORA_RESET; // LORA RESET
	hwConfig.PIN_LORA_NSS = PIN_LORA_NSS;	 // LORA SPI CS
	hwConfig.PIN_LORA_SCLK = PIN_LORA_SCLK;   // LORA SPI CLK
	hwConfig.PIN_LORA_MISO = PIN_LORA_MISO;   // LORA SPI MISO
	hwConfig.PIN_LORA_DIO_1 = PIN_LORA_DIO_1; // LORA DIO_1
	hwConfig.PIN_LORA_BUSY = PIN_LORA_BUSY;   // LORA SPI BUSY
	hwConfig.PIN_LORA_MOSI = PIN_LORA_MOSI;   // LORA SPI MOSI
	hwConfig.RADIO_TXEN = RADIO_TXEN;		  // LORA ANTENNA TX ENABLE
	hwConfig.RADIO_RXEN = RADIO_RXEN;		  // LORA ANTENNA RX ENABLE
	hwConfig.USE_DIO2_ANT_SWITCH = true;	  // Example uses an CircuitRocks Alora RFM1262 which uses DIO2 pins as antenna control
	hwConfig.USE_DIO3_TCXO = true;			  // Example uses an CircuitRocks Alora RFM1262 which uses DIO3 to control oscillator voltage
	hwConfig.USE_DIO3_ANT_SWITCH = false;	 // Only Insight ISP4520 module uses DIO3 as antenna control

	// Initialize Serial for debug output
	Serial.begin(115200);

	Serial.println("=====================================");
	Serial.println("SX126x PingPong test");
	Serial.println("=====================================");

#ifdef NRF52_SERIES
	Serial.println("MCU Nordic nRF52832");
	pinMode(30, OUTPUT);
	digitalWrite(30, HIGH);
	// Start BLE if we compile for nRF52
	initBLE();
#endif
#ifdef ESP32
	Serial.println("MCU Espressif ESP32");
#endif
#ifdef ESP8266
	Serial.println("MCU Espressif ESP8266");
#endif

	uint8_t deviceId[8];

	BoardGetUniqueId(deviceId);
	Serial.printf("BoardId: %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n",
				  deviceId[7],
				  deviceId[6],
				  deviceId[5],
				  deviceId[4],
				  deviceId[3],
				  deviceId[2],
				  deviceId[1],
				  deviceId[0]);

	// Initialize the LoRa chip
	Serial.println("Starting lora_hardware_init");
	lora_hardware_init(hwConfig);

	// Initialize the Radio callbacks
	RadioEvents.TxDone = OnTxDone;
	RadioEvents.RxDone = OnRxDone;
	RadioEvents.TxTimeout = OnTxTimeout;
	RadioEvents.RxTimeout = OnRxTimeout;
	RadioEvents.RxError = OnRxError;
	RadioEvents.CadDone = OnCadDone;

	// Initialize the Radio
	Radio.Init(&RadioEvents);

	// Set Radio channel
	Radio.SetChannel(RF_FREQUENCY);

	// Set Radio TX configuration
	Radio.SetTxConfig(MODEM_LORA, TX_OUTPUT_POWER, 0, LORA_BANDWIDTH,
					  LORA_SPREADING_FACTOR, LORA_CODINGRATE,
					  LORA_PREAMBLE_LENGTH, LORA_FIX_LENGTH_PAYLOAD_ON,
					  true, 0, 0, LORA_IQ_INVERSION_ON, TX_TIMEOUT_VALUE);

	// Set Radio RX configuration
	Radio.SetRxConfig(MODEM_LORA, LORA_BANDWIDTH, LORA_SPREADING_FACTOR,
					  LORA_CODINGRATE, 0, LORA_PREAMBLE_LENGTH,
					  LORA_SYMBOL_TIMEOUT, LORA_FIX_LENGTH_PAYLOAD_ON,
					  0, true, 0, 0, LORA_IQ_INVERSION_ON, true);

	// Start LoRa
	Serial.println("Starting Radio.Rx");
	Radio.Rx(RX_TIMEOUT_VALUE);

	timeToSend = millis();
}

void loop()
{
	// We are on FreeRTOS, give other tasks a chance to run
	delay(100);
	yield();
}

/**@brief Function to be executed on Radio Tx Done event
 */
void OnTxDone(void)
{
	Serial.println("OnTxDone");
	Radio.Rx(RX_TIMEOUT_VALUE);
}

/**@brief Function to be executed on Radio Rx Done event
 */
void OnRxDone(uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
{
	Serial.println("OnRxDone");

	delay(10);
	BufferSize = size;
	memcpy(RcvBuffer, payload, BufferSize);

	Serial.printf("RssiValue=%d dBm, SnrValue=%d\n", rssi, snr);

	for (int idx = 0; idx < size; idx++)
	{
		Serial.printf("%02X ", RcvBuffer[idx]);
	}
	Serial.println("");

	digitalWrite(LED_BUILTIN, HIGH);

	if (isMaster == true)
	{
		if (BufferSize > 0)
		{
			if (strncmp((const char *)RcvBuffer, (const char *)PongMsg, 4) == 0)
			{
				Serial.println("Received a PONG in OnRxDone as Master");

				// Wait 500ms before sending the next package
				delay(500);

				// Check if our channel is available for sending
				Radio.Standby();
				Radio.SetCadParams(LORA_CAD_08_SYMBOL, LORA_SPREADING_FACTOR + 13, 10, LORA_CAD_ONLY, 0);
				cadTime = millis();
				Radio.StartCad();
				// Sending next Ping will be started when the channel is free
			}
			else if (strncmp((const char *)RcvBuffer, (const char *)PingMsg, 4) == 0)
			{ // A master already exists then become a slave
				Serial.println("Received a PING in OnRxDone as Master");
				isMaster = false;
				Radio.Rx(RX_TIMEOUT_VALUE);
			}
			else // valid reception but neither a PING or a PONG message
			{	// Set device as master and start again
				isMaster = true;
				Radio.Rx(RX_TIMEOUT_VALUE);
			}
		}
	}
	else
	{
		if (BufferSize > 0)
		{
			if (strncmp((const char *)RcvBuffer, (const char *)PingMsg, 4) == 0)
			{
				Serial.println("Received a PING in OnRxDone as Slave");

				// Check if our channel is available for sending
				Radio.Standby();
				Radio.SetCadParams(LORA_CAD_08_SYMBOL, LORA_SPREADING_FACTOR + 13, 10, LORA_CAD_ONLY, 0);
				cadTime = millis();

        
				Radio.StartCad();
				// Sending Pong will be started when the channel is free
			}
			else // valid reception but not a PING as expected
			{	// Set device as master and start again
				Serial.println("Received something in OnRxDone as Slave");

				isMaster = true;
				Radio.Rx(RX_TIMEOUT_VALUE);
			}
		}
	}
}

/**@brief Function to be executed on Radio Tx Timeout event
 */
void OnTxTimeout(void)
{
	// Radio.Sleep();
	Serial.println("OnTxTimeout");

	digitalWrite(LED_BUILTIN, LOW);

	Radio.Rx(RX_TIMEOUT_VALUE);
}

/**@brief Function to be executed on Radio Rx Timeout event
 */
void OnRxTimeout(void)
{
	Serial.println("OnRxTimeout");

	digitalWrite(LED_BUILTIN, LOW);

	if (isMaster == true)
	{
		// Wait 500ms before sending the next package
		delay(500);

		// Check if our channel is available for sending
		Radio.Standby();
		Radio.SetCadParams(LORA_CAD_08_SYMBOL, LORA_SPREADING_FACTOR + 13, 10, LORA_CAD_ONLY, 0);
		cadTime = millis();
		Radio.StartCad();
		// Sending the ping will be started when the channel is free
	}
	else
	{
		// No Ping received within timeout, switch to Master
		isMaster = true;
		// Check if our channel is available for sending
		Radio.Standby();
		Radio.SetCadParams(LORA_CAD_08_SYMBOL, LORA_SPREADING_FACTOR + 13, 10, LORA_CAD_ONLY, 0);
		cadTime = millis();
		Radio.StartCad();
		// Sending the ping will be started when the channel is free
	}
}

/**@brief Function to be executed on Radio Rx Error event
 */
void OnRxError(void)
{
	Serial.println("OnRxError");

	digitalWrite(LED_BUILTIN, LOW);

	if (isMaster == true)
	{
		// Wait 500ms before sending the next package
		delay(500);

		// Check if our channel is available for sending
		Radio.Standby();
		Radio.SetCadParams(LORA_CAD_08_SYMBOL, LORA_SPREADING_FACTOR + 13, 10, LORA_CAD_ONLY, 0);
		cadTime = millis();
		Radio.StartCad();
		// Sending the ping will be started when the channel is free
	}
	else
	{
		Radio.Rx(RX_TIMEOUT_VALUE);
	}
}

/**@brief Function to be executed on CAD Done event
 */
void OnCadDone(bool cadResult)
{
	time_t duration = millis() - cadTime;
	if (cadResult)
	{
		Serial.printf("CAD returned channel busy after %ldms\n", duration);
		Radio.Rx(RX_TIMEOUT_VALUE);
	}
	else
	{
		Serial.printf("CAD returned channel free after %ldms\n", duration);

		if (isMaster)
		{
			Serial.println("Sending a PING in OnCadDone as Master");

			// Send the next PING frame
			TxdBuffer[0] = 'P';
			TxdBuffer[1] = 'I';
			TxdBuffer[2] = 'N';
			TxdBuffer[3] = 'G';
		}
		else
		{
			Serial.println("Sending a PONG in OnCadDone as Slave");

			// Send the reply to the PONG string
			TxdBuffer[0] = 'P';
			TxdBuffer[1] = 'O';
			TxdBuffer[2] = 'N';
			TxdBuffer[3] = 'G';
		}
          // We fill the buffer with numbers for the payload
          for (int i = 4; i < BufferSize; i++)
          {
            TxdBuffer[i] = i - 4;
          }

		Radio.Send(TxdBuffer, BufferSize);
	}
}

Here is the Lora module in question:

The purchase link is https://www.aliexpress.com/item/1005007124011546.htm (RFM95 915mhz). To reiterate, this device has previously connected and otherwise worked fine on another project using the Mistry library.

The RFM95 is an SX127X LoRa device, and the Mistry library does support SX127X devices.

The Waveshare library appears to be for SX126X LoRa devices so it is not going to work with a RFM95\SX127X device.

Cool. Thank you for clarifying this sir. I will attempt to use the Mistry Library to connect these two devices - I'm assuming the Mistry library will work with the Heltec Wireless Tracker v 1.1. I appreciate your time (as well as everyone else's) on this issue.

Thank you.

The Mistry library only supports SX127X devices. The documentation for the library makes that clear.

Thanks for clarifying. My Heltec device (https://www.aliexpress.com/item/1005007074175365.html) is a SX1262. Is it possible to use two different libraries for these two different devices and have them communicate with each other in spite of being two different libraries?

Its possible, but much easier to use a library that uses the same sketch format for the two different types of LoRa device, such as;

https://github.com/jgromes/RadioLib

or

https://github.com/StuartsProjects/SX12XX-LoRa

Thank you sir. I'll play with the first library first to see if I can make this connection happen. I appreciate your prompt response and have great day.

I used the SX12XX Library (as recommended by @srnet in post 11) to connect a ESP32_C3 with a RFM95W Lora module to a Heltec ESP32S3 LoRa (V3) SX1262 receiver

Heltec ESP32S3 LoRa (V3) SX1262 receiver code

// Heltec ESP32S3 LoRa (V3) SX1262 receiver text communication

/*******************************************************************************************************
  Programs for Arduino - Copyright of the author Stuart Robinson - 20/01/20
     from https://github.com/StuartsProjects/SX12XX-LoRa
 *******************************************************************************************************/

#include <SPI.h>              //the lora device is SPI based so load the SPI library
#include <SX126XLT.h>         //include the appropriate library
#include "SX1262_Settings.h"  //include the setiings file, frequencies, LoRa settings etc

SX126XLT LT;  //create a library class instance called LT

uint32_t RXpacketCount;
uint32_t errors;

uint8_t RXBUFFER[RXBUFFER_SIZE];  //create the buffer that received packets are copied into

uint8_t RXPacketL;  //stores length of packet received
int8_t PacketRSSI;  //stores RSSI of received packet
int8_t PacketSNR;   //stores signal to noise ratio (SNR) of received packet


void loop() {
  // receive data
  RXPacketL = LT.receive(RXBUFFER, RXBUFFER_SIZE, 60000, WAIT_RX);  //wait for a packet to arrive with 60seconds (60000mS) timeout
  PacketRSSI = LT.readPacketRSSI();                                 //read the recived RSSI value
  PacketSNR = LT.readPacketSNR();                                   //read the received SNR value
  Serial.print("Received ");
  if (RXPacketL == 0)  //if the LT.receive() function detects an error, RXpacketL is 0
    receive_packet_is_Error();
  else
    receive_packet_is_OK();  //LED off
  Serial.println();
}


void receive_packet_is_OK() {
  uint16_t IRQStatus, localCRC;
  IRQStatus = LT.readIrqStatus();  //read the LoRa device IRQ status register
  RXpacketCount++;
  printElapsedTime();  //print elapsed time to Serial Monitor
  Serial.print(F("  "));
  LT.printASCIIPacket(RXBUFFER, RXPacketL);             //print the packet as ASCII characters
  localCRC = LT.CRCCCITT(RXBUFFER, RXPacketL, 0xFFFF);  //calculate the CRC, this is the external CRC calculation of the RXBUFFER
  Serial.print(F(",CRC,"));                             //contents, not the LoRa device internal CRC
  Serial.print(localCRC, HEX);
  Serial.print(F(",RSSI,"));
  Serial.print(PacketRSSI);
  Serial.print(F("dBm,SNR,"));
  Serial.print(PacketSNR);
  Serial.print(F("dB,Length,"));
  Serial.print(RXPacketL);
  Serial.print(F(",Packets,"));
  Serial.print(RXpacketCount);
  Serial.print(F(",Errors,"));
  Serial.print(errors);
  Serial.print(F(",IRQreg,"));
  Serial.print(IRQStatus, HEX);
  transmitReply();
}


void receive_packet_is_Error() {
  uint16_t IRQStatus;
  IRQStatus = LT.readIrqStatus();  //read the LoRa device IRQ status register
  printElapsedTime();              //print elapsed time to Serial Monitor
  if (IRQStatus & IRQ_RX_TIMEOUT)  //check for an RX timeout
  {
    Serial.print(F(" RXTimeout"));
  } else {
    errors++;
    Serial.print(F(" PacketError"));
    Serial.print(F(",RSSI,"));
    Serial.print(PacketRSSI);
    Serial.print(F("dBm,SNR,"));
    Serial.print(PacketSNR);
    Serial.print(F("dB,Length,"));
    Serial.print(LT.readRXPacketL());  //get the device packet length
    Serial.print(F(",Packets,"));
    Serial.print(RXpacketCount);
    Serial.print(F(",Errors,"));
    Serial.print(errors);
    Serial.print(F(",IRQreg,"));
    Serial.print(IRQStatus, HEX);
    LT.printIrqStatus();  //print the names of the IRQ registers set
  }
  delay(250);  //gives a longer buzzer and LED flash for error
}


void printElapsedTime() {
  float seconds;
  seconds = millis() / 1000;
  Serial.print(seconds, 0);
  Serial.print(F("s"));
}

void setup() {
  Serial.begin(115200);
  delay(3000);
  Serial.println();
  Serial.println(F("104_LoRa_Receiver_Detailed_Setup_ESP32 Starting"));
  Serial.println();
  SPI.begin();
  //SPI.begin(SCK, MISO, MOSI);                  //this will work too, allows you to move SPI pins
  //SPI beginTranscation is normally part of library routines, but if it is disabled in the library
  //a single instance is needed here, so uncomment the program line below
  //SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
  //setup hardware pins used by device, then check if device is found
  if (LT.begin(NSS, NRESET, RFBUSY, DIO1, LORA_DEVICE)) {
    Serial.println(F("LoRa Device found"));
  } else {
    Serial.println(F("No device responding"));
    while (1) delay(100);
  }

  //The function call list below shows the complete setup for the LoRa device using the information defined in the
  //Settings.h file.
  //The 'Setup LoRa device' list below can be replaced with a single function call;
  //LT.setupLoRa(Frequency, Offset, SpreadingFactor, Bandwidth, CodeRate, Optimisation);

  //***************************************************************************************************
  //Setup LoRa device
  //***************************************************************************************************
  LT.setMode(MODE_STDBY_RC);
  LT.setRegulatorMode(USE_DCDC);
  LT.setPaConfig(0x04, PAAUTO, LORA_DEVICE);
  LT.setDIO3AsTCXOCtrl(TCXO_CTRL_3_3V);
  LT.calibrateDevice(ALLDevices);  //is required after setting TCXO
  LT.calibrateImage(Frequency);
  LT.setDIO2AsRfSwitchCtrl();
  LT.setPacketType(PACKET_TYPE_LORA);
  LT.setRfFrequency(Frequency, Offset);
  LT.setModulationParams(SpreadingFactor, Bandwidth, CodeRate, Optimisation);
  LT.setBufferBaseAddress(0, 0);
  LT.setPacketParams(8, LORA_PACKET_VARIABLE_LENGTH, 255, LORA_CRC_ON, LORA_IQ_NORMAL);
  LT.setDioIrqParams(IRQ_RADIO_ALL, (IRQ_RX_DONE + IRQ_RX_TX_TIMEOUT), 0, 0);  //set for IRQ on TX done and timeout on DIO1
  LT.setHighSensitivity();                                                     //set for maximum gain
  LT.setSyncWord(LORA_MAC_PRIVATE_SYNCWORD);
  //***************************************************************************************************


  Serial.println();
  LT.printModemSettings();  //reads and prints the configured LoRa settings, useful check
  Serial.println();
  LT.printOperatingSettings();  //reads and prints the configured operting settings, useful check
  Serial.println();
  Serial.println();
  LT.printRegisters(0x900, 0x9FF);  //print contents of device registers, normally 0x00 to 0x4F
  Serial.println();
  Serial.println();

  Serial.print(F("Receiver ready - RXBUFFER_SIZE "));
  Serial.println(RXBUFFER_SIZE);
  Serial.println();
}

char buff[50];
uint8_t TXPacketL;
uint32_t TXPacketCount, startmS, endmS;
void transmitReply(void) {
  static int count = 0;
  snprintf(buff, 50, "receive OK %d", count++);
  Serial.print(F("\nTransmit Packet> "));
  Serial.flush();
  TXPacketL = strlen(buff);  //set TXPacketL to length of array
  //buff[TXPacketL] = '*';                                   //replace null character at buffer end so its visible on reciver
  LT.printASCIIPacket((uint8_t *)buff, TXPacketL);                      //print the buffer (the sent packet) as ASCI
  startmS = millis();                                                   //start transmit timer
  if (LT.transmit((uint8_t *)buff, TXPacketL, 5000, TXpower, WAIT_TX))  //will return packet length sent if OK, otherwise 0 if transmit error
  {
    endmS = millis();  //packet sent, note end time
    TXPacketCount++;
    transmit_packet_is_OK();
  } else {
    transmit_packet_is_Error();  //transmit packet returned 0, there was an error
  }
  Serial.println();
  delay(packet_delay);  //have a delay between packets
}


void transmit_packet_is_OK() {
  //if here packet has been sent OK
  uint16_t localCRC;

  Serial.print(F("  BytesSent,"));
  Serial.print(TXPacketL);  //print transmitted packet length
  localCRC = LT.CRCCCITT((uint8_t *)buff, TXPacketL, 0xFFFF);
  Serial.print(F("  CRC,"));
  Serial.print(localCRC, HEX);  //print CRC of sent packet
  Serial.print(F("  TransmitTime,"));
  Serial.print(endmS - startmS);  //print transmit time of packet
  Serial.print(F("mS"));
  Serial.print(F("  PacketsSent,"));
  Serial.print(TXPacketCount);  //print total of packets sent OK
}


void transmit_packet_is_Error() {
  //if here there was an error transmitting packet
  uint16_t IRQStatus;
  IRQStatus = LT.readIrqStatus();  //read the the interrupt register
  Serial.print(F(" SendError,"));
  Serial.print(F("Length,"));
  Serial.print(TXPacketL);  //print transmitted packet length
  Serial.print(F(",IRQreg,"));
  Serial.print(IRQStatus, HEX);  //print IRQ status
  LT.printIrqStatus();           //prints the text of which IRQs set
}

SX1262_Settings.h file (must be in same directory as above)

// Heltec ESP32S3 LoRa (V3) SX1262 receiver 

/*******************************************************************************************************
  Programs for Arduino - Copyright of the author Stuart Robinson - 04/04/20

  This program is supplied as is, it is up to the user of the program to decide if the program is
  suitable for the intended purpose and free from errors.
*******************************************************************************************************/

//*******  Setup hardware pin definitions here ! ***************

//These are the pin definitions for one of my own boards, a ESP32 shield base with my BBF board shield on
//top. Be sure to change the definitions to match your own setup. Some pins such as DIO2, DIO3, BUZZER
//may not be in used by this sketch so they do not need to be connected and should be included and be 
//set to -1.

#define SCK 9                                  //SCK on SPI3
#define MISO 11                                 //MISO on SPI3 
#define MOSI 10                                 //MOSI on SPI3 

#define NSS 8                                   //select pin on LoRa device
#define NRESET 12                               //reset pin on LoRa device
#define RFBUSY 13                               //busy line

#define LED1 2                                  //on board LED, high for on
#define DIO1 14                                 //DIO1 pin on LoRa device, used for RX and TX done 

#define LORA_DEVICE DEVICE_SX1262               //we need to define the device we are using


//*******  Setup LoRa Parameters Here ! ***************

//LoRa Modem Parameters
const uint32_t Frequency = 866000000;           //frequency of transmissions in hertz
const uint32_t Offset = 0;                      //offset frequency for calibration purposes

const uint8_t Bandwidth = LORA_BW_125;          //LoRa bandwidth
const uint8_t SpreadingFactor = LORA_SF7;       //LoRa spreading factor
const uint8_t CodeRate = LORA_CR_4_5;           //LoRa coding rate
const uint8_t Optimisation = LDRO_AUTO;         //low data rate optimisation setting, normally set to auto

const int8_t TXpower = 10;                      //LoRa transmit power in dBm


const uint16_t packet_delay = 1000;             //mS delay between packets

#define RXBUFFER_SIZE 32                        //RX buffer size  

ESP32_C3 LoRa SX1278 (RFM95W) transmitter code

// ESP32_C3 LoRa  SX1278 (RFM95W) transmitter text communication

/*******************************************************************************************************
  Programs for Arduino - Copyright of the author Stuart Robinson - 20/01/20
     from https://github.com/StuartsProjects/SX12XX-LoRa
 *******************************************************************************************************/

#include <SPI.h>              //the SX127X device is SPI based so load the SPI library
#include <SX127XLT.h>         //include the appropriate library
#include "SX1278_Settings.h"  //include the setiings file, frequencies, LoRa settings etc

SX127XLT LT;  //create a library class instance called LT

uint8_t TXPacketL;
uint32_t TXPacketCount, startmS, endmS;

char buff[50] = "Hello World 0";
int count = 0;

void loop() {
  snprintf(buff, 50, "Hello World %d", count++);
  Serial.print(F("Transmit Packet> "));
  Serial.flush();
  TXPacketL = strlen(buff);  //set TXPacketL to length of array
  //buff[TXPacketL] = '*';                                   //replace null character at buffer end so its visible on reciver
  LT.printASCIIPacket((uint8_t *)buff, TXPacketL);                      //print the buffer (the sent packet) as ASCII
  startmS = millis();                                                   //start transmit timer
  if (LT.transmit((uint8_t *)buff, TXPacketL, 5000, TXpower, WAIT_TX))  //will return packet length sent if OK, otherwise 0 if transmit error
  {
    endmS = millis();  //packet sent, note end time
    TXPacketCount++;
    transmit_packet_is_OK();
  } else {
    transmit_packet_is_Error();  //transmit packet returned 0, there was an error
  }
  Serial.println();
  delay(packet_delay);  //have a delay between packets
}


void transmit_packet_is_OK() {
  //if here packet has been sent OK
  uint16_t localCRC;

  Serial.print(F("  BytesSent,"));
  Serial.print(TXPacketL);  //print transmitted packet length
  localCRC = LT.CRCCCITT((uint8_t *)buff, TXPacketL, 0xFFFF);
  Serial.print(F("  CRC,"));
  Serial.print(localCRC, HEX);  //print CRC of sent packet
  Serial.print(F("  TransmitTime,"));
  Serial.print(endmS - startmS);  //print transmit time of packet
  Serial.print(F("mS"));
  Serial.print(F("  PacketsSent,"));
  Serial.print(TXPacketCount);  //print total of packets sent OK
  receive_packet();
}


void transmit_packet_is_Error() {
  //if here there was an error transmitting packet
  uint16_t IRQStatus;
  IRQStatus = LT.readIrqStatus();  //read the the interrupt register
  Serial.print(F(" SendError,"));
  Serial.print(F("Length,"));
  Serial.print(TXPacketL);  //print transmitted packet length
  Serial.print(F(",IRQreg,"));
  Serial.print(IRQStatus, HEX);  //print IRQ status
  LT.printIrqStatus();           //prints the text of which IRQs set
}

void setup() {
  if (VCCPOWER >= 0) {
    pinMode(VCCPOWER, OUTPUT);    //For controlling power to external devices
    digitalWrite(VCCPOWER, LOW);  //VCCOUT on. lora device on
  }
  Serial.begin(115200);
  delay(3000);
  Serial.println();
  Serial.println(F("3_LoRa_Transmitter_ESP32 Starting"));

  //SPI.begin();                                //default setup can be used be used
  SPI.begin(SCK, MISO, MOSI);  //alternative format for SPI3, VSPI; SPI.begin(SCK,MISO,MOSI,SS)

  //SPI beginTranscation is normally part of library routines, but if it is disabled in library
  //a single instance is needed here, so uncomment the program line below
  //SPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));

  //setup hardware pins used by device, then check if device is found
  if (LT.begin(NSS, NRESET, DIO0, LORA_DEVICE)) {
    Serial.println(F("LoRa Device found"));
    delay(1000);
  } else {
    Serial.println(F("No device responding"));
    while (1)
      ;
  }

  //The function call list below shows the complete setup for the LoRa device using the information defined in the
  //Settings.h file.
  //The 'Setup LoRa device' list below can be replaced with a single function call;
  //LT.setupLoRa(Frequency, Offset, SpreadingFactor, Bandwidth, CodeRate, Optimisation);

  //***************************************************************************************************
  //Setup LoRa device
  //***************************************************************************************************
  LT.setMode(MODE_STDBY_RC);                                                             //got to standby mode to configure device
  LT.setPacketType(PACKET_TYPE_LORA);                                                    //set for LoRa transmissions
  LT.setRfFrequency(Frequency, Offset);                                                  //set the operating frequency
  LT.calibrateImage(0);                                                                  //run calibration after setting frequency
  LT.setModulationParams(SpreadingFactor, Bandwidth, CodeRate, LDRO_AUTO);               //set LoRa modem parameters
  LT.setBufferBaseAddress(0x00, 0x00);                                                   //where in the SX buffer packets start, TX and RX
  LT.setPacketParams(8, LORA_PACKET_VARIABLE_LENGTH, 255, LORA_CRC_ON, LORA_IQ_NORMAL);  //set packet parameters
  LT.setSyncWord(LORA_MAC_PRIVATE_SYNCWORD);                                             //syncword, LORA_MAC_PRIVATE_SYNCWORD = 0x12, or LORA_MAC_PUBLIC_SYNCWORD = 0x34
  LT.setHighSensitivity();                                                               //set for highest sensitivity at expense of slightly higher LNA current
  LT.setDioIrqParams(IRQ_RADIO_ALL, IRQ_TX_DONE, 0, 0);                                  //set for IRQ on RX done
  //***************************************************************************************************

  Serial.println();
  LT.printModemSettings();  //reads and prints the configured LoRa settings, useful check
  Serial.println();
  LT.printOperatingSettings();  //reads and prints the configured operating settings, useful check
  Serial.println();
  Serial.println();
  LT.printRegisters(0x00, 0x4F);  //print contents of device registers, normally 0x00 to 0x4F
  Serial.println();
  Serial.println();

  Serial.print(F("Transmitter ready"));
  Serial.println();
}

uint32_t RXpacketCount;
uint32_t errors;

uint8_t RXBUFFER[RXBUFFER_SIZE];  //create the buffer that received packets are copied into

uint8_t RXPacketL;  //stores length of packet received
int8_t PacketRSSI;  //stores RSSI of received packet
int8_t PacketSNR;   //stores signal to noise ratio (SNR) of received packet

void receive_packet(void) {
  // receive data
  RXPacketL = LT.receive(RXBUFFER, RXBUFFER_SIZE, 60000, WAIT_RX);  //wait for a packet to arrive with 60seconds (60000mS) timeout
  PacketRSSI = LT.readPacketRSSI();                                 //read the recived RSSI value
  PacketSNR = LT.readPacketSNR();                                   //read the received SNR value
  Serial.print("\nreceived ");
  if (RXPacketL == 0)  //if the LT.receive() function detects an error, RXpacketL is 0
    receive_packet_is_Error();
  else
    receive_packet_is_OK();  //LED off
  Serial.println();
}


void receive_packet_is_OK() {
  uint16_t IRQStatus, localCRC;
  IRQStatus = LT.readIrqStatus();  //read the LoRa device IRQ status register
  RXpacketCount++;
  printElapsedTime();  //print elapsed time to Serial Monitor
  Serial.print(F("  "));
  LT.printASCIIPacket(RXBUFFER, RXPacketL);             //print the packet as ASCII characters
  localCRC = LT.CRCCCITT(RXBUFFER, RXPacketL, 0xFFFF);  //calculate the CRC, this is the external CRC calculation of the RXBUFFER
  Serial.print(F(",CRC,"));                             //contents, not the LoRa device internal CRC
  Serial.print(localCRC, HEX);
  Serial.print(F(",RSSI,"));
  Serial.print(PacketRSSI);
  Serial.print(F("dBm,SNR,"));
  Serial.print(PacketSNR);
  Serial.print(F("dB,Length,"));
  Serial.print(RXPacketL);
  Serial.print(F(",Packets,"));
  Serial.print(RXpacketCount);
  Serial.print(F(",Errors,"));
  Serial.print(errors);
  Serial.print(F(",IRQreg,"));
  Serial.print(IRQStatus, HEX);
}


void receive_packet_is_Error() {
  uint16_t IRQStatus;
  IRQStatus = LT.readIrqStatus();  //read the LoRa device IRQ status register
  printElapsedTime();              //print elapsed time to Serial Monitor
  if (IRQStatus & IRQ_RX_TIMEOUT)  //check for an RX timeout
  {
    Serial.print(F(" RXTimeout"));
  } else {
    errors++;
    Serial.print(F(" PacketError"));
    Serial.print(F(",RSSI,"));
    Serial.print(PacketRSSI);
    Serial.print(F("dBm,SNR,"));
    Serial.print(PacketSNR);
    Serial.print(F("dB,Length,"));
    Serial.print(LT.readRXPacketL());  //get the device packet length
    Serial.print(F(",Packets,"));
    Serial.print(RXpacketCount);
    Serial.print(F(",Errors,"));
    Serial.print(errors);
    Serial.print(F(",IRQreg,"));
    Serial.print(IRQStatus, HEX);
    LT.printIrqStatus();  //print the names of the IRQ registers set
  }
  delay(250);  //gives a longer buzzer and LED flash for error
}


void printElapsedTime() {
  float seconds;
  seconds = millis() / 1000;
  Serial.print(seconds, 0);
  Serial.print(F("s"));
}

SX1278_Settings.h (must be in same directory as above)

// ESP32_C3 LoRa  SX1278  (RFM95W) transmitter text communication

/*******************************************************************************************************
  Programs for Arduino - Copyright of the author Stuart Robinson - 20/01/20

  This program is supplied as is, it is up to the user of the program to decide if the program is
  suitable for the intended purpose and free from errors.
*******************************************************************************************************/

//*******  Setup hardware pin definitions here ! ***************

//These are the pin definitions for one of the Tracker boards, the ESP32_Micro_Node, be sure to change
//them to match your own setup. You will also need to connect up the pins for the SPI bus, which on the
//ESP32_Micro_Node are SCK on pin 18, MISO on pin 19 and MOSI on pin 23.

// ESP32_C3 supermini
#define NSS 7                                   //select pin on LoRa device
#define SCK 4                                  //SCK on SPI3
#define MISO 5                                //MISO on SPI3 
#define MOSI 6                                 //MOSI on SPI3 

#define NRESET 0                               //reset pin on LoRa device
#define LED1 2                                  //on board LED, high for on
#define DIO0 1                                 //DIO0 pin on LoRa device, used for RX and TX done 
#define VCCPOWER 3                             //pin controls power to external devices

#define LORA_DEVICE DEVICE_SX1278               //we need to define the device we are using


//*******  Setup LoRa Parameters Here ! ***************

//LoRa Modem Parameters
const uint32_t Frequency = 866000000;           //frequency of transmissions in hertz
const uint32_t Offset = 0;                      //offset frequency for calibration purposes

const uint8_t Bandwidth = LORA_BW_125;          //LoRa bandwidth
const uint8_t SpreadingFactor = LORA_SF7;       //LoRa spreading factor
const uint8_t CodeRate = LORA_CR_4_5;           //LoRa coding rate
const uint8_t Optimisation = LDRO_AUTO;         //low data rate optimisation setting, normally set to auto

const int8_t TXpower = 10;                      //LoRa transmit power in dBm

const uint16_t packet_delay = 1000;             //mS delay between packets

#define RXBUFFER_SIZE 32                        //RX buffer size  

ESP32_C3 LoRa SX1278 (RFM95W) transmitter Serial monitor output

3_LoRa_Transmitter_ESP32 Starting
LoRa Device found

SX1278_PABOOST,866000000hz,SF7,BW125000,CR4:5,LDRO_Off,SyncWord_0x12,IQNormal,Preamble_8
SX1278_PABOOST,SLEEP,Version_12,PacketMode_LoRa,Explicit,CRC_On,AGCauto_On,LNAgain_1

Reg    0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
0x00  F2 81 1A 0B 00 52 D8 80 00 4F 09 2B 23 01 00 00 
0x10  00 00 00 00 00 00 00 00 10 00 00 00 00 72 74 64 
0x20  00 08 FF FF 00 00 04 00 00 00 00 00 00 50 14 45 
0x30  55 C3 05 27 1C 0A 03 0A 42 12 49 1D 00 AF 00 00 
0x40  70 00 12 24 2D 00 03 00 04 23 00 09 05 84 32 2B 


Transmitter ready
Transmit Packet> Hello World 0  BytesSent,13  CRC,3FE2  TransmitTime,46mS  PacketsSent,1
received 4s  receive OK 0,CRC,96F0,RSSI,-49dBm,SNR,9dB,Length,12,Packets,1,Errors,0,IRQreg,50

Transmit Packet> Hello World 1  BytesSent,13  CRC,2FC3  TransmitTime,46mS  PacketsSent,2
received 5s  receive OK 1,CRC,86D1,RSSI,-49dBm,SNR,9dB,Length,12,Packets,2,Errors,0,IRQreg,50

Transmit Packet> Hello World 2  BytesSent,13  CRC,1FA0  TransmitTime,47mS  PacketsSent,3
received 6s  receive OK 2,CRC,B6B2,RSSI,-48dBm,SNR,10dB,Length,12,Packets,3,Errors,0,IRQreg,50

Transmit Packet> Hello World 3  BytesSent,13  CRC,F81  TransmitTime,47mS  PacketsSent,4
received 7s  receive OK 3,CRC,A693,RSSI,-50dBm,SNR,9dB,Length,12,Packets,4,Errors,0,IRQreg,50

Transmit Packet> Hello World 4  BytesSent,13  CRC,7F66  TransmitTime,46mS  PacketsSent,5
received 8s  receive OK 4,CRC,D674,RSSI,-49dBm,SNR,9dB,Length,12,Packets,5,Errors,0,IRQreg,50

Transmit Packet> Hello World 5  BytesSent,13  CRC,6F47  TransmitTime,47mS  PacketsSent,6
received 9s  receive OK 5,CRC,C655,RSSI,-48dBm,SNR,9dB,Length,12,Packets,6,Errors,0,IRQreg,50

Transmit Packet> Hello World 6  BytesSent,13  CRC,5F24  TransmitTime,46mS  PacketsSent,7
received 10s  receive OK 6,CRC,F636,RSSI,-47dBm,SNR,9dB,Length,12,Packets,7,Errors,0,IRQreg,50

Transmit Packet> Hello World 7  BytesSent,13  CRC,4F05  TransmitTime,47mS  PacketsSent,8
received 11s  receive OK 7,CRC,E617,RSSI,-47dBm,SNR,9dB,Length,12,Packets,8,Errors,0,IRQreg,50

Transmit Packet> Hello World 8  BytesSent,13  CRC,BEEA  TransmitTime,47mS  PacketsSent,9
received 13s  receive OK 8,CRC,17F8,RSSI,-47dBm,SNR,9dB,Length,12,Packets,9,Errors,0,IRQreg,50

Transmit Packet> Hello World 9  BytesSent,13  CRC,AECB  TransmitTime,46mS  PacketsSent,10
received 14s  receive OK 9,CRC,7D9,RSSI,-47dBm,SNR,9dB,Length,12,Packets,10,Errors,0,IRQreg,50

Transmit Packet> Hello World 10  BytesSent,14  CRC,20DE  TransmitTime,46mS  PacketsSent,11
received 15s  receive OK 10,CRC,161D,RSSI,-45dBm,SNR,9dB,Length,13,Packets,11,Errors,0,IRQreg,50

Heltec ESP32S3 LoRa (V3) SX1262 receiver Serial monitor output

104_LoRa_Receiver_Detailed_Setup_ESP32 Starting

LoRa Device found

SX1262,866000000hz,SF7,BW125000,CR4:5,LDRO_Off,SyncWord_0x1424,IQNormal,Preamble_8
SX1262,PacketMode_LoRa,Explicit,LNAgain_Boosted

Reg    0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
0x900  30 00 00 00 00 64 00 00 00 00 00 00 24 04 47 04 
0x910  00 2F 00 00 00 03 0A 00 15 35 09 00 02 2B 6F 08 
0x920  07 04 05 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x930  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x940  00 07 00 03 02 00 10 00 0A 00 03 04 00 14 0C 00 
0x950  00 00 00 06 00 00 00 00 00 00 00 00 00 00 00 00 
0x960  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x970  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x980  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x990  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x9A0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x9B0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x9C0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x9D0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x9E0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
0x9F0  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 


Receiver ready - RXBUFFER_SIZE 32

Received 63s RXTimeout
Received 123s RXTimeout
Received 183s RXTimeout

Received 1688s  Hello World 0,CRC,3FE2,RSSI,-31dBm,SNR,12dB,Length,13,Packets,1,Errors,0,IRQreg,16
Transmit Packet> receive OK 0  BytesSent,12  CRC,96F0  TransmitTime,48mS  PacketsSent,1

Received 1690s  Hello World 1,CRC,2FC3,RSSI,-31dBm,SNR,11dB,Length,13,Packets,2,Errors,0,IRQreg,16
Transmit Packet> receive OK 1  BytesSent,12  CRC,86D1  TransmitTime,48mS  PacketsSent,2

Received 1691s  Hello World 2,CRC,1FA0,RSSI,-31dBm,SNR,12dB,Length,13,Packets,3,Errors,0,IRQreg,16
Transmit Packet> receive OK 2  BytesSent,12  CRC,B6B2  TransmitTime,48mS  PacketsSent,3

Received 1692s  Hello World 3,CRC,F81,RSSI,-32dBm,SNR,11dB,Length,13,Packets,4,Errors,0,IRQreg,16
Transmit Packet> receive OK 3  BytesSent,12  CRC,A693  TransmitTime,48mS  PacketsSent,4

Received 1693s  Hello World 4,CRC,7F66,RSSI,-32dBm,SNR,12dB,Length,13,Packets,5,Errors,0,IRQreg,16
Transmit Packet> receive OK 4  BytesSent,12  CRC,D674  TransmitTime,48mS  PacketsSent,5

Received 1694s  Hello World 5,CRC,6F47,RSSI,-30dBm,SNR,11dB,Length,13,Packets,6,Errors,0,IRQreg,16
Transmit Packet> receive OK 5  BytesSent,12  CRC,C655  TransmitTime,48mS  PacketsSent,6

Received 1695s  Hello World 6,CRC,5F24,RSSI,-30dBm,SNR,12dB,Length,13,Packets,7,Errors,0,IRQreg,16
Transmit Packet> receive OK 6  BytesSent,12  CRC,F636  TransmitTime,48mS  PacketsSent,7

Received 1696s  Hello World 7,CRC,4F05,RSSI,-30dBm,SNR,11dB,Length,13,Packets,8,Errors,0,IRQreg,16
Transmit Packet> receive OK 7  BytesSent,12  CRC,E617  TransmitTime,48mS  PacketsSent,8

Received 1697s  Hello World 8,CRC,BEEA,RSSI,-30dBm,SNR,11dB,Length,13,Packets,9,Errors,0,IRQreg,16
Transmit Packet> receive OK 8  BytesSent,12  CRC,17F8  TransmitTime,48mS  PacketsSent,9

Received 1698s  Hello World 9,CRC,AECB,RSSI,-30dBm,SNR,11dB,Length,13,Packets,10,Errors,0,IRQreg,16
Transmit Packet> receive OK 9  BytesSent,12  CRC,7D9  TransmitTime,47mS  PacketsSent,10

photo
![image|481x500]

1 Like
18:21:44.330 -> Transmit Packet> Hello World 6  BytesSent,13  CRC,5F24  TransmitTime,46mS  PacketsSent,7
18:21:44.409 -> received 166s  **receive OK** 4,CRC,D674,RSSI,-29dBm,SNR,9dB,Length,12,Packets,4,Errors,1,IRQreg,50
18:21:44.409 -> 
18:21:45.422 -> Transmit Packet> Hello World 7  BytesSent,13  CRC,4F05  TransmitTime,46mS  PacketsSent,8
18:21:45.515 -> received 167s  **receive OK** 5,CRC,C655,RSSI,-28dBm,SNR,9dB,Length,12,Packets,5,Errors,1,IRQreg,50
18:21:45.515 -> 
18:21:46.511 -> Transmit Packet> Hello World 8  BytesSent,13  CRC,BEEA  TransmitTime,46mS  PacketsSent,9
18:21:46.591 -> received 169s  **receive OK** 6,CRC,F636,RSSI,-28dBm,SNR,9dB,Length,12,Packets,6,Errors,1,IRQreg,50
18:21:46.591 -> 
18:21:47.632 -> Transmit Packet> Hello World 9  BytesSent,13  CRC,AECB  TransmitTime,46mS  PacketsSent,10
18:21:47.726 -> received 170s  **receive OK** 7,CRC,E617,RSSI,-28dBm,SNR,9dB,Length,12,Packets,7,Errors,1,IRQreg,50

@horace Brilliant code. Thank you so much for outlining it the way you did. As you can see I figured it based on your input.

@horace @Railroader @srnet Gentlemen, what an absolute pleasure. Thank you.

good to hear it is working!

the example code transferred information as text - it transferring numeric information the need to convert binary to text at the transmitter and back to binary at the receiver can loose precision

if you are transferring numeric data it is simpler to use binary
for example code transferring a structure have a look at need-advice-on-a-home-project - may give you some ideas

That SX12XX library does have examples of sending data as a structure, see sketch '14_LoRa_Structure_TX' etc.

Or the way I prefer to send binary data is to load the LoRa TX buffer directly, here is the code for loading tracker data;

//The SX12XX buffer is filled with variables of a known type and order. 
//Make sure the receiver uses the same variable type and order to read 
//variables out of the receive buffer.

  char trackerID[] = "TR1";
  float latitude = 51.23456;
  float longitude = -3.12345;
  uint16_t altitude = 199;
  uint8_t satellites = 8;
  uint16_t voltage = 3999;
  int16_t temperature = 9;
  uint8_t TXPacketL = 0;
  uint8_t BytesSent = 0;

  LoRa.startWriteSXBuffer(0);                         //start the write at SX12XX internal buffer location 0
  LoRa.writeBufferChar(trackerID, sizeof(trackerID));     //+4 bytes (3 characters plus null (0) at end)
  LoRa.writeFloat(latitude);                          //+4 = 8 bytes
  LoRa.writeFloat(longitude);                         //+4 = 12 bytes
  LoRa.writeUint16(altitude);                         //+2 = 14 bytes
  LoRa.writeUint8(satellites);                        //+1 = 15 bytes
  LoRa.writeUint16(voltage);                          //+2 = 17 bytes
  LoRa.writeInt8(temperature);                        //+1 = 18 bytes total to send
  TXPacketL = LoRa.endWriteSXBuffer();                //closes packet write and returns the length of the packet to send

  BytesSent = LoRa.transmitSXBuffer(0, TXPacketL, 5000, TXpower, WAIT_TX);   //set a TX timeout of 5000mS
1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.