0

I've been working with a LilyGo-TCall-SIM800 module for several days, trying to get out of a dead end.

I have tried an example from "random nerd tutorials" which works correctly. The module connects to the internet and can send data to the cloud.

I have the problem to send AT commands to the SIM800L chip integrated in the module. I can't get the chip to react back.

I have tried using Serial1 and Serial2. I have also tried configuring the RX and TX transmission pins, and I have tried with different baudrates. Always with negative results... when sending the "AT\r" command to the SIM800L, it should return "OK". But it never does.

I have simplified the code as much as possible to minimize errors:

/*
 Name:      TestAT.ino
 Created:   08/12/2022 23:15:28
 Author:    user
*/

// Set serial for debug console (to the Serial Monitor, speed 115200)
#define SerialMon Serial

// Comunications between ESP32 and SIM800L
#define SerialAT Serial1

//Comunications between ESP32 ans SIM800L go thought TX and RX pins on Serial1 Port 
#define MODEM_RX1 16
#define MODEM_TX1 17

void setup() {
    // Set console baud rate
    SerialMon.begin(115200);
    delay(1000);

    //Set SerialAT baud rate
    SerialAT.begin(38400, SERIAL_8N1, MODEM_RX1, MODEM_TX1);

    //Set timeLimit for SerialAT reads
    SerialAT.setTimeout(2000);

}

void loop() {
     String  returned = "";
     char ATcommand[] = { 'A','T','\r' };

    SerialAT.print(ATcommand);
    delay(1000);
    returned = SerialAT.readString();

    SerialMon.print(millis());
    SerialMon.print(" - ");
    SerialMon.print(ATcommand);
    SerialMon.print(" - SerialAT returned:");
    SerialMon.println(returned);

}

Anybody can help me out on this? Any idea or sugestion?

Thanks in advance

  • 1
    Have you tried the examples provided by the manufacturer? – romkey Dec 20 '22 at 22:11
  • `Serial.println("AT");`. println add `\r\n` automatically. – hcheung Dec 21 '22 at 05:54
  • @romkey [Arduino_AT_Debug](https://github.com/Xinyuan-LilyGO/LilyGo-T-Call-SIM800/tree/master/examples/Arduino_AT_Debug) works fine. Thanks. I make a mistake selecting serial pins. For my board model Modem_TX is 26 and Modem_RX is 27 – ORParga ORParga Dec 28 '22 at 08:10
  • You should [never use delay as a substitute for **reading** and **parsing** responses from a modem](https://stackoverflow.com/a/46064206/23118). – hlovdal Jan 04 '23 at 20:51

0 Answers0