# MKR 1500 not connecting to Network

**URL:** <https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218>\
**Category:** MKR NB 1500\
**Created:** [July 30, 2019, 11:19pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218 "2019-07-30T23:19:16Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![MPQ](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MPQ](https://forum.arduino.cc/u/MPQ)\
**Post date:** [July 30, 2019, 11:19pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/1 "2019-07-30T23:19:16Z")

</div>

Hello everyone,

I've already returned one MKR 1500 because it couldn't recognize my SIM, but the one I hold in my hands now is working fine.

I'm trying to connect to a NB-IoT Network via my 1NCE SimCard. However, when I'm trying the "NB Network Scanner" example, I can't establish a connection. I obtain the following output:

> AT+CMEE=0
> 
> OK  
> AT+CFUN=0
> 
> OK  
> AT+CPIN?
> 
> +CPIN: READY
> 
> OK  
> AT+CMGF=1
> 
> OK  
> AT+UDCONF=1,1
> 
> OK  
> AT+CTZU=1
> 
> OK  
> AT+CGDCONT=1,"IP","iot.1nce.net"
> 
> OK  
> AT+UAUTHREQ=1,0
> 
> OK  
> AT+CFUN=1
> 
> OK  
> AT+CGREG?
> 
> +CGREG: 0,4 // 4 tells me "unknown" error

I'm using a similar test snippet for my SIM7000E module and it's working just fine. Is there a specific AT command I forgot to call?

Thank you,  
Andy

---

<div class="post-metadata">

**Author:** ![pert](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/pert/32/217111_2.png) [@pert](https://forum.arduino.cc/u/pert)\
**Post date:** [July 31, 2019, 2:24am UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/2 "2019-07-31T02:24:25Z")

</div>

> MPQ:  
> However, when I'm trying the "NB Network Scanner" example, I can't establish a connection.

Where did you find that example? The closest example sketch to that name in the MKRNB library is **File \> Examples \> MKRNB \> Tools \> NBScanNetworks** , but that would have different output.

---

<div class="post-metadata">

**Author:** ![MPQ](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MPQ](https://forum.arduino.cc/u/MPQ)\
**Post date:** [July 31, 2019, 7:44am UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/3 "2019-07-31T07:44:32Z")

</div>

Right, it's exactly that example. I slightly modified the code and changed CEREG to CGREG. Here is the result, when I run it using the original code:

> NB IoT/LTE Cat M1 networks scanner  
> AT
> 
> OK  
> AT
> 
> OK  
> AT
> 
> OK  
> AT+CMEE=0
> 
> OK  
> AT+CFUN=0
> 
> OK  
> AT+CPIN?
> 
> +CPIN: READY
> 
> OK  
> AT+CMGF=1
> 
> OK  
> AT+UDCONF=1,1
> 
> OK  
> AT+CTZU=1
> 
> OK  
> AT+CGDCONT=1,"IP","iot.1nce.net"
> 
> OK  
> AT+UAUTHREQ=1,0
> 
> OK  
> AT+CFUN=1
> 
> OK  
> AT+CEREG?
> 
> +CEREG: 0,0

Obviously, I'm stuck here in the ready() method of the NB class, as it is called over and over again until CEREG acknowledges a established connection.

Same problem when I use the "TestGPRS" example as it also tries to connect.

I just tried the "TestModem" example and could not get the IMEI. Using my own code works though, I can extract the IMEI using the respective command

---

<div class="post-metadata">

**Author:** ![kickouille](https://avatars.discourse-cdn.com/v4/letter/k/e5b9ba/32.png) [@kickouille](https://forum.arduino.cc/u/kickouille)\
**Post date:** [July 31, 2019, 2:37pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/4 "2019-07-31T14:37:27Z")

</div>

Hi Andy,

I've encountered this issue and solved it that way:

1. Ensure you have a good antenna fot the band you are using.
2. Ensure there is a good coverage on your area. In my lab, which is off the floor, next to a window, I have troubles connecting. 10 meters away in another room on the other side of the building that is fine...
3. Not 100% sure of this, but having a good quality LiPo connected seems to help.

Regards,

Yanik

---

<div class="post-metadata">

**Author:** ![MPQ](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MPQ](https://forum.arduino.cc/u/MPQ)\
**Post date:** [July 31, 2019, 3:15pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/5 "2019-07-31T15:15:50Z")

</div>

Thank you very much for your reply.

1. Using the same antenna I'm using for my SIM7000E
2. My CSQ is around 11. That is enough for my SIM7000E to connect to the network. I wonder that the R410M is not able to do that.
3. I have a LiPo connected, not sure about the quality though 🙂

I looked further into the problem and I have the same problem the guy in this thread ([http://forum.sodaq.com/t/sara-r410m-doesnt-attach-to-networks-nb-iot/2255](http://forum.sodaq.com/t/sara-r410m-doesnt-attach-to-networks-nb-iot/2255)) has:

When a 1NCE SIM card is inserted, only the Vodafone network is found by COPS:

> AT+COPS=?
> 
> +COPS: (1,"262 02","262 02","26202",9),,(0,1,2,3,4),(0,1,2)

Something else I just figured: The modem seems to loose connection after a while. Maybe it's really a connection issue.

Edit: The connection is stable now: AT+CSQ returns 12. So I wonder: Why does the module only find the vodafone network?

---

<div class="post-metadata">

**Author:** ![kickouille](https://avatars.discourse-cdn.com/v4/letter/k/e5b9ba/32.png) [@kickouille](https://forum.arduino.cc/u/kickouille)\
**Post date:** [August 1, 2019, 1:04pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/6 "2019-08-01T13:04:18Z")

</div>

Hi MPQ,

COPS you show returns mode 1, meaning it is in manual mode.

Try to force in automatic mode by issuing:

```cpp
AT+COPS=0

```

If you want to do this while using the MKRNB library, do as follow by adapting your code:

```cpp
MODEM.begin(true); // true to restart the modem
while (!MODEM.noop());
MODEM.sendf("AT+COPS=0");
MODEM.waitForResponse(2000);
if (nbAccess.begin(pin, false) == NB_READY) { // second arg is false so that we don't restart the modem and loose the automatic config we did before
  // Whatever code you want here.
}

```

Concerning the coverage, changing antenna helped me a lot. Before, I was frequently loosing connection (when I was able to connect), and then with a proper antenna it was steady state.

Regards,

Yanik

---

<div class="post-metadata">

**Author:** ![JohannaB](https://avatars.discourse-cdn.com/v4/letter/j/e56c9b/32.png) [@JohannaB](https://forum.arduino.cc/u/JohannaB)\
**Post date:** [August 1, 2019, 2:00pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/7 "2019-08-01T14:00:02Z")

</div>

What do you do before running the AT-commands? Have you tried the AT-passthrough code available and written the commands manually? There you can include a reset in the setup and also run modem.begin() which might make some difference:

```cpp
  NBModem modem;
setup(){
  pinMode(SARA_RESETN, OUTPUT);
  digitalWrite(SARA_RESETN, HIGH);
  delay(100);
  digitalWrite(SARA_RESETN, LOW);
  modem.begin()
}

```

I usually just run the passthrough code and write AT+CEREG? in the serial port. If you didnt find the passthrough code before:

```cpp
#include <MKRNB.h>
NBModem modem;

// baud rate used for both Serial ports
unsigned long baud = 115200;

void setup() {
  // reset the ublox module
  pinMode(SARA_RESETN, OUTPUT);
  digitalWrite(SARA_RESETN, HIGH);
  delay(100);
  digitalWrite(SARA_RESETN, LOW);

  Serial.begin(baud);

  while (!Serial) {
    ;
  }
  Serial.println("CPU connected to PC");
  if (modem.begin()) {
    Serial.println("Modem connected to CPU");
  } else {
    Serial.println("ERROR, no modem answer.");
  }
  
  SerialSARA.begin(baud);
}

void loop() {
  if (Serial.available()) {
    SerialSARA.write(Serial.read());
  }

  if (SerialSARA.available()) {
    Serial.write(SerialSARA.read());
  }
}

```

I also noticed that you are running on a battery. When trying to run on battery I need to call the NBClient to see if it is connected. I am very confused by what is making this difference. Is it working differently for you when powered through USB? Then this could be your issue.

---

<div class="post-metadata">

**Author:** ![MPQ](https://avatars.discourse-cdn.com/v4/letter/m/a4c791/32.png) [@MPQ](https://forum.arduino.cc/u/MPQ)\
**Post date:** [August 1, 2019, 2:51pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/8 "2019-08-01T14:51:22Z")

</div>

Thank you so much for all your help. Yes, I tried COPS=0 and it turned out it's not an issue related to the connection strength or battery.

I did a lot of trial and error and I found out what caused the connection to fail after a couple of seconds I turned the device on (CFUN=1):

I changed:

```cpp
AT+UDCONF=75,1,1

```

to

```cpp
AT+UDCONF=75,1,2 //AT+UDCONF=75,1,0 works as well

```

which changes the PDP IP configuration when roaming to IPv4v6. I don't know exactly why I need to set that value, but it works perfectly now.

---

<div class="post-metadata">

**Author:** ![JGL](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jgl/32/476370_2.png) [@JGL](https://forum.arduino.cc/u/JGL)\
**Post date:** [October 22, 2019, 8:30am UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/9 "2019-10-22T08:30:21Z")

</div>

Sorry, but I'm really lost with this project (NBSSLWebClient from arduino library). This are the prgram and the resulted code:

PROGRAM:

```cpp
/*
  SSL Web client

 This sketch connects to a website using SSL through a MKR NB 1500 board. Specifically,
 this example downloads the URL "https://www.arduino.cc/asciilogo.txt" and
 prints it to the Serial monitor.

 Circuit:
 * MKR NB 1500 board
 * Antenna
 * SIM card with a data plan

 created 8 Mar 2012
 by Tom Igoe
*/

// libraries
#include <MKRNB.h>

#include "arduino_secrets.h" 
// Please enter your sensitive data in the Secret tab or arduino_secrets.h
// PIN Number
const char PINNUMBER[] = SECRET_PINNUMBER;
const char APN[]= APNcode;

// initialize the library instance
NBSSLClient client;
GPRS gprs;
NB nbAccess=true;

// URL, path and port (for example: arduino.cc)
char server[] = "arduino.cc";
char path[] = "/asciilogo.txt";
int port = 443; // port 443 is the default for HTTPS

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.println("Starting Arduino web client.");
  // connection state
  boolean connected = false;

  // After starting the modem with NB.begin()
  // attach to the GPRS network with the APN, login and password

  while (!connected) {
    if ((nbAccess.begin(PINNUMBER,APN,true,true ) == NB_READY) &&
        (gprs.attachGPRS() == GPRS_READY)) {
      connected = true;
    } else {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("connecting...");

  // if you get a connection, report back via serial:
  if (client.connect(server, port)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.print("GET ");
    client.print(path);
    client.println(" HTTP/1.1");
    client.print("Host: ");
    client.println(server);
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // if the server's disconnected, stop the client:
  if (!client.available() && !client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();

    // do nothing forevermore:
    for (;;)
      ;
  }
}

```

SERIAL MONITOR:

```cpp
AT

OK
AT+CMEE=0

OK
AT+CFUN=0

OK
AT+CPIN?

+CPIN: READY

OK
AT+CMGF=1

OK
AT+UDCONF=1,1

OK
AT+CTZU=1

OK
AT+CGDCONT=1,"IP","internet4gd.gdsp"

OK
AT+UAUTHREQ=1,0

OK
AT+CFUN=1

OK
AT+CEREG?

+CEREG: 0,3

OK
Not connected

```

---

<div class="post-metadata">

**Author:** ![yappadu](https://avatars.discourse-cdn.com/v4/letter/y/b19c9b/32.png) [@yappadu](https://forum.arduino.cc/u/yappadu)\
**Post date:** [January 14, 2020, 4:30pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/10 "2020-01-14T16:30:15Z")

</div>

Were you able to get this program to work?

yud

---

<div class="post-metadata">

**Author:** ![philipdbrown](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/philipdbrown/32/1149044_2.png) [@philipdbrown](https://forum.arduino.cc/u/philipdbrown)\
**Post date:** [July 27, 2020, 12:13am UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/11 "2020-07-27T00:13:06Z")

</div>

Hey All,  
I'd love to know details on if you were able to get your MKR NB 1500 working. I have a [hologram.io](http://hologram.io) sim card. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![zbelding](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/zbelding/32/238831_2.png) [@zbelding](https://forum.arduino.cc/u/zbelding)\
**Post date:** [July 27, 2020, 1:27am UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/12 "2020-07-27T01:27:04Z")

</div>

> philipdbrown:  
> Hey All,  
> I'd love to know details on if you were able to get your MKR NB 1500 working. I have a [hologram.io](http://hologram.io) sim card. Thanks in advance.

Do you have your APN set to "hologram"?

---

<div class="post-metadata">

**Author:** ![adamcarranza55](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@adamcarranza55](https://forum.arduino.cc/u/adamcarranza55)\
**Post date:** [August 9, 2020, 4:10pm UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/13 "2020-08-09T16:10:54Z")

</div>

For those with the Arduino MKR NB 1500, I found that reception using a tmobile hotspot data only sim was terrible. I used a AT&T prepaid phone sim and immediately was able to get connection. Also check to see if your carrier supports the SARA-R410M module on the 1500. You can see that AT&T supports it here: [Get Network Ready – AT&T IoT Devices](https://iotdevices.att.com/networkready.aspx)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 7, 2021, 11:55am UTC](https://forum.arduino.cc/t/mkr-1500-not-connecting-to-network/604218/14 "2021-05-07T11:55:49Z")

</div>


