ESP32 + SIMCOM7600G-H 4G Module: Blynk Disconnection Issue After GSM Call

hardware Model and Communication Type:
#Board: Lilygo with ESP32 + SIMCOM7600G-H 4G Module
#Smartphone OS:
#Tested on: Android and iOS
#Blynk Library Version: Version : 1.3.2

Issue Description:

I have an ESP32 project using a SIMCOM7600G-H 4G module to send DHT sensor data to the Blynk cloud every minute. This setup works perfectly under normal conditions. However, when I use a trigger from the Blynk app to make a call, the GSM SIM7600G-H module does not support concurrency. As a result, the call connects, but the internet gets disconnected, leading to a Blynk disconnection.

After the call ends, Blynk shows a debug message indicating it’s reconnecting, but it never successfully reconnects to the network. Here’s what I’ve tried so far:

  1. Calling blynk.connect() after disconnection: This did not work.
  2. Re-initializing or restarting the GSM module: Not sure if this is needed or how to properly implement it.
  3. Handling GSM Band Reconnection: Suspect that the SIMCOM module might switch network bands during the call, causing issues with reconnecting to the internet band that Blynk/TinyGSM library does not handle automatically.

Possible Solutions:

  • Do I need to fully reinitialize the GSM module after a call ends?
  • Is there a need to reset the network band to ensure a smooth reconnection?

Request for Help:

I would appreciate any pseudo-code or guidance on how to handle GSM module reconnection properly with Blynk after a call.

#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
#include <DHT.h>

#define TINY_GSM_MODEM_SIM7600
#define BLYNK_PRINT Serial

// Set serial for debug console
#define SerialMon Serial
#define SerialAT Serial1

// Your Blynk credentials
char auth[] = "YourAuthToken";
char apn[]  = "YourAPN";
char user[] = "";
char pass[] = "";

// DHT sensor setup
#define DHTPIN 4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

// TinyGSM and Blynk setup
TinyGsm modem(SerialAT);
BlynkTimer timer;

void setup() {
  // Debug console
  SerialMon.begin(115200);

  // Start communication with GSM module
  SerialAT.begin(9600);
  delay(3000);

  // Restart and initialize the modem
  modem.restart();
  modem.gprsConnect(apn, user, pass);

  // Initialize Blynk
  Blynk.begin(auth, modem, apn, user, pass);

  // Setup a timer to send sensor data
  timer.setInterval(60000L, sendSensorData);
}

void sendSensorData() {
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

BLYNK_WRITE(V1) {
  // Trigger a GSM call
  String number = param.asStr();
  modem.callNumber(number.c_str());
}

void loop() {
  Blynk.run();
  timer.run();
}

What Happens:

  1. Normal Operation : Sensor data sent every minute.
  2. GSM Call Triggered : Internet disconnects, call proceeds.
  3. After Call Ends : Blynk shows reconnecting message but fails to reconnect.

Needed:

Pseudo-code or steps to properly handle GSM module reconnection and Blynk re-initialization after the call ends.

Thank you in advance for your assistance!

Trying to use Blynk.connect() with Blynk.begin() isn’t the best approach.

I’d stop using Blynk.begin() and manually manage your own GPRS connection (which you seem to be doing) then use Blynk.config and Blynk.connect() - possibly with an option timeout in milliseconds parameter).

You might need a timed function to attempt reconnection, but this is normally only needed if you do a Blynk.connected() test before executing Blynk.run().

Pete.

1 Like