HTTP Post with sim900a not working

Trying to post data using sim900a with uno. here is my code below. The response is also attached below. some how the error is coming on post request.

#include <SoftwareSerial.h>
/* Create object named SIM900 of the class SoftwareSerial */
SoftwareSerial SIM900(8, 7);
void setup() {
  SIM900.begin(9600);  /* Define baud rate for software serial communication */
  Serial.begin(9600); /* Define baud rate for serial communication */
}

void loop() {
   if (SIM900.available())
    Serial.write(SIM900.read());
 
  SIM900.println("AT");
  delay(1000);
 
  SIM900.println("AT+CPIN?");
  delay(1000);
 
  SIM900.println("AT+CREG?");
  delay(1000);
 
  SIM900.println("AT+CGATT?");
  delay(1000);
 
  SIM900.println("AT+CIPSHUT");
  delay(1000);
 
  SIM900.println("AT+CIPSTATUS");
  delay(2000);
 
  SIM900.println("AT+CIPMUX=0");
  delay(2000);
 
  ShowSerialData();
 
  SIM900.println("AT+CSTT=\"ZONGWAP\"");//start task and setting the APN,
  delay(1000);
 
  ShowSerialData();
 
  SIM900.println("AT+CIICR");//bring up wireless connection
  delay(3000);
 
  ShowSerialData();
 
  SIM900.println("AT+CIFSR");//get local IP adress
  delay(2000);
 
  ShowSerialData();
 
  SIM900.println("AT+CIPSPRT=0");
  delay(3000);
 
  ShowSerialData();
  
  
   SIM900.println("GET https://api.thingspeak.com/update?api_key=546B5AHDKNTOA1DF&field1=98&field2=18");  
   
delay(5000);
  ShowSerialData();
  delay(4000);
  SIM900.println((char)26);
  SIM900.println();
  ShowSerialData();
 
  SIM900.println("AT+CIPSHUT");//close the connection
  delay(100);
  ShowSerialData();
}

void ShowSerialData()
{
  while(SIM900.available()!=0)  /* If data is available on serial port */
  Serial.write(char (SIM900.read())); /* Print character received on to the serial monitor */
}

Here is the response.

15:59:32.225 -> AT
15:59:32.225 -> 
15:59:32.225 -> OK
15:59:32.225 -> AT+CPIN?
15:59:32.225 -> 
15:59:32.225 -> +CPIN: READY
15:59:32.272 -> 
15:59:32.272 -> OK
15:59:32.272 -> AT+CREG?
15:59:32.272 -> 
15:59:32.272 -> +CREG: 0,1
15:59:32.326 -> 
15:59:32.326 -> OK
15:59:32.326 -> AT+CGATT?
15:59:32.326 -> 
15:59:32.326 -> +CGATT: 1
15:59:32.326 -> 
15:59:32.326 -> OK
15:59:32.326 -> AT+CIPSHUT
15:59:32.326 -> 
15:59:32.326 -> SHUT OK
15:59:32.326 -> AT+CIPSTATUS
15:59:32.373 -> 
15:59:32.373 -> OK
15:59:32.373 -> 
15:59:32.373 -> STATE: IP INITIAL
15:59:32.426 -> AT+CIPMUX=0
15:59:32.426 -> 
15:59:32.426 -> OK
15:59:33.427 -> AT+CSTT="ZONGWAP"
15:59:33.427 -> 
15:59:33.427 -> OK
15:59:36.396 -> AT+CIICR
15:59:36.396 -> 
15:59:36.396 -> OK
15:59:38.438 -> AT+CIFSR
15:59:38.438 -> 
15:59:38.438 -> 10.123.211.202
15:59:41.421 -> AT+CIPSPRT=0
15:59:41.421 -> 
15:59:41.421 -> OK
15:59:46.496 -> GET https://api.thingspeak.com/update?api_key=546B5AHDKNTOA1DF&field1=98&field2=18
15:59:46.599 -> 
15:59:46.599 -> ERROR

I cannot find an AT command to do the POST. Just sending a GET... to the SIM returns an error of course.

Please verify if the link is correct.

Yes the link is correct.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.