Connection problem with Arduino MKR WAN 1310 and Arduino IoT Cloud

Hi,
I am working on a university project using a LoRa module for sharing data through the Arduino IoT Cloud and the Thing Stack.
I am using an Arduino MKR WAN 1310 Arduino MKR WAN 1310 — Arduino Official Store with its Antenna.

For the last three weeks, I have not been able to connect the device to the cloud and therefore have not been able to share any captured data with it. The device is in a permanent connection loop, as shown in the screenshot below.
The program is not flashed via the Arduino IDE, but uploaded online (Arduino IOT Cloud) and flashed to the device. We use an OTAA connection mode (over-the-air activation) and the program listed below.

I have tried the following troubleshooting:

  • Delete the associated device and reassociate it again
  • Place the device in a different part of the city that is covered by the network to check the connection.
  • Flashing a basic connection Program with the Arduino IDE
  • Change Antenna
  • Check with another Arduino MKR WAN 1310

Everything led to the same loop. Since it worked on the first attempts and the data was sent to the cloud, I suspect a problem related to the public gateway.
What else could it be? and how could I solve the problem?

Test Programm:

#include "thingProperties.h"

void setup() {
  // Initialize serial and wait for port to open:
  Serial.begin(9600);
  // This delay gives the chance to wait for a Serial Monitor without blocking if none is found
  delay(1500);

  // Defined in thingProperties.h
  initProperties();

  // Connect to Arduino IoT Cloud
  ArduinoCloud.begin(ArduinoIoTPreferredConnection, false);

  setDebugMessageLevel(2);
  ArduinoCloud.printDebugInfo();
}

void loop() {
  ArduinoCloud.update();
  test = test+1;
  delay(10000);
}

The Things Stack Console:

Tank you!

Just wanted to let you know that you are not alone.

On August 24 my Lipo battery was at 3.6 V so I decided to put it on the charger.

Inside my house (where I charged it) the device was no longer reaching the Lora gateway.

Yesterday, after the battery was fully charged I put the device outside the house again and I verified that it could reach the Lora Gateway again in the
TTN console:

You can see that the last activity is from 13 minutes ago.

If I look at the payload most recently sent

9FA2000402FA42500000A2000302FA41C26666A2000502FA40844F33A2000204F4FF

in the CBOR decoder I can see that temperature (24.9) battery level (4.13) and humidity (52.0) are uploaded via lora gateway successfully to the TTN network.

I suspect a problem in the Arduino Iot Cloud lorawan bridge to the things network, too.
I opened an official ticket (241403) with Arduino but so far the help I got could not resolve the problem

In the meantime I can again receive my data in the Arduino IoT cloud dashboard.

I think there was a problem on the Arduino cloud side that was resolved on Sept. 12 by the Arduino team. :grinning:

But I also found a bug in my own code and learned that for Lora Things it is very important to keep the sequence of the thing properties in sync with the code in thingProperties.h

The reason is that the CBOR tagging for lora devices does not use variable names but just an ordinal number as a tag to save space.

You can decode CBOR payloads online for example at https://cbor.me

For my payloads I found the following:


Sequence of thingproperties is relevant!

Old sequence: 
Lora message payload:
9FA2000102FA42780000A2000202FA41C26666A2000302FA407E94CCA2000404F4FF
CBOR decoded:
[{0: 1, 2: 89.0}, {0: 4, 2: 25.700000762939453}, {0: 5, 2: 3.9778318405151367}, {0: 3, 4: false}]
ArduinoCloud.addProperty(hum, 4, READ, 15 * SECONDS, NULL);
ArduinoCloud.addProperty(temp, 3, READ, 15 * SECONDS, NULL);
ArduinoCloud.addProperty(volt, 5, READ, 15 * SECONDS, NULL);
ArduinoCloud.addProperty(led, 2, READWRITE, ON_CHANGE, onLedChange);

New sequence:
Lora message payload:
9FA2000102FA42780000A2000202FA41C26666A2000302FA407E94CCA2000404F4FF
CBOR decoded:
[{0: 1, 2: 62.0}, {0: 2, 2: 24.299999237060547}, {0: 3, 2: 3.9778318405151367}, {0: 4, 4: false}]
ArduinoCloud.addProperty(hum, 1, READ, 15 * SECONDS, NULL);
ArduinoCloud.addProperty(temp, 2, READ, 15 * SECONDS, NULL);
ArduinoCloud.addProperty(volt, 3, READ, 15 * SECONDS, NULL);
ArduinoCloud.addProperty(led, 4, READWRITE, ON_CHANGE, onLedChange);

So for example for temperature the correct tag was 2 and not 4
tag 2:
{0: 2, 2: 24.299999237060547}
tag 4:
{0: 4, 2: 25.700000762939453}

You can determine the correct ordinal sequence of your variables using the Arduino Iot Cloud API or CLI - here is the command I used with the CLI:

arduino-cloud-cli thing list --show-variables
1 Like

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