Electrical – SIM800L – No response while sending AT commands

3gat commandssoftware

I'm new to this arduino world. I'm trying to communicate with my arduino nano and SIM800L. I read few things in the internet and found a basic code. I tried copying it and tried to work it out, but I'm not getting the response as expected. I'm posting the code which I tried:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(11, 10); // RX, TX 

void setup()  
{
  // Open serial communication
  Serial.begin(9600);

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);

  delay(1000);
  Serial.println("Testing SIM800L module");
  Serial.println();
  Serial.print("Sizeof(mySerial) = "); Serial.println(sizeof(mySerial));
  Serial.println();

}

void loop() // run over and over
{

  if( mySerial.available() )
  {
    char c = mySerial.read();
    Serial.print(c);
  }

  if(Serial.available())
  {
    String Arsp = Serial.readString();

    Serial.println("Serial available");
    Serial.println(Arsp);
    mySerial.println(Arsp);
    Serial.println("Serial available end");
  }

}

I tried to send AT command and the output I received was:

Testing SIM800L module

Sizeof(mySerial) = 31

Serial available
AT

Serial available end

I don't get OK, which I should receive, it's returning empty.

I don't understand what's going wrong. Can someone help me with it?

Best Answer

Just include '\r\n' after command AT.

For example (test the code below):

sim800.print("AT\r\n"); 
at_cmd_return = sim800.readString();
Serial.println(at_cmd_return);
delay(4000);

Att,