Sim800l with esp32 message sending issue

#define RXD2 16
#define TXD2 17



void setup() {
  Serial.begin(9600);
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
  delay(3000);
  test_sim800_module();
  send_SMS();
}

void loop() {
//send_SMS();
  updateSerial();
}

void test_sim800_module() {
  Serial.println("Testing SIM800 module...");

  Serial2.println("AT");
  updateSerial();
  delay(1000);

  Serial2.println("AT+CSQ");
  updateSerial();
  delay(1000);

  Serial2.println("AT+CCID");
  updateSerial();
  delay(1000);

  Serial2.println("AT+CREG?");
  updateSerial();
  delay(1000);

  Serial2.println("ATI");
  updateSerial();
  delay(1000);

  Serial2.println("AT+CBC");
  updateSerial();
  delay(1000);

  Serial.println("Test completed.");
}

void updateSerial() {
  delay(500);
  while (Serial.available()) {
    Serial2.write(Serial.read()); // Forward what Serial received to Software Serial Port
  }
  while (Serial2.available()) {
    Serial.write(Serial2.read()); // Forward what Software Serial received to Serial Port
  }
}

void send_SMS() {
  Serial.println("Sending SMS...");

  Serial2.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  delay(1000);

    Serial2.println("AT+CSCS=\"GSM\""); // Ensure GSM character set
  updateSerial();
  delay(1000);

  //Serial2.println("AT+CSCA=\"+91XXXXXXXXXX\""); // Change with appropriate number
  Serial2.println("AT+CMGS=\"+91XXXXXXXXXX\""); // Change with appropriate number
  updateSerial();
  delay(1000);

  Serial2.print("ENGINEER"); // Text content
  updateSerial();
  delay(1000);

  Serial2.write(char(26)); // Sends Ctrl+Z to finish the SMS
  updateSerial();

  Serial.println("Message Sent");
}

When I try to send a message, it is delivered to some mobile phones but not to others. I removed the SIM card from a mobile phone that wasn't receiving messages and inserted it into a phone that was receiving messages. This time, the SIM card was able to receive the message. I believe the issue might be related to the settings on the mobile phone. Could anyone please help me solve this issue?

Write working configurations. Correct non-working configurations.

Sorry, I didn't understand what you were trying to say. Could you please explain it more clearly?

Transfer the working configuration to the non-working configuration.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.