Could not connect to the Things network via Gateway

I am following basic tutorial to connect an end device to the things network via gateway but I have problems connecting to the things network.
The basic Arduino sketch which runs on the Arduino MKR 1310 board seems to be not able to connect to the network.
I have a Raspberry Pi HaT from Dragino which is connected to the network. I can see it online on the ttn server but the end node does not connect.
I have created an end application and registered a device there. I have kept all ‘00’ for the Appeui part and registered a device manually on TTN.

When I try with following code, the device is not connecting. Any suggestion will be helpful as a new to lorawan and TTN network

int connected = modem.joinOTAA(appeui, appkey);
if(!connected) {
Serial.println(“Something went wrong, you are not connected”);

Which one?

Forum search will show that some libs/implementations have a problem with this - try all zero’s ending in 1 or use a generator (search again) to create a valid code number that doesnt tread on other peoples number.

Which firmware/lib for the MKR 1301 (family isnt the best for a learner to start with acording to some…)

Which one (source), how configured?

This is here in the picture.

The arduino code

  Send and receive data from a LoRaWAN network
  This sketch demonstrates how to send and receive data with the MKR WAN 1300/1310 board.
  This example code is in the public domain.

#include <MKRWAN.h>
#include "arduino_secrets.h"

String appeui = APP_EUI;
String appkey = APP_KEY;

LoRaModem modem;

void setup() {

    Serial.println("Could not start the device");
  Serial.print("Your module version is ");
  Serial.print("Your device EUI is ");

  int connected = modem.joinOTAA(appeui, appkey);

  if(!connected) {
    Serial.println("Something went wrong, you are not connected");

void loop() {
  String msg = "Starting LoRa";
  int err;
  err = modem.endPacket(true);

  if(err > 0){
    Serial.println("Message sent correctly!");
    Serial.println("Error sending message");

Though, I have to say that I registered the end device manually and could be that I might selected some wrong value for firmware version and other stuff but it should work btw.

As you will no doubt be aware from following the tutorial to create the gateway, you have a Single Channel Packet Forwarder which is disruptive to the network and are not suitable or welcome for connection to TTN.

And that is the reason your MKR WAN won’t / can’t / could one day connect - it is using 8 channels and you have only one.

Please disconnect it immediately. You can read more here:

Okay, thanks for your quick response.
I have disconnected the Gateway and the node. So my journey to LoRa world will stop for the moment. It stopped some years ago when I started. Because there is also not a gateway around me where I can connect.
I will see if I can do something out of this expensive HaT, which took a lot of time for me for learning and configuration and end up being a full stop journey.

I’d expect the MKR WAN to cost far more than the Dragino HAT.

You can still use them to talk to each other offline from a LoRaWAN network with the correct libraries, but that is off-topic for this TTI funded forum.