Go Down

Topic: GSM Shield with AT Commands  (Read 4490 times) previous topic - next topic

ricovi

Hello,

 

I have a Galileo Gen2 and I want to connect to internet, to read the content of a page.

I have not found library since GSM.h is not compatible.

 

I think I could do it with AT Commands.

 

Someone could help me?

 

 

Thank you very much!!!

dannable

I assume that you are using the official Arduino shield with the M10 chip?

If so then if you look in GSM3ShieldV1DataNetworkProvider.cpp you will find, around line 35, the sequence of commands that are executed. If you load a Serial Relay sketch to the Arduino you can send the commands to the modem and see what response you receive.

Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

ricovi


dannable

That looks like a product by Arduino.org.

I have no experience of the Galileo Gen2 but I see you have some jumper wires fitted - can you send AT commands to it and it respond?
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

ricovi

#4
May 18, 2015, 11:33 am Last Edit: May 18, 2015, 11:34 am by ricovi
Yes, the shield have jumper wires for this: (https://www.youtube.com/watch?v=_UhWLBsZh6s) second: 37''.

When I use commands AT to send SMS, for example, shield makes it perfectly.

But, I don't know what commands I can use for conection internet by GPRS.

dannable

The relevant lines from GSM3ShieldV1DataNetworkProvider.cpp

Code: [Select]
// 1: Attach to GPRS service "AT+CGATT=1"
// 2: Wait attach OK and Set the context 0 as FGCNT "AT+QIFGCNT=0"
// 3: Wait context OK and Set bearer type as GPRS, APN, user name and password "AT+QICSGP=1..."
// 4: Wait bearer OK and Enable the function of MUXIP "AT+QIMUX=1"
// 5: Wait for disable MUXIP OK and Set the session mode as non transparent "AT+QIMODE=0"
// 6: Wait for session mode OK and Enable notification when data received "AT+QINDI=1"
// 8: Wait domain name OK and Register the TCP/IP stack "AT+QIREGAPP"
// 9: Wait for Register OK and Activate FGCNT "AT+QIACT"
// 10: Wait for activate OK


Obviously you need your APN, user name and password for stage 3.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

ricovi

I have done exactly that and get ERROR.

Code: [Select]
AT+CGATT=1

+CME ERROR: 100
AT+QIFGCNT=0

OK
AT+QICSGP=1,"sm2ms.movilforum.es",,

OK
AT+QIMUX=1

OK
AT+QIMODE=0

OK
AT+QINDI=1

OK
AT+QIREGAPP

OK
AT+QIACT

OK
AT+CGATT=1

OK
AT+QIFGCNT=0

OK
AT+QICSGP=1,"sm2ms.movilforum.es",,

OK
AT+QIMUX=1

ERROR
AT+QIMODE=0

ERROR
AT+QINDI=1

OK
AT+QIREGAPP

ERROR
AT+QIACT

ERROR


This is the result of I have done twice consecutively.

ricovi

I've got a "Arduino uno", I have connected my GSM Shield to Arduino uno and whenI compile this code, work correctly.

But when I used Galileo Gen2, not working. Since this library is not compatible with Galileo.
And I would like to do it wiht Galileo.


Code: [Select]
/*
  Web client

 This sketch connects to a website through a GSM shield. Specifically,
 this example downloads the URL "http://arduino.cc/asciilogo.txt" and
 prints it to the Serial monitor.

 Circuit:
 * GSM shield attached to an Arduino
 * SIM card with a data plan

 created 8 Mar 2012
 by Tom Igoe

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

 */

// libraries
#include <GSM.h>

// PIN Number
#define PINNUMBER ""

// APN data
#define GPRS_APN       "sm2ms.movilforum.es" // replace your GPRS APN
#define GPRS_LOGIN     ""    // replace with your GPRS login
#define GPRS_PASSWORD  "" // replace with your GPRS password

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

// URL, path & port (for example: arduino.cc)
char server[] = "www.google.es";
char path[] = "/?gws_rd=ssl";
int port = 80; // port 80 is the default for HTTP
bool encontrado=false;
bool encontrado2=false;
char caracter[900]="";
int i=1;

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("Starting Arduino web client.");
  // connection state
  boolean notConnected = true;
 
  // After starting the modem with GSM.begin()
  // attach the shield to the GPRS network with the APN, login and password
  while (notConnected)
  {
    if ((gsmAccess.begin(PINNUMBER) == GSM_READY) &
        (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD) == GPRS_READY))
      notConnected = false;
    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();
    if(c=='{'){
      encontrado=true;
     
    }
    if (encontrado || encontrado2){
      encontrado2=true;
      caracter[i]=c;
      i++;
      Serial.print(c);

      //char c = client.read();
     
    }
   
  }

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

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

dannable

Unfortunately I don't have a Galileo, but if it works with the Uno then the shield works!

Code: [Select]
AT+CGATT=1

+CME ERROR: 100


isn't good. I cannot find 100 in the list of CME error codes.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

ricovi

#9
May 18, 2015, 01:44 pm Last Edit: May 18, 2015, 02:01 pm by ricovi
But I have to do it with a Galileo
 :smiley-cry:

Go Up