Support for the Antrax GSM/GPRS shield (w/o GPS)?

Hi,

I am attempting to use the Antrax GSM/GPRS shield (w/o GPS) to receive SMS. Other than the initialization code giving on the website ( http://www.antrax.de/downloads/arduino-gsm-gprs-gps-shield-manual_rev.6_en.pdf), i can find no information on the device. I have no idea what libraries work with it and have found no community that supports it like hw kitchen for instance.

Upon asking the manufacturer on this matter, they sent me links to Telit GE865 data sheets and AT command lists. I know what type of AT commands the module uses, and which ones i need to use, but have no idea how to implement this into the Arduino IDE or how to communicate with the board as a whole.

Any help would be appreciated, thanks!

The PDF you linked to says that the deliverables include a software library and example code. Do you have those?

weestee:
Thats not the whole code.

Obviously not. It looks more like a library than a sketch, and judging by the comment at the start of the file, it's a header file named GSM_GPS_Shield_Mega.h which contains the declarations for a GSM library.

Assuming you have the rest of the library too, what you're missing is one or more example sketches demonstrating how to use it. The manufacturers site says it provides the library and examples so presumably they're around there somewhere.

Yeah there is an example code given, i am not sure where to implement it though.

GSM gsm(7,9600);                                                                 // (power_pin, baudrate)
GPS gps(9600);                                                                   // (baudrate)

void setup()
{
  if(gps.initializeGPS())
    Serial.println("Initialization completed");
  else
    Serial.println("Initialization can't completed");
}

void loop()
{
  delay(300);
  gps.setLED(1);
  delay(500);  
  gps.setLED(0); 
  
  if(!gps.checkS1())                 
  {
    gsm.initializeGSM("1234");                                          // Enter your SIM-Pin if it's required (Example: "1234") --> the quote signs are important
    delay(200);
    gsm.makeCall("0176123456789");                                      // Enter the Destination-Phone-Number (Example: "0176123456789" or "+49176123456789") --> the quote signs are important
  }
  if(!gps.checkS2())                 
  {
    gsm.initializeGSM("1234");                                          // Enter your SIM-Pin if it's required (Example: "1234") --> the quote signs are important
    delay(200); 
    gsm.sendSMS("0176123456789","Hello World");                         // Enter the Destination-Phone-Number (Example: "0176123456789" or "+49176123456789") --> the quote signs are important
  }
}

i am not sure where to implement it though.

How about on the Arduino?

hah yeah, i mean iv added the example code to the library and im still getting similar errors =/

i mean iv added the example code to the library and im still getting similar errors =/

Post your code. Post your errors.

It's time you learned to organize your code properly. Class definitions go in a .h file. Class implementations go in a .cpp file. Class definitions and class implementations do not go in the sketch (.ino file).

You can post code properly, using the Additional Options... link when the file size exceeds the post limit.

A peek at the strcat() function would help shorten your code. A proper understanding of C strings would help, too. A C string is a NULL terminated array of characters. That is ONE null. Not one in every array position. Clearing the coordinates array is simple:

coordinates[0] = '\0';

There is no reason to stuff a NULL in every position in the array.

weestee:
Errors read: 621: redefinition of 'GSM gsm'
101: 'GSM gsm' previously declared here
Using_GSM_and_GPS:20: redefinition of 'GSM gsm'
622: 'GPS gps' previously delcared here

The variable named gsm of type GSM is declared in two places. You should have at least suspected this from the wording of the error message, and a search for that variable name would have confirmed your suspicion immediately.

Suggest you fix the initial problem before you worry about what the subsequent errors mean.

Ok looking back, probably wasnt the best idea to attach whole library and just simply request for vague help.

I am still trying to get device to receive SMS. I have declared the function recieveSMS() in the header file.

class GSM
  {     
    public:
      GSM(int powerON_pin, int baud);
      void initializeGSM(char pwd[4]);
      void sendSMS(char number[50], char text[180]);
      void makeCall(char number[50]);
      void receiveSMS(char number[50], char text[180]);
      void recieveCall(char number[50]);
      void status();

I then went into source file and based the code of the sendSMS function, but altering the AT commands to have AT+CMGL=ALL, which is an execution command that reports the list of all messages with a certain status value, stored at a certain position in the SIM card memory.

void GSM::receiveSMS(char number[50], char text[180])
{
   state = 0;
  readAnswer=0;
  
  do    
    if(readAnswer == 0)
    {            
      if(state == 0)
      {
        inByte = 1;
        Serial.print("AT+CMGL=ALL");
        Serial.print(number);
        Serial.print(",129\r");  
                                               // 129 - number in national format  
       readAnswer = 1;
      }
      
      if(state == 1)
      {
        inByte = 0;
        Serial.println("GSM/GPRS/GPS-Shield");
        Serial.println(text);                                                   // Message-Text
        Serial.print("AT+CMGF=1");
        Serial.print("AT+CMGR=1");
        Serial.write(26);                                                       // CTRL-Z 
        readAnswer = 1;
      }
    } 
    else
    {   
      readGSMAnswer();                        
    }
  while(state <= 1);  
}

After creating receiveSMS i added it to the example code and uploaded it to the arduino,as shown below. It uploaded successfully.

GSM gsm(7,9600);                                                                 // (power_pin, baudrate)
GPS gps(9600);                                                                   // (baudrate)

void setup()
{
  if(gps.initializeGPS())
    Serial.println("Initialization completed");
  else
    Serial.println("Initialization can't completed");
}

void loop()
{
  delay(300);
  gps.setLED(1);
  delay(500);  
  gps.setLED(0); 
  
  if(!gps.checkS1())                 
  {
    gsm.initializeGSM("1234");   
    delay(200); 
    gsm.receiveSMS("075xxxxxxxx","GSM/GPRS/GPS-Shield"); 
  }
  if(!gps.checkS2())                 
  {
    gsm.initializeGSM("1234");                                          // Enter your SIM-Pin if it's required (Example: "1234") --> the quote signs are important
    delay(200); 
    gsm.sendSMS("07535267131","Hello World"); 
  }
}

however on the serial monitor, the response i got was "Initialization completed". then i press switch 1 on shield then i get "ATATE0AT+IPR=9600AT#SIMDET=1AT+CPIN?AT+CREG?AT+CREG?AT+CMGF=1AT=AT+CMGL=ALL07xxxxxxxxx,129".

Now as far as i understand AT+CPIN? is asking for the SIM pin, which during the initialization period it obtains (atleast thats the way it looks in the source library). Additionally AT+CREG? is asking for network connectivity and again, during the initialization this connection was meant to have occured. I will repost the initialization code below.

void GSM::initializeGSM(char pwd[20])
{ 
  Serial.begin(_baud);                                                          // 9600 Baud 
  pinMode(_powerON_pin, OUTPUT);                                                // Pin 7 as Output
  digitalWrite(_powerON_pin, HIGH);                                             // enable Power GSM-Modul
  
  delay(3000);
  state = 0;
  readAnswer=0;

  do
    if(readAnswer == 0)
    {
      if(state == 0)
      {  
        inByte=0;
        Serial.print("AT\r");                                                   // send AT  (wake up
        readAnswer = 1;
      } 

      if(state == 1)
      {
        inByte = 0;
        Serial.print("ATE0\r");                                                 // disable Echo   
        readAnswer = 1;
      }

      if(state == 2)
      {
        inByte = 0;
        Serial.print("AT+IPR=9600\r");                                          // set Baudrate
        readAnswer = 1;
      }
      
      if(state == 3)
      {
        inByte = 0;
        Serial.print("AT#SIMDET=1\r");                                          // set SIM Detection mode  (SIM)       
        readAnswer = 1;
      }
      
      if(state == 4)
      {
        sim_error = 0;
        inByte = 0;
        delay(1000);
        Serial.print("AT+CPIN?\r");                                             // pin need?   (SIM)      
        readAnswer = 1;
      }
      
      if(state == 5)
      {
        inByte = 0;
        Serial.print("AT+CPIN=");                                               // enter pin   (SIM)     
        Serial.print(pwd);
        Serial.print("\r");
        readAnswer = 1;
      }
      
      if(state == 6)
      {
        reg_OK = 0;
        inByte = 0;
        delay(2000);
        Serial.print("AT+CREG?\r");                                             // Network Registration Report     
        readAnswer = 1;
      }
      
      if(state == 7)
      {
        inByte = 0;
        Serial.print("AT+CMGF=1\r");                                            // use text-format for sms        
        readAnswer = 1;
      }
    } 
    else
    {   
      readGSMAnswer();                     
    }
  while(state <= 7);
}

So confused by this i update the recieveSMS to clarify the answer to these commands. Yet when i re-upload with addition AT commands in it, i get a similar response on the serial monitor.

Why are you printing your modem commands to the Serial port instead of the GSM modem?

You are using way too many variables with vague names like state. You are using way to many global variables. You are using way too few comments.

I hate do/while statements. They are rarely the correct construct. Checking the condition (and having it at the top) is far more often the correct construct.

Using an enum for state, and giving the states names makes it a lot easier to understand what your code is supposed to do, and to see if it is actually doing what it is supposed to do.

Of course, I suspect that the problem is that you are sending commands and getting responses, but the response is not associated with the command, since serial communication is asynchronous.