Go Down

Topic: GSM Shield Has Stopped Connecting (Read 2199 times) previous topic - next topic

bfulford

Hi. My Arduino GSM shield was working flawlessly for the first few weeks but then suddenly stopped connecting. I jhave tried it on both an Uno and a Mega 2560. I also tried a different SIM card, but it still won't connect. It is powered via an AC/DC adaptor with max 1 A. The following code hangs on "GSM networks scanner":

Code: [Select]
// import the GSM library
#include <GSM.h>

// PIN Number
#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess(true);     // include a 'true' parameter for debug enabled
GSMScanner scannerNetworks;
GSMModem modemTest;

// Save data variables
String IMEI = "";

// serial monitor result messages
String errortext = "ERROR";

void setup()
{
  // initialize serial communications
  Serial.begin(9600);
  Serial.println("GSM networks scanner");
  scannerNetworks.begin();

  // connection state
  boolean notConnected = true;

  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  // get modem parameters
  // IMEI, modem unique identifier
  Serial.print("Modem IMEI: ");
  IMEI = modemTest.getIMEI();
  IMEI.replace("\n","");
  if(IMEI != NULL)
    Serial.println(IMEI);

  // currently connected carrier
  Serial.print("Current carrier: ");
  Serial.println(scannerNetworks.getCurrentCarrier());

  // returns strength and ber
  // signal strength in 0-31 scale. 31 means power > 51dBm
  // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
  Serial.print("Signal Strength: ");
  Serial.print(scannerNetworks.getSignalStrength());
  Serial.println(" [0-31]");
}

void loop()
{
  // scan for existing networks, displays a list of networks
  Serial.println("Scanning available networks. May take some seconds.");

  Serial.println(scannerNetworks.readNetworks());

    // currently connected carrier
  Serial.print("Current carrier: ");
  Serial.println(scannerNetworks.getCurrentCarrier());

  // returns strength and ber
  // signal strength in 0-31 scale. 31 means power > 51dBm
  // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
  Serial.print("Signal Strength: ");
  Serial.print(scannerNetworks.getSignalStrength());
  Serial.println(" [0-31]");

}

Any advice?

davidgoth

Hi!,

With debug mode activated (GSM gsmAccess(true);). Can you post your serial monitor output, please?.

bfulford

David, as shown in the code, debug mode is activated. The only output I get is "GSM networks scanner".

bfulford

I tried the following debug code...

Code: [Select]
//Debug for Mega2560 with Arduino GSM.

#include <GSM.h>
GSM gsmAccess(true);
GSM_SMS sms;
void setup()
{
  Serial.begin(9600);
  char code='X';
  while(true)
  {
    Serial.println("try Access");
    code=gsmAccess.begin("",true,false);  // code=gsmAccess.begin("0000",true,false); // my pin is "0000"
    Serial.println("\nAfter Access");
    if(code==GSM_READY)
    {
      Serial.println("code is GSM_READY");
      break;
    }
    if(code==CONNECTING)
    {
      Serial.println("code is CONNECTING");
    }   
    if(code==ERROR) {Serial.println("code is ERROR");}
    if(code==IDLE) {Serial.println("code is IDLE");}
    if(code==GPRS_READY) {Serial.println("code is GPRS_READY");}
    if(code==TRANSPARENT_CONNECTED) {Serial.println("code is TRANSPARENT_CONNECTED");}
    delay(1000);
  }
}
void loop()
{
}

...which gave the following response (repeatedly):
Code: [Select]
try Access
AT%13%
After Access
code is CONNECTING


I also tried sending an AT command using the following code but there was no response.

Code: [Select]
#include <SoftwareSerial.h>
#include <string.h>

char incoming_char = 0;
SoftwareSerial cell(2,3); // check GSM RX and GSM TX matches with digital 2 and digital 3 pin.

void setup()
{
  // Initialize serial ports for communication.
  Serial.begin(9600);

  // Reset
  Serial.println("Start Reset");
  pinMode(7, OUTPUT);
  digitalWrite(7, HIGH);
  delay(12000);
  digitalWrite(7, LOW);
  delay(1000);
  Serial.println("End Reset"); 

  cell.begin(9600);

  Serial.println("Enter your AT commands (with CR & NL)...");
}

void loop()
{
  if(cell.available() > 0)
  {
    incoming_char = cell.read();
    if((incoming_char >= ' ') && (incoming_char<='z'))
      Serial.print(incoming_char);
    else
    {
      Serial.print("%");
      Serial.print((int) incoming_char);
      Serial.print("%");
      if(incoming_char == 10)
        Serial.println();
    }
  }

  if(Serial.available() > 0)
  {
    incoming_char = Serial.read();
    cell.print(incoming_char);
  }
}


Forgot to mention that the power and status light are on and the net light is blinking.




Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy