Doing my first attempts to connect - failed


(Peter A) #1

Trying to connect using the Microchip module on an Arduino DUE …with no success…

Sending: mac join otaa
Join not accepted: denied
Check your coverage, keys and backend status.
Sending: mac join otaa
Join not accepted: denied
Check your coverage, keys and backend status.
Sending: mac join otaa

I am in Stockholm, less than 1 km from one GW (at IIS), and should be within reach of others. I have double and tripple checked all the IDs. I have verified on my SDR I can see attempts on 868.1 868.3 and 868.5, so my antenna seems to work. Will take it outside and even closer to the GW tomorrow to see if that helps. Any ideas of what a beginner might have messed up?

regards

/P


#2

I’m afraid that’s not enough information to ’ co debug ’

what code do you use


(Peter A) #3

I will try to go a bit closer to some gateways.
I am using the otaa example in the Arduino library on a DUE. But I am more and more thinking I am out of reach from the GW, so will try that first.

#include <TheThingsNetwork.h>

// Set your AppEUI and AppKey
const char *appEui = "<anon>";
const char *appKey = "<anon>";

#define loraSerial Serial2
#define debugSerial Serial

// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_EU868

TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);

void setup()
{
  loraSerial.begin(57600);
  debugSerial.begin(9600);

  // Wait a maximum of 10s for Serial Monitor
  while (!debugSerial && millis() < 10000)
    ;

  debugSerial.println("-- STATUS");
  ttn.showStatus();

  debugSerial.println("-- JOIN");
  ttn.join(appEui, appKey);
}

void loop()
{
  debugSerial.println("-- LOOP");

  // Prepare payload of 1 byte to indicate LED status
  byte payload[1];
  payload[0] = (digitalRead(LED_BUILTIN) == HIGH) ? 1 : 0;

  // Send it off
  ttn.sendBytes(payload, sizeof(payload));

  delay(10000);
}

I have only put an 82mm copper rod on as an antenna.

Output:

Join not accepted: denied
Check your coverage, keys and backend status.
-- STATUS
EUI: <anon>
Battery: 3273
AppEUI: <anon>
DevEUI: <anon>
Data Rate: 5
RX Delay 1: 1000
RX Delay 2: 2000
-- JOIN
Model: RN2483
Version: 1.0.3
Sending: mac set deveui <anon>
Sending: mac set adr off
Sending: mac set deveui <anon>
Sending: mac set appeui <anon>
Sending: mac set appkey <anon>
Sending: mac save 
Sending: mac set rx2 3 869525000
Sending: mac set ch drrange 1 0 6
Sending: mac set ch dcycle 0 799
Sending: mac set ch dcycle 1 799
Sending: mac set ch dcycle 2 799
Sending: mac set ch dcycle 3 799
Sending: mac set ch freq 3 867100000
Sending: mac set ch drrange 3 0 5
Sending: mac set ch status 3 on
Sending: mac set ch dcycle 4 799
Sending: mac set ch freq 4 867300000
Sending: mac set ch drrange 4 0 5
Sending: mac set ch status 4 on
Sending: mac set ch dcycle 5 799
Sending: mac set ch freq 5 867500000
Sending: mac set ch drrange 5 0 5
Sending: mac set ch status 5 on
Sending: mac set ch dcycle 6 799
Sending: mac set ch freq 6 867700000
Sending: mac set ch drrange 6 0 5
Sending: mac set ch status 6 on
Sending: mac set ch dcycle 7 799
Sending: mac set ch freq 7 867900000
Sending: mac set ch drrange 7 0 5
Sending: mac set ch status 7 on
Sending: mac set pwridx 1
Sending: mac set retx 7
Sending: mac set dr 5
Sending: mac join otaa 
Join not accepted: denied
Check your coverage, keys and backend status.
Sending: mac join otaa 
Join not accepted: denied
Check your coverage, keys and backend status.
Sending: mac join otaa 
Join not accepted: denied
Check your coverage, keys and backend status.

(Jac Kersing) #4

Basic debugging is to check the console, go to your node (within the application) and check “Data” to see if the join requests are listed. If not there are at least two possible causes, no reception (in an urban environment 1 km might be too much, depending on antenna and type of buildings between you and the gateway) and the keys… (use MSB format and make sure the Device EUI matches)

Regarding your second message, please learn how to include code in nicely formatted way.


#5

Hello,

Try changing this to “mac set dr 0” or “mac set dr 1”. And get close to a window…

Regards,


(Peter A) #6

Thanks. I was going to look into increasing power, but looks like I need to send that command directly to the port or extend the library a bit.
After having driven around for a while, with no success, I suspect my antenna or especially the ground plane might be my problem. Will build a new module with an SMA connector so I can easily test different configs.


(Peter A) #7

Thanks, will improve in the future :slight_smile:


#8

Hello,

It is up to you, but I would go for the simplest and easiest step: change data rate (dr) to 0 or 1 in the Arduino sketch.

Regards,

PS: I hope you don’t mind a correction. You have already set the input power to the maximum in the 868 MHz band by having “mac set pwridx 1” in the sketch. Turning data rate to 1 or 0 you are just increasing the so called spread factor and hence the airtime of the signal.


(Peter A) #9

Ahh, ok. And am I allowed to change the dr, is that not ‘standardised’ in the network? Building a new module as we speak, but will definitely try that on both the new and the old.


(Peter A) #10

Built new module with better antenna, same problem, no registration. I was close to give up but decided to try ABP before shutting down for today. Worked immediately, even with my first module… So seems the automatic registration is not working… Cool to be up and running, but need to figure out why OTAA is not working.


(Jac Kersing) #11

Up and running as in data in the back-end? Or just join accepted? Because the latter (join accepted) does not send/receive and network data.


(Peter A) #12

I have data flowing both ways. Not on every try, but most attempts, especially during night it worked well. Probably a rather weak signal. Will build a more useful device with a GPS, put it in the car, and build an HTTP integration to show it on a map, to properly test it out. Will also get some indication on where I have coverage.

Any way I can see the signal strength (quality of signals), or track which GW was used?

/PA


(Arjan) #13

Yes, that’s all present in the meta data you get through MQTT or HTTP, and is also visible in TTN Console, when expanding a received item.


(Peter A) #14

Great. That will definitely be very useful for further testing…

{
  "time": "2017-11-04T16:59:35.067882244Z",
  "frequency": 867.3,
  "modulation": "LORA",
  "data_rate": "SF12BW125",
  "coding_rate": "4/5",
  "gateways": [
    {
      "gtw_id": "eui-c49300ffff03698f",
      "timestamp": 3709687524,
      "time": "2017-11-04T16:59:34.819252Z",
      "channel": 4,
      "rssi": -119,
      "snr": -17
    },
    {
      "gtw_id": "sk_lora_gateway",
      "gtw_trusted": true,
      "timestamp": 3292001220,
      "time": "",
      "channel": 4,
      "rssi": -120,
      "snr": -16,
      "latitude": 59.33706,
      "longitude": 18.06752
    }
  ]
}

Interestingly to see that GW being some 5km away. There are supposed to be many closer ones, but with indoor antennas…


(Peter A) #15

Currently the ttn-handler for Europe seems down, so can’t play around much more right now. Or maybe it is just the Console that has lost contact?


#16

Correct, the eu-handler is not reachable anymore.
https://status.thethings.network/ does not say a word about it :disappointed_relieved:


(Jac Kersing) #17

How about using TTNmapper.org? If you have an Android phone with data plan you do not need a node with GPS to determine coverage. And for GPS equipped nodes you are able to feed the coordinated directly to the map. Allows other TTN users to check coverage as well.


(Peter A) #18

Wow that was really useful. Looking at Stockholm, it kind of explains the issues I have had…very few GWs and rather weak ones as well. I am trying to send in GPS coordinates at the moment, but I am not reaching the network at the moment…
I have no Android, but will have a look at what is available. Big thanks


(Arjan) #19

Beware that TTN Mapper only shows results for people who take a node on the go, and then use the app while doing that. Still then, it could be a good indicator of course.

I have no Android

According to the TTN Mapper FAQ there’s also an iPhone app. Lacking a direct link in that FAQ, I guess that is https://itunes.apple.com/us/app/ttn-mapper/id1128809850, but I don’t use an iPhone.


(Peter A) #21

A bit more than a month later I have built my own gateway with proper outdoor antenna, and added many thousand measurement points to ttn-mapper for Stockholm. Thanks for the support.