Sim800 (GPRS) + NodeMCU (Wifi) how to alternate between these two connections when one fails

Hello, I have a board that integrates a nodeMCU and a SIM800. I need to detect when the WiFi connection has been lost, in order to connect to Blynk via GPRS (Sim800), and once the WiFi connection is recovered, close the connection by GPRS (Sim800) and reconnect to the WiFi network. Any suggestions, please I would appreciate if you can help me.

It is not supported out of the box, but you can write a custom Transport that will perform switching.
You will need to modify our opensource library:

  • Implement the connectivity transport adapter. See example in src/Adapters/BlynkSerial.h
  • Implement main include header, like src/BlynkSimpleStream.h

I thought you could use WiFi.status() != WL_CONNECTED once Blynk.begin or had executed?

I’m assuming that the standard NodeMCU sketch would be used, with code to switch to the GPRS connection if that didn’t connect after x attempts.


Thank you very much, I was looking at the code, but I do not understand how it works. Could you explain how it works?
src/Adapters/BlynkSerial.h and src/BlynkSimpleStream.h .

i will add question in this topic:

i try example for wifi and other for GPRS ( i have gsm module sim800l)

is possible to add support for both way in one project?
Wifi is primary, gprs is backup connction.


Short answer… possibly. Longer, already provided answer… depends on your coding abilities…