I am trying to call a HTTP GET using my Arduino via SIM900A.

When I run the commands manually via the USB port, I am able to get the commands to run. Now, when I put the same sequence on arduino, the setup() is called repeatedly after the sendATcommand(httpAuthCommand, "OK", 2000);. Looks like a reset issue.

I read, this link to put all my code into loop to avoid the setup() reset issue. But seems like this is did not fix the issue.

I have debugged it to this one change.

This Works

char httpAuthCommand[] = "AT+HTTPPARA=\"URL\",\"http://www.m2msupport.net/m2msupport/http_get_test.php\"" ;

This Does Not work

char httpAuthCommand[] = "AT+HTTPPARA=\"URL\",\"\"" ;

I debugged this a bit more, it does not work when I add ?identity=%2B0123456789&identityType=1 to the httpAuthCommand. Something crazy while sending parameters ??

In loop()

sendATcommand(httpAuthCommand, "OK", 2000); 

sendATcommand method

int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout){

    uint8_t x=0,  answer=0;
    char response[100];
    unsigned long previous;
    memset(response, '\0', 100);    // Initialice the string
    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
        // if there are data in the UART input buffer, reads it and checks for the asnwer
        if(Serial.available() != 0){    
            response[x] = Serial.read();
            // check if the desired answer is in the response of the module
            if (strstr(response, expected_answer) != NULL)    
                answer = 1;
    // Waits for the asnwer with time out
    }while((answer == 0) && ((millis() - previous) < timeout));    

    return answer;

Raw commands work on Chrome


My Guess

I am missing some escape sequence characters in the command (especially in the parameters section ?identity=%2B0123456789&identityType=1).

2 Answers 2


"Something crazy while sending parameters ??"

Possibly your power supply is to weak so 5V drops low and the processor resets when the transmitter sends a message.

  • I have multimeter, can you tell me how to check for this to be true ? I do have a 1A power supply, and that may be the reason. What pin should I be checking for the power ?
    – Siddharth
    Mar 28, 2015 at 11:54
  • I checked voltage between the Power Gnd, and Pin 55,56,57 of the sim900A. It reports a constant 3.9V.
    – Siddharth
    Mar 28, 2015 at 12:01
  • 1Amp is probably enough. your problem is something else then.
    – Wirewrap
    Mar 28, 2015 at 17:05

Could you have exceeded the rather limited RAM? First experiment: Replace the added string with "xxx....x". If you have the same problem, then it's not the contents of the string but its length. Second experiment (or jump straight to this one): Compile your strings in flash instead of in RAM. Note this will only help if you have a number of them, since your code will have to copy each one to RAM (at run-time) in order to use it, taking up some of the space you had saved. If there is only one string moved to flash, your code will need a temporary buffer of equal size (though only during the actual print call). A possible way around this is to break up the long string into a number of short ones, put all of them in flash, then print them sequentially at run time. That will need a buffer only as large as your largest substring. The cost will be increased use of flash, both for string storage and for the extra number of print calls; and slightly slower execution (probably not an issue).

This may be telling you that you need a more capable processor (one with more RAM space) or that you need to start getting creative about fitting your application into the one you've got.

  • Its a ATMEGA328, and code size is just 3kb. Total size of memory is 28kb.
    – Siddharth
    Mar 28, 2015 at 18:37
  • It only has 2K of RAM, though, and that is usually its toughest limitation. We don't know for a fact that you're out of RAM but it's easy to use it up, and when you do, something gets over-written and the program crashes. Resetting is one possible effect of that.
    – JRobert
    Mar 28, 2015 at 19:15
  • Ok, Ill look into that and report back. My power supply just konked, power led is blinking like crazy. And my 9v power is dropping to 2v after I connect it to the SIM900A board. Regulator and SIM900A ic are heating up. I think there may be a short somewhere.
    – Siddharth
    Mar 28, 2015 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.