Problem with GPRS+GPS module and Xively

Hi,

I am using Arduino UNO with the GPRS+GPS module (SIM 908), and I am trying to upload some values to Xively. In this case, I a trying to upload de Humidity value, but I do not get any answer in Xively. Here is the Code:

int8_t answer;
int onModulePin= 2;

char aux_str[50];



String humidity= "5";

String TCP_message = "{\"method\":\"put\",\"resource\":\"/feeds/1991146454/\",\"params\":{},\"headers\":{\"X-ApiKey\":\"Zh0Y56TZwOfHELg8RcN9QCKAgz5JacmJwEikxF52m5swcfAM\"},\"body\":{\"version\":\"1.0.0\",\"datastreams\":[{\"id\":\"humidity\",\"current_value\":\"" + humidity + "\"}]}}";

void setup(){
    
    pinMode(onModulePin, OUTPUT);
    Serial.begin(115200);   
    
    Serial.println("Starting...");
    power_on();
    
    delay(3000);
    
    // sets the PIN code
    sendATcommand2("AT+CPIN=3765", "OK", "ERROR", 2000);
    
    delay(3000);
    
    while (sendATcommand2("AT+CREG?", "+CREG: 0,1", "+CREG: 0,5", 1000)==0);
    
}
void loop(){


  char message_TCP [300];
  TCP_message.toCharArray(message_TCP, 300); // converting TCP_message to char inorder for it to pass through AT command

  if(sendATcommand2("AT+CIPMUX=0","OK","ERROR",1000)==1)
  {
    while(sendATcommand2("AT+CIPSTATUS","INITIAL","",500)==0);
    delay(5000);

    if(sendATcommand2("AT+CSTT=\"gprs-service.com\",\"\",\"\"","OK","ERROR",30000)==1)
    {
      while(sendATcommand2("AT+CIPSTATUS","START","",500)==0);
      delay(5000);

      if(sendATcommand2("AT+CIICR","OK","ERROR",30000)==1)
      {
        while(sendATcommand2("AT+CIPSTATUS","GPRSACT","",500)==0);
        delay(5000);

        if(sendATcommand2("AT+CIFSR",".","ERROR",10000)==1)
        {
          while(sendATcommand2("AT+CIPSTATUS","IP STATUS","",500)==0);
          delay(5000);
          Serial.println("Openning TCP");

          if(sendATcommand2("AT+CIPSTART=\"TCP\",\"api.xively.com\",\"8081\"","CONNECT OK", "CONNECT FAIL", 30000)==1)
          {
            Serial.println("Konektatua");

            sprintf(aux_str,"AT+CIPSEND=%d", strlen(message_TCP));
            if(sendATcommand2(aux_str,">","ERROR",10000)==1)
          {
          sendATcommand2(message_TCP,"","ERROR",20000);
          Serial.println("Mensaje mandado!");
        }
        sendATcommand2("AT+CIPCLOSE","CLOSE OK","ERROR",10000);
          }
        else
        {
          Serial.println("Errorea konexioa irekitzen");
        }
      }
      else
      {
        Serial.println("Errorea IP helbidea lortzen");
      }
    }
    else 
    {
      Serial.println("Errorea hari gabeko konexioa irekitzen");
    }
  }
  else
  {
    Serial.println("Errorea APN-a konfigurazioarekin");
  }
}
else
{
  Serial.println("Errorea konexioa ezartzen");
}
sendATcommand2("AT+CIPSHUT","OK","ERROR",10000);

delay (4000);

}
          
     
    
  
  
void power_on(){

    uint8_t answer=0;
    
    // checks if the module is started
    answer = sendATcommand2("AT", "OK", "OK", 2000);
    if (answer == 0)
    {
        // power on pulse
        digitalWrite(onModulePin,HIGH);
        delay(3000);
        digitalWrite(onModulePin,LOW);
    
        // waits for an answer from the module
        while(answer == 0){    
            // Send AT every two seconds and wait for the answer
            answer = sendATcommand2("AT", "OK", "OK", 2000);    
        }
    }   
}

int8_t sendATcommand2(char* ATcommand, char* expected_answer1,
        char* expected_answer2, unsigned int timeout)
{

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;

    memset(response, '\0', 100);    // Initialize the string
    
    delay(100);
    
    while( Serial.available() > 0) Serial.read();    // Clean the input buffer
    
    Serial.println(ATcommand);    // Send the AT command 


    x = 0;
    previous = millis();

    // this loop waits for the answer
    do{

        if(Serial.available() != 0){    
            response[x] = Serial.read();
            x++;
            // check if the desired answer is in the response of the module
            if (strstr(response, expected_answer1) != NULL)    
            {
                answer = 1;
            }
            else if(strstr(response, expected_answer2) !=NULL)
            {
              answer=2;
            }
            }
            
        }
        // Waits for the asnwer with time out
    while((answer == 0) && ((millis() - previous) < timeout));    

    return answer;
}

Any ideas? Thank you!

Any ideas?

Only you can see what the Arduino is ACTUALLY doing, so you are the only one that can have any ideas what is right or wrong.

Have any other sketches that use the SIM 908 worked? Have you run any test programs?

Yes, this same sketch was working one month ago, and now is not working. Maybe Xively has changed something.

Aitorto8:
Yes, this same sketch was working one month ago, and now is not working. Maybe Xively has changed something.

Why didn't you mention that? Then investigate Xively.

aarg:
Why didn't you mention that? Then investigate Xively.

PaulS:
Only you can see what the Arduino is ACTUALLY doing, so you are the only one that can have any ideas what is right or wrong.

Thank's Mr. Obvious.

Aitorto8:
Thank's Mr. Obvious.

Well, there was a very important fact that you neglected to share with us, so what he said was absolutely appropriate. We are strangers sitting a world away from your workbench, not mind readers.