Sending text to a PC port with SIM800 series module (SIM808)

Hi

I am trying to send a text to a port on my pc using a SIM808 module. I can receive some text using another code and I can communicate to the port, but the text does not go to the port. The code is here:

#include <SoftwareSerial.h>

SoftwareSerial SIM900(10, 11); // configure software serial port


void setup() {     
  
  pinMode(REDLed, OUTPUT);
  pinMode(GREENLed, OUTPUT);
  pinMode(GREENLed, OUTPUT);
  SIM900.begin(19200);
  Serial.begin(19200); 
  Serial.println("power up" );
  delay(5000); 
  ShowSerialData();
  delay(100);
  SIM900.println("AT");
  delay(100);
  ShowSerialData();
    SIM900.println("AT");
  delay(100);
  ShowSerialData();
  SIM900.println("AT+cipshut");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+cgatt=1");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+cstt=\"internet\",\"\",\"\"");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+ciicr");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+cifsr");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+cipstart=\"TCP\",\"84.248.82.210\",\"747\"");
  delay(5000);
  ShowSerialData();
  SIM900.println("hello1245");
  delay(1000);
  SIM900.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
  ShowSerialData();
    

}


 
void loop()
{



}

On SocketTest 3.0.0 which is a port testing software, I see that the port is opened:

> New Client: 85.76.133.156

but I can not receive the text there. I am suspicious (not sure) that there is a problem with this code:

SIM900.println((char)26);// ASCII code of CTRL+Z

But, I can not find out what should I do to fix the problem.
Your help is appriciated. :slight_smile:

Hi

I found my problem. The problem was one line of code that I was not putting there.

The command AT+CIPSEND should be added before writing the text to be transfered:

void setup() {     
  
  pinMode(REDLed, OUTPUT);
  pinMode(GREENLed, OUTPUT);
  pinMode(GREENLed, OUTPUT);
  SIM900.begin(19200);
  Serial.begin(19200); 
  Serial.println("power up" );
  delay(5000); 
  ShowSerialData();
  delay(100);
  SIM900.println("AT");
  delay(100);
  ShowSerialData();
    SIM900.println("AT");
  delay(100);
  ShowSerialData();
  SIM900.println("AT+cipshut");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+cgatt=1");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+cstt=\"internet\",\"\",\"\"");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+ciicr");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+cifsr");
  delay(1000);
  ShowSerialData();
  SIM900.println("at+cipstart=\"TCP\",\"84.248.82.210\",\"747\"");
  delay(5000);
  ShowSerialData();

  SIM900.println("at+cipsend");
  delay(5000);
  ShowSerialData();
  
  SIM900.println("hello1245");
  delay(1000);
  SIM900.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
  ShowSerialData();

}

I think you are missing an AT+CIPSEND

Besides that, I don't see where ShowSerialData() is implemented in your code, but fundamentally, you should be reading the response from each AT command and checking for errors.
The *delay()*s in your code are crap, get rid of them and check the responses instead.

For tips on how to process serial data reliably, look here.