I’m doing some tests with the SIM800L module, set as server, using Ben’s SimCom library.
The problem is that after 1 hour, the GPRS connection closes by itself and the server doesn’t respond anymore to the incoming messages.
Is there any example on how to keep the session alive? (or, at least, restart the server when the GPRS connection is down?)
Is it enough checking whether the SIM800 is connected or not with AT+CGACT? and then re-establish the connection if not?
I’m using a slightly modified version of the Blink sketch, with this piece of code at the beginning of the loop():
Hologram.debug();
if(millis() - lastCheck > 3660000 ) {
if(! Hologram.cellService() ) {
bool cellReconnected = Hologram.begin(19200, 8888); // set baud to 19200 and start server on port 8888
if(cellReconnected) {
Serial.println(F("Cellular is reconnected"));
} else {
Serial.println(F("Cellular reconnection failed"));
}
}
lastCheck = millis();
}
All the code is running on an Arduino clone: Moteino.
I’m checking the connection every 61 minutes.
I see when the modem disconnects, after exactly 1 hour, then the connection is restored (modem’s LED is blinking 3 times/s) but data sent through the Hologram dashboard doesn’t reach the modem (I can’t see any message in the serial monitor) …
The last thing to try would be resetting the SimCom module, in the loop, by pulling the RST pin LOW for about 300ms: