Hi, I'm building an SMS Alarm for the refrigerator in my biochemistry lab.
I'm using a SIM800L, the one that can be supplied directly with 5V.
I'm facing some issue with the SIM800L library I'm using.
The GSM.reset() function is not working properly, the Arduino gets stuck waiting for a response message from the GSM module.
This is the reset() code from the library:
void Sim800L::reset()
{
if (LED_FLAG) digitalWrite(LED_PIN,1);
digitalWrite(RESET_PIN,1);
delay(1000);
digitalWrite(RESET_PIN,0);
delay(1000);
// wait for the module response
this->SoftwareSerial::print(F("AT\r\n"));
while (_readSerial().indexOf("OK")==-1 )
{
this->SoftwareSerial::print(F("AT\r\n"));
}
//wait for sms ready
while (_readSerial().indexOf("SMS")==-1 );
if (LED_FLAG) digitalWrite(LED_PIN,0);
}
I did some experimenting with direct AT communication with the module. I noticed that the module it's not always responding "SMS ready" to the first "AT" message, even though it's registered to the network and it's capable to send SMS.
So I tried to remove the second to last line of the code from the library but Arduino still gets stuck waiting for a response from the module. To make it work properly I had to remove also the part of the code in which Arduino waits for the OK message.
Why I'm facing this communication problem and what can I do to fix it?