Registering a Moteino with LORA on Things Network

How do I get the Device ID out of a Moteino MegaUSB with LoRa? I have successfully done LoRa to LoRa radio, and now have a TTN Gateway. Trying to take the next steps but cant find documentation on how to do it.

Kevin

TTN is LoRaWAN not Lora, so you’ll need to put on moteino LoRaWAN stack such as LMIC.

You may also use search engine, googling “ttn moteino” gives you 1st response on this forum post.
https://www.thethingsnetwork.org/forum/t/moteino-or-moteino-mega-for-lorawan-node/5381

BTW all is explained here

Thanks Charles, I have been to this site and have read it several times. So I must be not understanding something. I do have the LMIC library in the Arduino IDE.

So this is what I must not understand: I am thinking I need the DeviceID from the LoRa on the Moteino in order to register the device/app. Registering through the console or using the OTAA. I am not sure how to get that Device ID?

I could be totaly misunderstanding this. Before finding the above mentioned site, I did read through the steps for getting the device id from the Things Uno, so am expecting something similar with the Moteino LoRa.

Regards, and thank you for your reply,

Kevin

@kreeve
oh, forgot this point, so you have a device ID chip populated on your moteino board correct? if so you can read DevEUI (ID) as described here by Felix

#include <Wire.h>         //http://arduino.cc/en/Reference/Wire

void setup(void)
{
  Serial.begin(115200);
  Serial.print("wire init...");
  Wire.begin();
  Serial.println("done");
}

void loop(void)
{
  Serial.println("Loop...");
  readEEPROM_MAC(0x50, 0xF8);  //0x50 is the I2c address, 0xF8 is the memory address where the read-only MAC value is
  delay(2000);
}
  
void readEEPROM_MAC(int deviceaddress, byte eeaddress)
{
  Wire.beginTransmission(deviceaddress);
  Wire.write(eeaddress); // LSB 
  Wire.endTransmission();
  Wire.requestFrom(deviceaddress, 8); //request 8 bytes from the device

  while (Wire.available()){
    Serial.print("0x");
    Serial.print(Wire.read(), HEX);
    Serial.print(" ");
  }
  Serial.println();
}

No LMIC library should be downloaded and installed manually, it’s not in IDE and I admit, there are too much version and not officially one.
They seems not maintained anymore that it can be complicated to choose.
I’m still waiting for 2 Opensource libraries announcement (by TTN and Semtech) done on #theThingsConference

1 Like

Note: I got LMIC working with Moteino Mega…

  1. solder bridges for DIO1, DIO2, and RST

  2. use LMIC library from here https://github.com/matthijskooijman/arduino-lmic

  3. open src/lmic/config.h and set correct configuration (US915 for me)…

  4. for ABP example set your keys… use this pinmap

const lmic_pinmap lmic_pins = {   
 .nss = 4,    
.rxtx = LMIC_UNUSED_PIN,    
.rst = 3,    
.dio = {2, 22, 21},};
  1. for OTAA example set your keys (make sure to REVERSE order for APPEUI and DEVEUI)
  2. for OTAA also after the LMIC_reset(); add these lines
LMIC_setClockError(MAX_CLOCK_ERROR * 1 / 100);  LMIC_selectSubBand(1); 
LMIC.dn2Dr = DR_SF9;  
LMIC_setLinkCheckMode(0);  
LMIC_setDrTxpow(DR_SF7,14);