How to send AT commands to ESP32 LilyGo-T-Call-SIM800?

601 Views Asked by At

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

0

There are 0 best solutions below