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():

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:

pinMode(sim_rst, OUTPUT);
digitalWrite(sim_rst, LOW);
digitalWrite(sim_rst, HIGH);

Any other solution for keeping the connection persistent?


Following the code inside the Hologram-SIMCOM library, I noticed that the SIM module is already reset within the Hologram.begin(…) method.

I also missed this line: #define RESET_PIN 10 //SIM800 reset connected to pin D10 :man_facepalming:


Reset was already connected to pin 10. I’m trying now by powering Arduino with a separate battery.


I think I solved the reconnection problem. In case it can be useful to somebody else, these are the changes:

  1. I check the connection status, every 5 seconds, with this code:

    void loop() {
       if(millis() - lastCheck > 5000 ) {
           bool cellOn = Hologram.checkConn();
           if(!cellOn) {
               bool cellReconnected = Hologram.begin(19200, 4010); // set baud to 19200 and start server on port 4010
         lastCheck = millis();
  2. I added a new method to the library, checking if we’ve got an IP:

    bool HologramSIMCOM::checkConn() {
       bool connection; 
       int ip = _writeCommand("AT+CIFSR\r\n", 1, ".", "ERROR");
       if(ip == 2) {
         connection = true;
       } else {
         connection = false;
     return connection;
  3. I use this circuit to reset the modem (changed in the sketch PIN 10 to PIN 2):