ERROR: SIM900 doesn't answer.

Hello

when i try to send GPS coordinates via SMS message and send data via gprs to server same time i have this error :

ERROR: SIM900 doesn’t answer. Check power and serial pins in GSM.cpp

this is my code, any one have a solution ?

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "inetGSM.h"
#include "sms.h"
#include "gps.h"

#include <Wire.h>
#include <ADXL345.h>
#define ScaleFor2G 0.0039
#define Threshold 0.5

ADXL345 adxl; //


InetGSM inet;
SMSGSM sms;
GPSGSM gps;
char msg[50];
int numdata;
char lon[15];
char lat[15];
char alt[15];
char time[20];
char vel[15];
char msg1[5];
char msg2[5];
char Mobile[]="0595285486";

char stat;
char inSerial[50];
int i=0;
boolean started=false;
int D5 = 5; // digital pin 5
int Led=13;
int Shock=8;
int val;
char smsbuffer2[150];
char id[]="12";
 char httpbuffer[160];
void setup()
{
    Serial.begin(9600);
  adxl.powerOn();
  pinMode(D5,INPUT);
  pinMode(Led,OUTPUT);
pinMode(Shock,INPUT);//

};

void loop()
{ int x,y,z;  
  adxl.readAccel(&x, &y, &z); //read the accelerometer values and store them in variables  x,y,z
 int sensorReading = digitalRead(D5);
val=digitalRead(Shock);


  

  
  //activity
  if(((x>500||y>500||z>500)&&val==0)||sensorReading==0){
    Serial.println("activity"); 
  digitalWrite(Led,HIGH);
  
     //Serial connection.
     Serial.begin(9600);
     Serial.println("GSM Shield testing.");
     //Start configuration of shield with baudrate.
     //For http uses is raccomanded to use 4800 or slower.
     if (gsm.begin(2400)) {
          Serial.println("\nstatus=READY");
          started=true;
           gsm.forceON();
     } else Serial.println("\nstatus=IDLE");

     if(started) {
          //GPS attach
          if (gps.attachGPS())
               Serial.println("status=GPSREADY");
          else Serial.println("status=ERROR");

          delay(20000);	//Time for fixing
          stat=gps.getStat();
          if(stat==1)
               Serial.println("NOT FIXED");
          else if(stat==0)
               Serial.println("GPS OFF");
          else if(stat==2)
               Serial.println("2D FIXED");
          else if(stat==3)
               Serial.println("3D FIXED");
          delay(5000);
          //Get data from GPS
          gps.getPar(lon,lat,alt,time,vel);
          Serial.println(lon);
          Serial.println(lat);
          Serial.println(alt);
          Serial.println(time);
          Serial.println(vel);
          convert2Degrees(lat);
          convert2Degrees(lon);
     }
        if (gsm.begin(2400)) {
          Serial.println("\nstatus=READY");
          started=true;
     } else Serial.println("\nstatus=IDLE");
     
        if(started) {
  
          //GPRS attach, put in order APN, username and password.
          //If no needed auth let them blank.
          if (inet.attachGPRS("internet", "", ""))
               Serial.println("status=ATTACHED");
          else Serial.println("status=ERROR");
          delay(1000);

          //Read IP address.
          gsm.SimpleWriteln("AT+CIFSR");
          delay(5000);
          //Read until serial buffer is empty.
          gsm.WhileSimpleRead();

          //TCP Client GET, send a GET request to the server and
          //save the reply.
                  httpbuffer[0]='\0';
 
   strcat(httpbuffer,"/GetData.aspx?lat=");
   strcat(httpbuffer,lat);
 
  strcat(httpbuffer,"&&lon=");
   strcat(httpbuffer,lon);
   strcat(httpbuffer,"&&id");
   strcat(httpbuffer,id);
   
 
            Serial.println(httpbuffer);

 
          numdata=inet.httpPOST("qou.azurewebsites.net", 80,httpbuffer, msg, msg,12);
          //Print the results.
          Serial.println("\nNumber of data received:");
          Serial.println(numdata);
          Serial.println("\nData received:");
          Serial.println(msg);
     }
  if(started){
                smsbuffer2[0]='\0';
 
   strcat(smsbuffer2,"Vehicle Accident Occurs to Vehicle which Have ");
   strcat(smsbuffer2,"ID number");
   strcat(smsbuffer2,id);
   strcat(smsbuffer2,"in Location :");
   strcat(smsbuffer2,lat);
   strcat(smsbuffer2,lon);
   strcat(smsbuffer2,"Owner Name:Ayman Abd Albasit Sadq Daqah");  
   strcat(smsbuffer2,"Mobile :");
   strcat(smsbuffer2,Mobile);


    if (sms.SendSMS(Mobile, smsbuffer2))
      Serial.println("\nSMS sent OK");
  }
  
  
  digitalWrite(Led,LOW);
  }
};
 int8_t convert2Degrees(char* input){

    float deg;
    float minutes;
    boolean neg = false;    

    //auxiliar variable
    char aux[10];

    if (input[0] == '-')
    {
        neg = true;
        strcpy(aux, strtok(input+1, "."));

    }
    else
    {
        strcpy(aux, strtok(input, "."));
    }

    // convert string to integer and add it to final float variable
    deg = atof(aux);

    strcpy(aux, strtok(NULL, '\0'));
    minutes=atof(aux);
    minutes/=1000000;
    if (deg < 100)
    {
        minutes += deg;
        deg = 0;
    }
    else
    {
        minutes += int(deg) % 100;
        deg = int(deg) / 100;    
    }

    // add minutes to degrees 
    deg=deg+minutes/60;


    if (neg == true)
    {
        deg*=-1.0;
    }

    neg = false;

    if( deg < 0 ){
        neg = true;
        deg*=-1;
    }
    
    float numeroFloat=deg; 
    int parteEntera[10];
    int cifra; 
    long numero=(long)numeroFloat;  
    int size=0;
    
    while(1){
        size=size+1;
        cifra=numero%10;
        numero=numero/10;
        parteEntera[size-1]=cifra; 
        if (numero==0){
            break;
        }
    }
   
    int indice=0;
    if( neg ){
        indice++;
        input[0]='-';
    }
    for (int i=size-1; i >= 0; i--)
    {
        input[indice]=parteEntera[i]+'0'; 
        indice++;
    }

    input[indice]='.';
    indice++;

    numeroFloat=(numeroFloat-(int)numeroFloat);
    for (int i=1; i<=6 ; i++)
    {
        numeroFloat=numeroFloat*10;
        cifra= (long)numeroFloat;          
        numeroFloat=numeroFloat-cifra;
        input[indice]=char(cifra)+48;
        indice++;
    }
        input[indice]='\0';


}

iam using itead sim908 Gsm/Gps/Gprs Module with Arduino Uno

How is the SIM900 connected to the Arduino? It appears as though you are using Serial to talk to the PC AND to talk to the SIM900. Forget that. It will not work.

Hello Pauls

i connect rx on sim908 with pin number 3 on arduino and tx with pin number 2 ?

i connect rx on sim908 with pin number 3 on arduino and tx with pin number 2 ?

Is that a question or a statement?

In either case, how does the Arduino know that?

Sorry Pauls it is a statement .

in #include “SIM900.h” Library i defined the pin :

#define GSM_TXPIN 6
#define GSM_RXPIN 5

So, you told the Arduino that the SIM900 was connected to pins 5 and 6, while you actually connected it to pins 2 and 3. And, the Arduino can't see the SIM900. Well, I guess I'm not too surprised.

i make tgis edit before 5 minutes , and now connect rx on sim908 with pin number 5 on arduino and tx with pin number 6