Simple GSM shield Manager for Blynk and ESP32 / ESP8266 boards

How To Install Using Arduino Library Manager

Releases v1.0.4

  1. Enhance Config Portal GUI.
  2. Reduce code size.

This library is a simple GSM shield Manager for Blynk and ESP32 / ESP8266 boards, with or without SSL, configuration data saved in SPIFFS / EEPROM. The library enables user to include both Blynk GSM/GPRS and WiFi libraries in one sketch, run both WiFi and GSM/GPRS simultaneously, or select one to use at runtime after reboot.

By design, Blynk user can run ESP32/ESP8266 boards with either WiFi or GSM/GPRS by using different sketches, and have to upload / update firmware to change. This library enables user to include both Blynk GSM/GPRS and WiFi libraries in one sketch, run both WiFi and GSM/GPRS simultaneously, or select one to use at runtime after reboot.

  • This is the new library, adding to the current Blynk_WiFiManager. It’s designed to help you eliminate hardcoding your Blynk credentials in ESP32 and ESP8266 boards using GSM shield (SIM800, SIM900, etc).

  • You can update GSM Modem and Blynk Credentials any time you need to change via Configure Portal. Data are saved in SPIFFS or configurable locations in EEPROM.

So, how it works?

If it detects no valid stored Credentials or it cannot connect to the Blynk server in 30 seconds, it will switch to Configuration Mode. You will see your built-in LED turned ON. In Configuration Mode, it starts a WiFi access point called ESP_xxxxxx. Connect to it using password MyESP_xxxxxx.

You can set:

  1. static Config Portal IP address by using Blynk_WF.setConfigPortalIP(IPAddress(xxx, xxx, xxx, xxx))
  2. random Config Portal WiFi channel by using Blynk_WF.setConfigPortalChannel(0)
  3. selected Config Portal WiFi channel by using Blynk_WF.setConfigPortalChannel(channel)

After you connected, go to, the Browser will display the following page:

Enter your credentials (APN, GPRS User, GPRS Pass, GPRS PIN, Blynk Token, Server and Port).

Then click Save. After the board auto-restarted, you will see if it’s connected to your Blynk server successfully.

Sample Code

#define BLYNK_PRINT Serial

// Select your modem:
// Increase RX buffer if needed
#define TINY_GSM_RX_BUFFER 1024

// TTGO T-Call pin definitions
#define MODEM_RST            5
#define MODEM_PWKEY          4
#define MODEM_POWER_ON       23
#define MODEM_TX             27
#define MODEM_RX             26
#define I2C_SDA              21
#define I2C_SCL              22

#define EEPROM_START   1024

//#define USE_BLYNK_WM      false
#define USE_BLYNK_WM      true

#define USE_SPIFFS        false

#define EEPROM_SIZE       2048
#define EEPROM_START      256

#include <BlynkSimpleTinyGSM_M.h>

  #include <BlynkSimpleEsp32_GSM_WFM.h>
  #include <BlynkSimpleEsp32_GSM_WF.h>

  // Your WiFi credentials.
  #define ssid  "****"
  #define pass  "****"
  #define USE_LOCAL_SERVER      true
  //#define USE_LOCAL_SERVER      false
    #define wifi_blynk_tok       "****"
    #define gsm_blynk_tok         "****"
    //#define blynk_server          ""
    // Usedirect IPAddress in case GPRS can't use DDNS fast enough and can't connect
    #define blynk_server          ""
    #define wifi_blynk_tok       "****"
    #define gsm_blynk_tok         "****"
    #define blynk_server          ""
  #define apn         "rogers-core-appl1.apn"
  #define gprsUser    ""    //"wapuser1"
  #define gprsPass    ""    //"wap"

#define BLYNK_HARDWARE_PORT       8080
#include <TinyGsmClient.h>

// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial

// Use ESP32 Serial2 for GSM, Serial1 for TTGO T-Call
#define SerialAT  Serial1

// Uncomment this if you want to see all AT commands
#define DUMP_AT_COMMANDS      false

  #include <StreamDebugger.h>
  StreamDebugger debugger(SerialAT, SerialMon);
  TinyGsm modem(debugger);
  TinyGsm modem(SerialAT);

void heartBeatPrint(void)
  static int num = 1;

  if (Blynk_WF.connected())

  if (Blynk_GSM.connected())

  if (num == 40)
    num = 1;
  else if (num++ % 10 == 0)
    Serial.print(F(" "));

void check_status()
  static unsigned long checkstatus_timeout = 0;

#define STATUS_CHECK_INTERVAL     60000L

  // Send status report every STATUS_REPORT_INTERVAL (60) seconds: we don't need to send updates frequently if there is no status change.
  if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0))
    // report status to Blynk

    checkstatus_timeout = millis() + STATUS_CHECK_INTERVAL;

bool valid_apn = false;
bool GSM_CONNECT_OK = false;

void setup()
  // Set console baud rate
  SerialMon.println(F("\nStart TTGO-TCALL-GSM"));

  // Set-up modem reset, enable, power pins

  digitalWrite(MODEM_PWKEY, LOW);
  digitalWrite(MODEM_RST, HIGH);
  digitalWrite(MODEM_POWER_ON, HIGH);

  SerialMon.println(F("Set GSM module baud rate"));

  // Set GSM module baud rate
  SerialAT.begin(115200, SERIAL_8N1, MODEM_RX, MODEM_TX);

  Serial.println(F("Use WiFi to connect Blynk"));
  // Use channel = 0 => random Config Portal WiFi channel to avoid conflict
  Blynk_WF.setConfigPortalIP(IPAddress(192, 168, 100, 1));
  Blynk_WF.begin(wifi_blynk_tok, ssid, pass, blynk_server, BLYNK_HARDWARE_PORT);

  Blynk_GSM.config(modem, gsm_blynk_tok, blynk_server, BLYNK_HARDWARE_PORT);
  GSM_CONNECT_OK = Blynk_GSM.connectNetwork(apn, gprsUser, gprsPass);


    Blynk_WF_Configuration localBlynkGSM_ESP32_config;

    Serial.print(F("gprs apn = "));
    if (String(localBlynkGSM_ESP32_config.apn) == String("nothing"))
      Serial.println(F("No valid stored apn. Have to run WiFi then enter config portal"));
      valid_apn = false;
      valid_apn = true;

      Blynk_GSM.config(modem, localBlynkGSM_ESP32_config.gsm_blynk_tok, localBlynkGSM_ESP32_config.blynk_server, BLYNK_HARDWARE_PORT);
      GSM_CONNECT_OK = Blynk_GSM.connectNetwork(localBlynkGSM_ESP32_config.apn, localBlynkGSM_ESP32_config.gprsUser, 
      if (GSM_CONNECT_OK)

void loop()
  if (valid_apn)


This is the link to Blynk

Blynk IoT Platform

Blynk was designed for the Internet of Things. It can control hardware remotely, it can display sensor data, it can store data, visualize it and do many other cool things.

You can install and use Local Blynk Server (RPi Zero W, 3B+, 4, Laptop, PC, etc) to have full control.
The Server source code is in Public Domain and written in Java. You can download, compile and use to be sure having full control.

Use Local Blynk Server

Blynk Server

Blynk Server Source Code

Releases v1.0.5

  1. Add more modem supports. Thanks to new TinyGSM library v0.10.1

Supported modems

  • SIMCom SIM800 series (SIM800A, SIM800C, SIM800L, SIM800H, SIM808, SIM868)
  • SIMCom SIM900 series (SIM900A, SIM900D, SIM908, SIM968)
  • SIMCom WCDMA/HSPA/HSPA+ Modules (SIM5360, SIM5320, SIM5300E, SIM5300EA)
  • SIMCom LTE Modules (SIM7100E, SIM7500E, SIM7500A, SIM7600C, SIM7600E)
  • SIMCom SIM7000E CAT-M1/NB-IoT Module
  • AI-Thinker A6, A6C, A7, A20
  • ESP8266 (AT commands interface, similar to GSM modems)
  • Digi XBee WiFi and Cellular (using XBee command mode)
  • Neoway M590
  • u-blox 2G, 3G, 4G, and LTE Cat1 Cellular Modems (many modules including LEON-G100, LISA-U2xx, SARA-G3xx, SARA-U2xx, TOBY-L2xx, LARA-R2xx, MPCI-L2xx)
  • u-blox LTE-M Modems (SARA-R4xx, SARA-N4xx, but NOT SARA-N2xx)
  • Sequans Monarch LTE Cat M1/NB1 (VZM20Q)
  • Quectel BG96
  • Quectel M95
  • Quectel MC60 (alpha)

Supported boards/modules

  • Arduino MKR GSM 1400
  • GPRSbee
  • Microduino GSM
  • Adafruit FONA (Mini Cellular GSM Breakout)
  • Adafruit FONA 800/808 Shield
  • Industruino GSM
  • RAK WisLTE (alpha)
  • … other modules, based on supported modems. Some boards require special configuration.

More modems may be supported later:

  • Quectel M10, UG95
  • SIMCom SIM7020
  • Telit GL865
  • ZTE MG2639
  • Hi-Link HLK-RM04