phparduinosim900

Sim900 AT+HTTPPARA missing character


I am doing a project where I send two variables to my website where my website will receive and display it.

Project info: Arduino + SIM900 + PHP (Sending data to a website)

I have code that sends AT commands to my SIM900 and displays its reply.

My problem is that when I am running my code in the Serial Monitor it seems that the last quotation on the URL is not being sent/printed to my SIM900.

Here is my code:

#include <SoftwareSerial.h>
SoftwareSerial GPRS(5, 6);
long duration;
int distance;
const int trigPin = 10;
const int echoPin = 11;

void setup() {
  powerUp();  
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  GPRS.begin(19200);
  Serial.begin(19200);

  Serial.println("Con");
  delay(2000);
  Serial.println("Done!...");
  GPRS.flush();
  Serial.flush();

  // See if the SIM900 is ready
  GPRS.println("AT");
  delay(1000);
  toSerial();
  GPRS.print("at+cmee=2\r");
  toSerial();
  // SIM card inserted and unlocked?
  GPRS.println("AT+CPIN?");
  delay(1000);
  toSerial();

  // Is the SIM card registered?
  GPRS.println("AT+CREG?");
  delay(1000);
  toSerial();

  // Is GPRS attached?
  GPRS.println("AT+CGATT?");
  delay(1000);
  toSerial();

  // Check signal strength
  GPRS.println("AT+CSQ ");
  delay(1000);
  toSerial();

  // Set connection type to GPRS
  GPRS.println("AT+SAPBR=3,1,\"Contype\",\"GPRS\"");
  delay(2000);
  toSerial();

  // Set the APN
  GPRS.println("AT+SAPBR=3,1,\"APN\",\"internet\"");
  delay(2000);
  toSerial();

  // Enable GPRS
  GPRS.println("AT+SAPBR=1,1");
  delay(10000);
  toSerial();

  // Check to see if connection is correct and get your IP address
  GPRS.println("AT+SAPBR=2,1");
  delay(2000);
  toSerial();
}

void loop() {
  delay(10000);
  sensor();
  GPRS.println("AT+HTTPINIT\r");
  delay(1000);
  toSerial();
  GPRS.println("AT+HTTPPARA=\"CID\",1\r");
  delay(1000);
  toSerial();
  GPRS.println("AT+HTTPPARA=\"URL\",\"aclc-onlineparkingtracker.000webhostapp.com/?id=1&sts=0\r"); <--- HERE
  delay(10000);
  toSerial();
  GPRS.println("AT+HTTPACTION=0\r");
  delay(7000);
  toSerial();
  GPRS.println("AT+HTTPTERM\r");
  toSerial();
}

void toSerial() {
  while(GPRS.available()!=0) {
    Serial.write(GPRS.read());
  }
}

void powerUp() {
  pinMode(9, OUTPUT);
  digitalWrite(9, LOW);
  delay(1000);
  digitalWrite(9, HIGH);
  delay(2000);
  digitalWrite(9,LOW);
  delay(3000);
}

And here is the output in my Serial Monitor:

Con
Done!...
AT

OK
at+cmee=2
AT+CPIN?

OK
AT+CREG?

+CREG: 0,1

OK
AT+CGATT?

+CGATT: 0

OK
AT+CSQ 

+CSQ: 10,0

OK
AT+SAPBR=3,1,"Contype","GPRS"

OK
AT+SAPBR=3,1,"APN","internet"

OK
AT+SAPBR=1,1

OK
AT+SAPBR=2,1

+SAPBR: 1,1,"10.32.133.18"

OK
AT+HTTPINIT


OK
AT+HTTPPARA="CID",1


OK
AT+HTTPPARA="URL","aclc-onlineparkingtracker.000webhostapp.com/?id=1&st=1 <--HERE


+CME ERROR: operation not allowed

What I tried:


Solution

  • UPDATE:

    I changed this line:

    GPRS.println("AT+HTTPPARA=\"URL\",\"aclc-onlineparkingtracker.000webhostapp.com/?id=1&sts=0\r");
    

    to

    GPRS.println("AT+HTTPPARA=\"URL\",\"aclc-onlineparkingtracker.000webhostapp.com/?id=1&st=1\"");
    

    I removed \r and I added \" at the end of my URL.