Help for connection problems [solved]

Okey i hope that this will help someone, i did read many topics for this and what did help me :slight_smile:

  1. If you have mega or leonard
    http://arduino.cc/en/Guide/GSMShieldLeonardoMega

  2. Add external power supply

  3. In some networks you will need band management

/*
 Band Management

 This sketch, for the Arduino GSM shield, checks the band
 currently configured in the modem and allows you to change
 it.

 Please check http://www.worldtimezone.com/gsm.html
 Usual configurations:
 Europe, Africa, Middle East: E-GSM(900)+DCS(1800)
 USA, Canada, South America: GSM(850)+PCS(1900)
 Mexico: PCS(1900)
 Brazil: GSM(850)+E-GSM(900)+DCS(1800)+PCS(1900)


 Circuit:
 * GSM shield

 created 12 June 2012
 by Javier Zorzano, Scott Fitzgerald

 This example is in the public domain.
 */

// libraries
#include <GSM.h>

// initialize the library instance
GSMBand band;

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

  // Beginning the band manager restarts the modem
  Serial.println("Restarting modem...");
  band.begin();
  Serial.println("Modem restarted.");

};


void loop()
{
  // Get current band
  String bandName = band.getBand(); // Get and print band name
  Serial.print("Current band:");
  Serial.println(bandName);
  Serial.println("Want to change the band you’re on?");
  String newBandName;
  newBandName = askUser();
  // Tell the user what we are about to do…
  Serial.print("\nConfiguring band ");
  Serial.println(newBandName);
  // Change the band
  boolean operationSuccess;
  operationSuccess = band.setBand(newBandName);
  // Tell the user if the operation was OK
  if (operationSuccess)
  {
    Serial.println("Success");
  }
  else
  {
    Serial.println("Error while changing band");
  }

  if (operationSuccess)
  {
    while (true);
  }
}

// This function offers the user different options
// through the Serial interface
// The user selects one
String askUser()
{
  String newBand;
  Serial.println("Select band:");
  // Print the different options
  Serial.println("1 : E-GSM(900)");
  Serial.println("2 : DCS(1800)");
  Serial.println("3 : PCS(1900)");
  Serial.println("4 : E-GSM(900)+DCS(1800) ex: Europe");
  Serial.println("5 : GSM(850)+PCS(1900) Ex: USA, South Am.");
  Serial.println("6 : GSM(850)+E-GSM(900)+DCS(1800)+PCS(1900)");

  // Empty the incoming buffer
  while (Serial.available())
    Serial.read();

  // Wait for an answer, just look at the first character
  while (!Serial.available());
  char c = Serial.read();
  if (c == '1')
    newBand = GSM_MODE_EGSM;
  else if (c == '2')
    newBand = GSM_MODE_DCS;
  else if (c == '3')
    newBand = GSM_MODE_PCS;
  else if (c == '4')
    newBand = GSM_MODE_EGSM_DCS;
  else if (c == '5')
    newBand = GSM_MODE_GSM850_PCS;
  else if (c == '6')
    newBand = GSM_MODE_GSM850_EGSM_DCS_PCS;
  else
    newBand = "GSM_MODE_UNDEFINED";
  return newBand;
}
  1. I did try Arduino 1.0.6 there was something that did not work :frowning:
    Try Arduino 1.5.8 BETA

  2. Most importantly, try something easy example: GSM Scan Networks, so you can see if it works before you'll try anything complicated

/*

 GSM Scan Networks

 This example prints out the IMEI number of the modem,
 then checks to see if it's connected to a carrier. If so,
 it prints the phone number associated with the card.
 Then it scans for nearby networks and prints out their signal strengths.

 Circuit:
 * GSM shield
 * SIM card

 Created 8 Mar 2012
 by Tom Igoe, implemented by Javier Carazo
 Modified 4 Feb 2013
 by Scott Fitzgerald

 http://arduino.cc/en/Tutorial/GSMToolsGsmScanNetworks

 This example code is part of the public domain
 */

// libraries
#include <GSM.h>

// PIN Number
#define PINNUMBER "0000"

// initialize the library instance
GSM gsmAccess;     // include a 'true' parameter to enable debugging
GSMScanner scannerNetworks;
GSMModem modemTest;

// Save data variables
String IMEI = "";

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

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

  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);
}

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]");

}

It took me 6h find it out that all, I hope that this will help someone :wink:

ps: I registered here to write this message, if the admin finds it necessary, he can delete this topic :slight_smile: And sorry for my bad english if you do not understand something I can try to clarify the point as long as I have time.