I have a SIM900 module connected to an Arduino MEGA, everything works fine except when I try to make a post request, it keeps showing ERROR after the AT+HTTPACTION=1 command is executed, by the SIM900 manual that ERROR message is related to "Mobile Equipment functionality". It worked perfectly but now it keeps showing that annoying ERROR.
This is my code: (I put a fake server address but mine works fine, I have tested it with postman)
void gprsSetup()
{
Serial.println(F("Initializing GPRS module"));
delay(1000);
Serial1.flush();
Serial.flush();
Serial1.println("AT+CGATT?");
delay(1000);
toSerial();
delay(1000);
Serial1.println("AT+CBAND?");
delay(1000);
toSerial();
delay(1000);
Serial1.println("AT+CBAND=\"ALL_BAND\"\r\n");
delay(1000);
toSerial();
delay(1000);
Serial1.print("AT+CGDCONT=1,\"IP\",\"internet.movistar.ve\",\"\",0,0\r\n");
delay(1000);
toSerial();
delay(1000);
Serial1.println("AT+CGDCONT?");
delay(1000);
toSerial();
delay(1000);
Serial1.println("AT+IPR?\r\n");
delay(1000);
toSerial();
delay(1000);
Serial1.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\r\n");
delay(1000);
toSerial();
delay(1000);
Serial1.println("AT+SAPBR=3,1,\"APN\",\"internet.movistar.ve\"\r\n");
delay(1000);
toSerial();
Serial1.println("AT+SAPBR=1,1\r\n");
delay(1000);
toSerial();
Serial1.println("AT+SAPBR=2,1\r\n");
delay(1000);
toSerial();
Serial1.println("AT+CSQ\r\n");
delay(1000);
toSerial();
delay(1000);
Serial1.println("AT+SAPBR=2,1\r\n");
delay(1000);
toSerial();
Serial1.println("AT+HTTPINIT");
delay(1000);
toSerial();
Serial1.println("AT+HTTPPARA=\"CID\",1");
delay(1000);
toSerial();
jsonWriting();
delay(3000);
Serial1.println("AT+HTTPPARA=\"URL\",\"http://myserverthatworks\""); // not my real server address
delay(1000);
toSerial();
Serial1.println("AT+HTTPPARA=\"CONTENT\",\"application/json\"");
delay(1000);
toSerial();
Serial1.println("AT+HTTPDATA=" + String(sendtoserver.length()) + ",10000"); // Server
Serial.println(sendtoserver);
delay(3000);
toSerial();
Serial1.println(sendtoserver);
delay(1000);
toSerial();
Serial1.println("AT+HTTPACTION=1");
delay(3000);
toSerial();
Serial1.println("AT+HTTPREAD");
delay(2000);
toSerial();
delay(2000);
Serial1.println("AT+HTTPTERM");
delay(3000);
toSerial();
}
And here's the output
Use this command
Serial1.println("AT+CMEE=2\r"); // Enable +CME ERROR: <err> result code
delay(1000);
toSerial();
and use verbose values so your module won't respond with a simple "ERROR" string but will tell what is the exact problem. The do:
Serial1.println("AT&W\r"); // save to be persistent after a reset
delay(1000);
toSerial();
Then when calling
Serial1.println("AT+HTTPACTION=1");
delay(3000);
toSerial();
Youwill get the error - most likely with sim900 this will be
CME ERROR: 4 Operation not supported
meaning you have to send the strings via TCP/IP and using
Serial1.println("AT+HTTPACTION=0");
If you get
CME ERROR: 3 Operation not allowed
your network operator does not allow this same as with not supported if
CME ERROR: 30 No network service
up to 40 are network issues you can not influence and errors between 41 and 50 are missing pins,puks, passwords etc. If you have any othererror message edit your question and I'll try to help