Search code examples
arduinoat-command

Arduino 3G GPRS shield Not Working


I am working on a 3G GPRS shield which I bought from ITEADSTUDIO. It is having a SIM5216 WCDMA module.

I having the following constraints on the shield right now

  • How do I understand that the shield has successfully connected to the network provider?
  • How do I invoke AT-Commands on the 3G Shield?
  • How do I sent SMS from the 3G GPRS shield?

Kindly provide me a solution for the above mentioned constraints.

Thank you in advance


Solution

  • First of all, based on the style of your post, I just want to warn you that there is no way around googling the hell out of your shield and banging your head against the wall in order to figure out how to use the thing you just bought. In the post that follows, I'm going to write out answers to all of your questions, and it's going to give you a head start, but you are still going to have to google the hell out of everything you don't understand and try it all until..forever.

    If you haven't gotten some practice with arduino, read "getting started with arduino."

    1.) There are several tests you can do. Here is a tutorial with AT commands you can use to program your shield. I recommend uploading a "serial relay for AT commands" onto your arduino board and then trying to either send or recieve a text message from your arduino. Here is a serial relay that I used. Note that the code as is is not going to work with your shield, because the tx/rx pins are set up differently. (On my shield --seeedstudio GPRS 2.0, the tx and rx pins are set up on pins 7 and 8. On yours, they are set up on 1-6.) Luckily for you, the pin setup on your shield will probably allow you to use the GSM library examples that come with the arduino IED.

    //Serial Relay - Arduino will patch a 
    //serial link between the computer and the GPRS Shield
    //at 19200 bps 8-N-1
    //Computer is connected to Hardware UART
    //GPRS Shield is connected to the Software UART 
    
    #include <SoftwareSerial.h>
    
    SoftwareSerial GPRS(7, 8);
    unsigned char buffer[64]; // buffer array for data recieve over serial port
    int count=0;     // counter for buffer array 
    void setup()
    {
      GPRS.begin(19200);               // the GPRS baud rate   
      Serial.begin(19200);             // the Serial port of Arduino baud rate.
    
    }
    
    void loop()
    {
      if (GPRS.available())              // if date is comming from softwareserial port ==> data is comming from gprs shield
      {
        while(GPRS.available())          // reading data into char array 
        {
          buffer[count++]=GPRS.read();     // writing data into array
          if(count == 64)break;
      }
        Serial.write(buffer,count);            // if no data transmission ends, write buffer to hardware serial port
        clearBufferArray();              // call clearBufferArray function to clear the storaged data from the array
        count = 0;                       // set counter of while loop to zero
    
    
      }
      if (Serial.available())            // if data is available on hardwareserial port ==> data is comming from PC or notebook
        GPRS.write(Serial.read());       // write it to the GPRS shield
    }
    void clearBufferArray()              // function to clear buffer array
    {
      for (int i=0; i<count;i++)
        { buffer[i]=NULL;}                  // clear all index of array with command NULL
    }
    

    2.) upload a serial relay (for sending AT commands directly from your keyboard) or embed it in your arduino code as they do in the GSM examples. To use the serial relay, read this article about terminal basics. (Get really familiar with sparkfun.com. It's a great website. Also, instructables, and adafruit).

    3.) There is example code in the GSM library on your ide, which should work for your shield. Or you can do it with at commands in the terminal once you have a serial relay setup. The commands for doing this should be in the link I gave you in answer 1.

    One more think that screwed me up for a while: make sure you have the right data plan and corresponding APN for your sim card. I use an ATT gophone, so the apn is wap.cingular.

    Good luck.