Go Down

Topic: MKR GSM can't connect to internet (Read 1 time) previous topic - next topic

jgartner

I get the following response from the console:

Code: [Select]
Starting Arduino web client.
AT

OK
AT+IPR=921600

OK
AT

OK
AT+UPSV=3

OK
AT+CPIN?

ERROR
AT+CPIN?

+CPIN: READY

OK
AT+CMGF=1

OK
AT+UDCONF=1,1

OK
AT+CTZU=1

OK
AT+UDTMFD=1,2

OK

+UMWI: 0,1

+UMWI: 0,2

+UMWI: 0,3

+UMWI: 0,4
AT+CREG?

+CREG: 0,0

OK

[creg response repeats 46 times]

OK
AT+CREG?

+CREG: 0,0


For this I've used the following sample code:


Code: [Select]
#include <MKRGSM.h>

#include "arduino_secrets.h"

const char PINNUMBER[]     = SECRET_PINNUMBER;
// APN data
const char GPRS_APN[]      = SECRET_GPRS_APN;
const char GPRS_LOGIN[]    = SECRET_GPRS_LOGIN;
const char GPRS_PASSWORD[] = SECRET_GPRS_PASSWORD;

// initialize the library instance
GSMClient client;
GPRS gprs;
GSM gsmAccess(true);

// URL, path and port (for example: example.org)
char server[] = "ifconfig.me";
char path[] = "/ip";
int port = 80; // port 80 is the default for HTTP

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
  bool connected = false;

  // After starting the modem with GSM.begin()
  // attach the shield to the GPRS network with the APN, login and password
  while (!connected) {
    if ((gsmAccess.begin(PINNUMBER) == GSM_READY) &&
        (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == 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();

  }
}


It once worked pretty good but for some time now it doesn't what can I do? Maybe use a different antenna?

pert

Do you have your MKR GSM 1400 properly powered? The cellular radio intermittently draws high amounts of current and if your power supply can't handle this then the communication won't work reliably.

From the product page:
https://store.arduino.cc/mkr-gsm-1400
Quote
During cellular transmissions, the peak current required by the board will exceed 500mA. This is in excess of what can be sourced by a standard USB port, so it is MANDATORY to have a 1500 mAh or higher LiPo battery plugged all the time, the current provided by the USB port will be supplemented by the battery.  When powering the board using Vin, a 5V power supply that can supply at least 2A is required.

DarioPennisi

You may also be in an area where 3g and 2g have been decommissioned. Please check if your operator still supports 2g and/or 3g.

david10m

I have the same issue, did you find a solution? thanks

Go Up