Playing with some site survey code, need some basic help

Playing with some site survey code on the M5Stack with a compatible LoRa radio.

I’m super close to things working, however having trouble getting the TTN information entered into the libraries.

 // void setId(char *DevAddr, char *DevEUI, char *AppEUI);
  lora.setId("device-name-here?", "EasyFoundonTTN", "EasyFoundonTTN");
  // setKey(char *NwkSKey, char *AppSKey, char *AppKey);
  lora.setKey("network-key-here?", "ttn-account-v2.7.....", "EasyFoundonTTN");

Having trouble locating the:

  • DevAddr – is this just the device name?
  • NwkSKey – TTN Network Security Key?

On your TTN console, in your application and then go to your device setting (register a new one of both if you haven’t done so already), if you change the Activation Method to ABP, you will be provided with those details

Weird… TNN only shows an activation method of OTAA available?

you may be looking at the Overview tab, top right, change it to Settings, then you will see where to change it

LOL… thanks :slight_smile: That was it.

Trying to get the device online, should have a gateway within range (US)

lora.setDeciveMode(LWABP);
//lora.setDeciveMode(LWOTAA);
lora.setDataRate(DR0, US915HYBRID);
lora.setAdaptiveDataRate(true);

lora.setChannel(0, 903.08);
lora.setChannel(1, 905.24);
lora.setChannel(2, 907.40);
lora.setChannel(3, 909.56);
lora.setChannel(4, 911.72);
lora.setChannel(5, 913.88);
lora.setChannel(6, 916.04);
lora.setChannel(7, 918.20);
lora.setChannel(8, 920.36);
lora.setChannel(9, 922.52);
lora.setChannel(10, 924.68);
lora.setChannel(11, 926.84);
lora.setChannel(12, 915.00);

//lora.setReceiceWindowFirst(0, 902.3);
lora.setReceiceWindowSecond(923.3, DR8);

Anything look too wrong there?

I am in Aus so use AU915 - but those frequencies don’t look correct for a TTN gateway setup to use US915

Check out these and try to get a channel plan setup that match
https://www.thethingsnetwork.org/docs/lorawan/frequency-plans.html#us902-928