0
\$\begingroup\$

I know it is somehow weird problem, but I don't know what to do.

I am using SIM800L GSM module with ESP8266 nodemsu v3 and they are connected via UART serial communication.

I am using this code to send an SMS

SIM800L GSM Module Network Connection AT Commands on Arduino
Arduino Code – Sending an SMS
Let’s move on to the interesting stuff. Let’s program our Arduino to send an SMS.

Before trying out the sketch, you’ll need to enter the phone number to which you want to send an SMS. Look for the highlighted string ZZxxxxxxxxxx and replace ZZ with the county code and xxxxxxxxxx with the 10 digit phone number.

#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(D7, D8); //SIM800L Tx & Rx is connected to Arduino #D7 & #D8

void setup()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  
  //Begin serial communication with Arduino and SIM800L
  mySerial.begin(9600);

  Serial.println("Initializing..."); 
  delay(1000);

  mySerial.println("AT"); //Once the handshake test is successful, it will back to OK
  updateSerial();

  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
 mySerial.println("AT+CMGS=\"+ZZxxxxxxxxxx\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  mySerial.print(" Hello world "); //text content
  updateSerial();
  mySerial.write(26);
}

void loop()
{
}

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

and it was working perfectly unless it suddenly stopped working and now it receives the CTRL+Z character as a message body, it keeps waiting for message body.

I tried also the same AT commands through the serial monitor and it gives the same result (keeps waiting for message body to be entered) and does not send it.

\$\endgroup\$
8
  • \$\begingroup\$ Well, there is only one call to updateSerial() where you have 500 ms time to send some data until it sends the ^Z. You may not type in fast enough. \$\endgroup\$
    – Jens
    Commented Nov 9, 2023 at 15:53
  • \$\begingroup\$ it is extremely unusual for electronics/firmware etc to change. When you find yourself thinking "it suddenly stopped working" ... find out what changed. Did you edit the code by accident? Did you change the test? Rewire something? Change a part for an "identical" part? We've all done these things, certain it could not possible make a difference ... but it did. \$\endgroup\$
    – jonathanjo
    Commented Nov 9, 2023 at 16:20
  • \$\begingroup\$ Have you tried resetting your setup? \$\endgroup\$
    – liaifat85
    Commented Nov 9, 2023 at 16:35
  • \$\begingroup\$ @liaifat85 yes i tried to make a factory reset several times by using the command ATZ, but still same issue \$\endgroup\$ Commented Nov 9, 2023 at 20:05
  • \$\begingroup\$ @jonathanjo yes exactly, thats why i am surrprised i didn't change anything, i just leaved the components connected for about 1 month and now when trying to send it doesn't work :( \$\endgroup\$ Commented Nov 9, 2023 at 20:09

0

Browse other questions tagged or ask your own question.