Generic Arduino LMIC-based devices

into the session: Generic Arduino LMIC-based devices availbale at the address: https://www.loraserver.io/lora-app-server/use/devices/

I read:

  1. Make sure that your Device Profile has LoRaWAN MAC version set to 1.0.2 , and LoRaWAN Regional Parameters revision set to A
  2. Install the Arduino LMIC library using the Library Manager in the Arduino IDE
  3. Open the example sketch from Examples -> LMIC-Arduino -> ttn-otaa.ino
  4. Update the sketch with the Device EUI as 0807060504030201 . Note : this field must be entered as LSB (meaning it is the reverse value as created in LoRa App Server)!
  5. Update the sketch with the Application EUI as 0000000000000000 . Note : this field must be entered as LSB (meaning it is the reverse value as created in LoRa App Server)!
  6. Update the sketch with the Application Key as 01020304050607080910111213141516 . Note: Opposite to the Device / Application EUI , this field must be entered as-is (the same value as set in LoRa App Server).
  7. Flash the sketch to your device and confirm that the device has been activated in the LoraServer console and on the Arduino Serial Monitor

The point 6 is not clear to me. Where do I setup/read the Application Key ? When I create an application from the Web GUI I don’t see any Application Key so set.

I have to use exactly the values indicated in point 4, 5 and 6 for the Device EUI, Application EUI and Application Key or they are just examples ones?

Creating a device without OTAA enabled.

If I enable OTAA, instead, I don’t know where to get the Application EUI.

Any App EUI / Join EUI will work :slight_smile:

2 Likes

Hi. cannot join my tbeam to my Chirpstack gateway

TRying to use this arduino sketch, but it stays joining for ever
any sugestions?
thanks

/**

  • Example of OTAA device
  • Authors:
  •    Ivan Moreno
    
  •    Eduardo Contreras
    
  • June 2019
  • This code is beerware; if you see me (or any other collaborator
  • member) at the local, and you’ve found our code helpful,
  • please buy us a round!
  • Distributed as-is; no warranty is given.
    */
    #include <lorawan.h>

// OTAA credentials
const char *devEui = “1307060504030201”;
const char *appEui = “0000000000000000”;
const char *appKey = “01020304050607080910111213141516”;

const unsigned long interval = 10000; // 10 s interval to send message
unsigned long previousMillis = 0; // will store last time message sent
unsigned int counter = 0; // message counter

char myStr[50];
char outStr[255];
byte recvStatus = 0;

const sRFM_pins RFM_pins = {
.CS = 18,
.RST = 23,
.DIO0 = 26,
.DIO1 = 41,
.DIO2 = 22,
.DIO5 = 34,
};

void setup() {
// Setup loraid access
Serial.begin(115200);
while(!Serial);
if(!lora.init()){
Serial.println(“RFM95 not detected”);
delay(5000);
return;
}

// Set LoRaWAN Class change CLASS_A or CLASS_C
lora.setDeviceClass(CLASS_A);

// Set Data Rate
lora.setDataRate(SF9BW125);

// set channel to random
lora.setChannel(MULTI);

// Put OTAA Key and DevAddress here
lora.setDevEUI(devEui);
lora.setAppEUI(appEui);
lora.setAppKey(appKey);

// Join procedure
bool isJoined;
do {
Serial.println(“Joining…”);
isJoined = lora.join();

//wait for 10s to try again
delay(10000);

}while(!isJoined);
Serial.println(“Joined to network”);
}

void loop() {
// Check interval overflow
if(millis() - previousMillis > interval) {
previousMillis = millis();

sprintf(myStr, "Counter-%d", counter); 

Serial.print("Sending: ");
Serial.println(myStr);

lora.sendUplink(myStr, strlen(myStr), 0, 1);
counter++;

}

recvStatus = lora.readData(outStr);
if(recvStatus) {
Serial.println(outStr);
}

// Check Lora RX
lora.update();
}

1 Like

Hello Brocaar
still cannot connect my esp 32 T Beam T22 v1.1 to my RaK 7243 active lora gateway.
I am not sure if my lora chip is SX1276 or the new sx1262, since both are used in my board.
One uses LMIC the other doesnt.
I am trying both ways but somwhow do not manage to send frames to gateway
Can you help?
Greetings
Emilio