3
votes

I have an arduino GSM shield sitting on top of an arduino uno. I have the code below. The shield just shows me it is connecting but it never shows me it is connected.I want to know why it is not connecting.I will be grateful for any help.Am using arduino 1.0.5 IDE.

#include <GSM.h>

#define PINNUMBER ""
GSM gsmAccess(true);
GSM_SMS sms;

void setup() {
    // initialize serial communications and wait for port to open:
    Serial.begin(9600);
    char code = 'X';
    while(true) {
        Serial.println("try Access");
        code=gsmAccess.begin("",true,false);
        Serial.println("\nAfter Access");

        if(code==GSM_READY){
          Serial.println("connected");
          break;
        }
        if(code==CONNECTING) {
          Serial.println("code is CONNECTING");
        } else {
          Serial.println(code);
          delay(1000);
        } 
    }
}
3

3 Answers

2
votes

You are starting up the modem in asynchronous mode with:

code=gsmAccess.begin("",true,false);

Looking at the GSMBegin documentation, you are going to get a return value of 0 always which does not correspond to the GSM_READY enum type which is 3 I believe. Try:

code=gsmAccess.begin("",true);
2
votes

try connecting a 9v battery to it. for me that solved the problem. i had the same issue. apparently, the gsm shield uses a lot of power. some computers can deliver enough, some cant.

0
votes

I had the same problem. I solved it by connecting a 680 μF capacitor between 5 V and GND. This is only a temporary fix because it is going to create a huge current spike when connecting the power supply. A better solution would be to connect an external power supply or a more capable USB power supply.