c++arduinoarduino-c++sim900

What does "CID" mean in AT+HTTPPARA="CID",1


I am having trouble with getting a SIM900 modem to work with HTTP requests from an Arduino using AT commands. It's currently giving me the message "ERROR" when I run 'AT+HTTPPARA="CID",1'.

My Arduino code is as follows:

#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8); 
void setup() {
  Serial.begin(19200);
  Serial.println("starting...");
  SIM900.begin(19200);
  delay(5000);   
  Serial.println("Initialising GPRS");
  SIM900.println("AT+SAPBR=3,1,\"Contype\",\"GPRS\"\r");
  delay(100);
  toSerial();
  SIM900.println("AT+SAPBR=3,1,\"APN\",\"orange.lu\"\r");
  delay(2000);
  toSerial();
  SIM900.println("AT+CGATT? \r");
  delay(100);
  toSerial();     
  SIM900.println("AT+HTTPPARA=\"CID\",1 \r"); // This is where I get the message of "ERROR" 
  delay(200);
  toSerial();
    }

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

I could be closer to troubleshooting if I understood what the last line bombing out was doing. In short, what does "AT+HTTPPARA=\"CID\",1 \r" mean?


Solution

  • It sets the bearer profile ID of the connection.

    With these commands

    AT+SAPBR=3,1,\"Contype\",\"GPRS\"\r
    AT+SAPBR=3,1,\"APN\",\"orange.lu\"\r
    

    you specify the connection type and APN for the Bearer Settings with profile ID 1 and here

    AT+HTTPPARA=\"CID\",1 \r
    

    you reference these settings for your HTTP connection.

    This is also explained for example here