How to connect Arduino MKR WAN 1310 to ThingPark Enterprise All In One using OTAA (No AppEUI field available)

How to connect Arduino MKR WAN 1310 to ThingPark Enterprise All In One using OTAA (No AppEUI field available)

I am currently using ThingPark Enterprise All In One version 2.1.1, installed on a Kerlink Wirnet iFemtoCell 923 LoRa gateway. Our company utilizes the Arduino MKR WAN 1310 for equipment condition monitoring, and we would like to connect it to ThingPark Enterprise All In One as well.

When I attempted to register the Arduino MKR WAN 1310 as a device on ThingPark Enterprise All In One, I noticed that there was no field for the AppEUI. After contacting the distributor from whom we purchased the LoRa gateway, they informed me that entering the AppEUI is not required, and that we only need to set the DevEUI and AppKey. They also mentioned that AppEUI="0000000000000000" is considered invalid, and that we should use a different alphanumeric value.

Based on this information, I updated the Arduino MKR WAN 1310 sketch to set AppEUI="0101010101010101" and AppKey="0123456789ABCDEFFEDCBA9876543210", selecting the AS923 region within the MKRWAN begin() function. On ThingPark Enterprise All In One, I tried adding the device by selecting Generic as the manufacturer, LoRaWAN 1.0.2(AS923-2)-class A as the model, and using the Arduino MKR WAN 1310’s DevEUI plus AppKey="0123456789ABCDEFFEDCBA9876543210". However, the connection attempt fails.

For the initial setup of ThingPark Enterprise All In One, the distributor configured steps 1 through 4 of the “Getting started in 7 steps” guide (found at https://docs.thingpark.com/thingpark-enterprise-all-in-one/), and we plan to handle steps 5 onward ourselves. We have set the RF region to “Japan 8-channels 20mW.”

Could you please advise us on how to successfully connect an Arduino MKR WAN 1310 to ThingPark Enterprise All In One? For reference, below is the Arduino sketch we are using. We have confirmed that this sketch can successfully connect to another Wirnet iFemtoCell 923 running Kerlink’s SPN.

Any guidance would be greatly appreciated. Thank you very much!

  1. /* 
  2.   This is a test sketch for measuring differential pressure using the Honeywell HSCDRRD006MDSA3 sensor 
  3.   with an Arduino MKR WAN 1310, then sending the data via LoRa and displaying it on the serial monitor.

  4.   [Sensor specifications: Honeywell HSCDRRD006MDSA3]
  5.     - Pressure Type: Differential
  6.     - Operating Pressure: 6 mbar (~0.087 psi)
  7.     - Output Type: Digital (SPI)
  8.     - Operating Supply Voltage: 3.3V
  9.     - Resolution: 12-bit
  10.     - Others: TruStability Series
  11.   
  12.   In this sketch, we acquire a small differential pressure value (in psi) from the sensor, 
  13.   convert it to Pascals (Pa), then send it via both the local serial monitor and LoRa.
  14. */

  15. #include <MKRWAN.h>
  16. #include <HoneywellTruStabilitySPI.h>
  17. #include <SPI.h>

  18. // Create an instance of the LoRa modem (using Serial1)
  19. LoRaModem modem(Serial1);

  20. // Create a sensor object using the default SS pin (Slave Select)
  21. // Note: The sensor's operating pressure range is about 6 mbar (~0.087 psi).
  22. // We'll use ±0.09 psi for this demo.
  23. #define SLAVE_SELECT_PIN 7
  24. TruStabilityPressureSensor sensor(SLAVE_SELECT_PIN, -0.09, 0.09);

  25. // LoRa OTAA credentials
  26. String appEui = "0101010101010101";
  27. String appKey = "0123456789ABCDEFFEDCBA9876543210";

  28. void setup() {
  29.   // Initialize serial for debugging (115200bps)
  30.   Serial.begin(115200);
  31.   while (!Serial) {
  32.     // Wait for the serial port to open (necessary on MKR boards over USB)
  33.   }

  34.   // Initialize the LoRa modem
  35.   modem.begin(AS923);
  36.   int connected = modem.joinOTAA(appEui, appKey);
  37.   if (connected > 0) {
  38.     Serial.println("Successfully joined the LoRa network");
  39.   } else {
  40.     Serial.println("Failed to join the LoRa network");
  41.   }
  42.   modem.setPort(1);  // Use port 1 for sensor data

  43.   // Initialize SPI and the sensor
  44.   SPI.begin();
  45.   sensor.begin();

  46.   // Set analog read resolution to 12 bits (for CO meter)
  47.   analogReadResolution(12);

  48.   Serial.println("Sensor initialization complete");
  49. }

  50. void loop() {
  51.   float pressurePsi = 0.0;
  52.   float temperature = 0.0;
  53.   
  54.   // If new data is available from the sensor, read it
  55.   // sensor.readSensor() returns 0 if the new data is valid
  56.   if (sensor.readSensor() == 0) {
  57.     pressurePsi = sensor.pressure();    // Unit: psi
  58.     temperature = sensor.temperature(); // Unit: °C
  59.   } else {
  60.     // If data cannot be retrieved, set pressure to 0 (or handle accordingly)
  61.     pressurePsi = 0.0;
  62.   }
  63.   
  64.   // Convert psi to Pascals (Pa). 1 psi = 6894.76 Pa
  65.   float pressurePa = pressurePsi * 6894.76;
  66.   if (pressurePa < 0) {
  67.     pressurePa = 0;
  68.   }

  69.   // Display measurements in both Pa and psi on the serial monitor
  70.   Serial.print("Pressure[psi]: ");
  71.   Serial.print(pressurePsi);
  72.   Serial.print(" , Pressure[Pa]: ");
  73.   Serial.println(pressurePa);

  74.   // Display temperature (use as needed)
  75.   Serial.print("Temperature[C]: ");
  76.   Serial.println(temperature);

  77.   // Scale the pressure value for LoRa sending: keep two decimal places
  78.   uint16_t differentialPressureRaw = (uint16_t)(pressurePa * 100);
  79.   uint8_t differentialPressureScaled[2];
  80.   differentialPressureScaled[0] = differentialPressureRaw >> 8;    // High byte
  81.   differentialPressureScaled[1] = differentialPressureRaw & 0xFF;  // Low byte

  82.   // Read the analog signal from the CO meter (connected to A1)
  83.   int analogValue = analogRead(A1);
  84.   // Convert the 12-bit reading (0-4095) to a voltage range of 0-3.3V
  85.   float voltage = analogValue * (3.3 / 4095.0);
  86.   // Convert voltage to ppm based on a calibrated formula
  87.   float ppm = (voltage - 0.684) * (241 - 50) / (3.3 - 0.684) + 50;
  88.   uint16_t ppmRaw = (uint16_t)(ppm * 10);
  89.   uint8_t ppmScaled[2];
  90.   ppmScaled[0] = ppmRaw >> 8;
  91.   ppmScaled[1] = ppmRaw & 0xFF;

  92.   // Display CO meter data on the serial monitor
  93.   Serial.print("CO meter ppm: ");
  94.   Serial.println(ppm);

  95.   // Perform a short carrier sense delay (as per ARIB STD-T108)
  96.   delay(50);

  97.   // Begin LoRa packet construction
  98.   modem.beginPacket();
  99.   // Add differential pressure data (data channel 1, data type 0x02)
  100.   uint8_t DataChannel01[1] = {0x01};
  101.   uint8_t DataType01[1]   = {0x02};
  102.   modem.write(DataChannel01[0]);        // Data channel 1
  103.   modem.write(DataType01[0]);           // Data type (arbitrary)
  104.   modem.write(differentialPressureScaled, 2); // 2-byte differential pressure data
  105.   
  106.   // Add CO meter data (data channel 2, custom data type 0x88)
  107.   uint8_t DataChannel02[1] = {0x02};
  108.   uint8_t DataType88[1]    = {0x88}; // Custom data type for CO ppm
  109.   modem.write(DataChannel02[0]); 
  110.   modem.write(DataType88[0]); 
  111.   modem.write(ppmScaled, 2); // 2-byte CO meter data
  112.   
  113.   modem.endPacket();
  114.   
  115.   // Wait 10 seconds before the next send
  116.   delay(10000);
  117. }