mkr 1300 wan in combination with a SX1262 868M LoRa HAT for Raspberry PI

Hi,

I´m working on a project in which I want a mkr 1300 wan LoRA to work together with a SX1262 868M LoRa HAT for a Raspberry PI in point to point communication mode.

I know the sending mkr 1300 WAN is working since I have another mkr 1300 who receives and interprets the transmission correctly.

However, I cannot get the Raspberry PI top hat to receive. Since I´m new to Lora, does anyone know where I can find how the mkr LoRa is parametrized? I´m assuming parameterizing the Raspberry PI top hat in the same way would enable communication.

Thanks in advance for any kind of support or hints

The parameters are probably defined in the code or sketch you are using.

Thanks for the reply. The only parameter in the code is setting the LoRa frequency, in my case 868 Mhz. I cannot find any parameters in the included .h files; (SPI.h, LoRa.h, MKRWAN.h) but maybe I´m just simply stupid

Perhaps post the actual code you are actually using, the forum cannot guess.

Here is the code. The mkr transmit reading from two temp sensors via Lora (plus battery voltage and a counter).

Thanks for your support

#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 5
#include <SPI.h>
#include <LoRa.h>
#include <MKRWAN.h>

int counter = 0;


/* If stand alone, disregard serial in following code */
bool standalone = FALSE;

LoRaModem modem;
OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

 float V_Celcius=0;
 int Analog_batt=0;
 float A_Celcius=0;
 float V_Batt=0;


void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(9600);
  if(standalone == TRUE)
    while (!Serial);

  // No need to call modem.dumb() with arduino-LoRa >= 0.5.0
  modem.dumb();
  if(standalone == TRUE)
    Serial.println("LoRa Sender");

  // Configure LoRa module to transmit and receive at 868MHz (868*10^6) 
   if (!LoRa.begin(868E6)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
  analogReadResolution(12);
  
}

void loop() {
  
  Analog_batt = analogRead(ADC_BATTERY);
  V_Batt=float(Analog_batt);
  V_Batt=V_Batt/408;
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 4.3V):
//  V_Batt = V_Batt * (4.3 / 1023.0);

  
  sensors.requestTemperatures(); 
  V_Celcius=sensors.getTempCByIndex(1);
  A_Celcius=sensors.getTempCByIndex(0);  
  
  if(standalone == TRUE                                                                               ){
    Serial.print("WaterTemp C ");
    Serial.println(V_Celcius);

    Serial.print("AirTemp C ");
    Serial.println(A_Celcius);
    
    Serial.print("Batt V ");
    Serial.println(V_Batt);
 
    Serial.print("Sending packet: ");
    Serial.println(counter);
  }

  // send packet
  if(standalone == FALSE){
    LoRa.beginPacket();
    LoRa.print("Vatten Temp X");
    LoRa.print(V_Celcius);
    LoRa.print("X ");
    LoRa.print("Luft Temp Y");
    LoRa.print(A_Celcius);
    LoRa.print("Y ");
    LoRa.print("Batt V Z");
    LoRa.print(V_Batt);
    LoRa.print("Z ");
    LoRa.print("Counter Q");
    LoRa.print(counter);
    LoRa.print("Q ");
    LoRa.endPacket();
  }
  counter++;
  if(counter > 9999){
    counter=0;
  }
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(100);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);
  
  delay(5000);
}

You will need to trawl through the documentation for the library, LoRa.h, that you are using, to see what the default LoRa parameters are, or set them your self.

For two LoRa devices to communicate these settings need to match;

Frequency
Spreading factor (SF)
Bandwidth
Coding rate
Syncword
Optimisation
Implicit\Explicit mode
Packet CRC on\off
Preamble Length
IQ Normal\Inverted

You cannot mix SX127x and SX126X devices at SF5 or SF6. Most SX127X devices wont work at lower than 62500hz bandwidth.

Thanks for these hints. I´ll look into LoRa.h and see if I can locate the parameters you mention above

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