Sim800L cannot Init error

You can try this

What’s wrong with the code you are using?

Pete.

I have managed to get the Sim800l working with the below code but now I get a login timeout when connecting to blynk.cloud:80

/************************************************************************************
 * Created By: Tauseef Ahmad
 * Created On: December 29, 2021
 * 
 * Tutorial: https://youtu.be/qrxuAezlDyA
 *
 * ****************************************************************************
 * Download Resources
 * **************************************************************************** 
 *  Download latest Blynk library here:
 *  https://github.com/blynkkk/blynk-library/releases/latest
 * **************************************************************************** 
 *  DHT-sensor-library
 *  https://github.com/adafruit/DHT-sensor-library
 * ****************************************************************************
 *  Attention! Please check out TinyGSM guide:
 *  https://tiny.cc/tinygsm-readme
 *  Change GPRS apm, user, pass, and Blynk auth token to run :)
 *  Feel free to apply it to any other example. It's simple!
 **********************************************************************************/

//-----------------------------------------------------------------------
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
//-----------------------------------------------------------------------
/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID "******"
#define BLYNK_DEVICE_NAME "*****"
#define BLYNK_AUTH_TOKEN "******"
//-----------------------------------------------------------------------
// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_BG96
//#define TINY_GSM_MODEM_XBEE
//-----------------------------------------------------------------------
// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30
//-----------------------------------------------------------------------
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
//-----------------------------------------------------------------------
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = BLYNK_AUTH_TOKEN;
//-----------------------------------------------------------------------
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[]  = "internet";
char user[] = "";
char pass[] = "";
//-----------------------------------------------------------------------
// Hardware Serial on Mega, Leonardo, Micro
//#define SerialAT Serial1
//-----------------------------------------------------------------------
// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2, 3); // RX, TX
TinyGsm modem(SerialAT);
//-----------------------------------------------------------------------
#include <DHT.h>
#define DHT11_PIN 4
#define DHTTYPE DHT11
DHT dht(DHT11_PIN, DHTTYPE);
//-----------------------------------------------------------------------
BlynkTimer timer;
#define INTERVAL 1000L
//-----------------------------------------------------------------------



/************************************************************************************
 *  This function sends Arduino's up time every second to Virtual Pin.
 *  In the app, Widget's reading frequency should be set to PUSH. This means
 *  that you define how often to send data to Blynk App.
 **********************************************************************************/
void SendDhtData()
{
  //-----------------------------------------------------------------------
  //Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  //-----------------------------------------------------------------------
  //Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  //-----------------------------------------------------------------------
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }
  //-----------------------------------------------------------------------
  //Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);
  //-----------------------------------------------------------------------
  Serial.print("Temperature: ");
  Serial.println(t);
  Serial.print("Humidity: ");
  Serial.println(h);
  Serial.println("------------------------------------------");
  //-----------------------------------------------------------------------
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V0, t);
  Blynk.virtualWrite(V1, h);
  //-----------------------------------------------------------------------
}


/************************************************************************************
 *  setup() function
 **********************************************************************************/
void setup()
{
  //-----------------------------------------------------------
  // Debug console
  Serial.begin(115200);
  delay(10);
  //-----------------------------------------------------------
  // Set GSM module baud rate
  SerialAT.begin(9600);
  //SerialAT.begin(9600,SWSERIAL_8N1,D3,D4);
  delay(3000);
  //-----------------------------------------------------------
  dht.begin();
  //-----------------------------------------------------------
  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");
  //modem.restart();
  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");
  //-----------------------------------------------------------
  Blynk.begin(auth, modem, apn, user, pass);
  //-----------------------------------------------------------
  // Setup a function to be called every second
  timer.setInterval(INTERVAL, SendDhtData);
  //-----------------------------------------------------------  
}


/************************************************************************************
 *  loop() function
 **********************************************************************************/
void loop()
{
  Blynk.run();
  timer.run();
}

Are you using Blynk Legacy, or the new Blynk IoT ?

Your original sketch was for Blynk Legacy.

What version of the Blynk library are you using?

What exactly do you see in your serial monitor (copy and paste the text and use triple backticks again).

Pete.

I am using Blynk IOT cloud

[3018] Modem init...
[3222] Connecting to network...
[3314] Network: VodaCom
[3314] Connecting to lte.vodacom.za ...
[8931] Connected to GPRS
[9003] Connecting to blynk-cloud.com:8080
[10523] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[16629] Login timeout
[16713] Connecting to blynk-cloud.com:8080
[17627] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[23732] Login timeout
[23816] Connecting to blynk-cloud.com:8080
[24726] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[29865] Connecting to blynk-cloud.com:8080
[30804] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[36909] Login timeout
[36993] Connecting to blynk-cloud.com:8080
[37911] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[44017] Login timeout
[44101] Connecting to blynk-cloud.com:8080
[45051] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[50192] Connecting to blynk-cloud.com:8080
[51130] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[57234] Login timeout
[57318] Connecting to blynk-cloud.com:8080
[58109] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[63288] Connecting to blynk-cloud.com:8080
[64074] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[70180] Login timeout
[70265] Connecting to blynk-cloud.com:8080
[71095] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[77200] Login timeout
[77284] Connecting to blynk-cloud.com:8080
[78313] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi
[83452] Connecting to blynk-cloud.com:8080
[84358] <[1D|00|01|00] OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi

I am running Blynk 1.0.1 and TinyGSM 0.11.5

Okay, you need to be clearer with your communication if you want sensible feedback.

The serial output you’ve just provided wasn’t produced with the latest code you posted. It may have been produced with your original sketch, which is designed for Blynk Legacy, but I have my doubts.

Pete.

This is the code I am using now with the login timeout error

 * Created By: Tauseef Ahmad
 * Created On: December 29, 2021
 * 
 * Tutorial: https://youtu.be/qrxuAezlDyA
 *
 * ****************************************************************************
 * Download Resources
 * **************************************************************************** 
 *  Download latest Blynk library here:
 *  https://github.com/blynkkk/blynk-library/releases/latest
 * **************************************************************************** 
 *  DHT-sensor-library
 *  https://github.com/adafruit/DHT-sensor-library
 * ****************************************************************************
 *  Attention! Please check out TinyGSM guide:
 *  https://tiny.cc/tinygsm-readme
 *  Change GPRS apm, user, pass, and Blynk auth token to run :)
 *  Feel free to apply it to any other example. It's simple!
 **********************************************************************************/

//-----------------------------------------------------------------------
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
//-----------------------------------------------------------------------
/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID "TMPLrKAvPedF"
#define BLYNK_DEVICE_NAME "Dev 2 GSM"
#define BLYNK_AUTH_TOKEN "OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi"
//-----------------------------------------------------------------------
// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_BG96
//#define TINY_GSM_MODEM_XBEE
//-----------------------------------------------------------------------
// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30
//-----------------------------------------------------------------------
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
//-----------------------------------------------------------------------
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = BLYNK_AUTH_TOKEN;
//-----------------------------------------------------------------------
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[]  = "lte.vodacom.za";
char user[] = "";
char pass[] = "";
//-----------------------------------------------------------------------
// Hardware Serial on Mega, Leonardo, Micro
//#define SerialAT Serial1
//-----------------------------------------------------------------------
// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2, 3); // RX, TX
TinyGsm modem(SerialAT);
//-----------------------------------------------------------------------
#include <DHT.h>
#define DHT11_PIN 4
#define DHTTYPE DHT11
DHT dht(DHT11_PIN, DHTTYPE);
//-----------------------------------------------------------------------
BlynkTimer timer;
#define INTERVAL 1000L
//-----------------------------------------------------------------------



/************************************************************************************
 *  This function sends Arduino's up time every second to Virtual Pin.
 *  In the app, Widget's reading frequency should be set to PUSH. This means
 *  that you define how often to send data to Blynk App.
 **********************************************************************************/
void SendDhtData()
{
  //-----------------------------------------------------------------------
  //Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  //-----------------------------------------------------------------------
  //Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  //-----------------------------------------------------------------------
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }
  //-----------------------------------------------------------------------
  //Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);
  //-----------------------------------------------------------------------
  Serial.print("Temperature: ");
  Serial.println(t);
  Serial.print("Humidity: ");
  Serial.println(h);
  Serial.println("------------------------------------------");
  //-----------------------------------------------------------------------
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V0, t);
  Blynk.virtualWrite(V1, h);
  //-----------------------------------------------------------------------
}


/************************************************************************************
 *  setup() function
 **********************************************************************************/
void setup()
{
  //-----------------------------------------------------------
  // Debug console
  Serial.begin(115200);
  delay(10);
  //-----------------------------------------------------------
  // Set GSM module baud rate
  SerialAT.begin(9600);
  //SerialAT.begin(9600,SWSERIAL_8N1,D3,D4);
  delay(3000);
  //-----------------------------------------------------------
  dht.begin();
  //-----------------------------------------------------------
  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");
  //modem.restart();
  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");
  //-----------------------------------------------------------
Blynk.begin(auth, modem, apn, user, pass, "blynk-cloud.com", 8080);
  //-----------------------------------------------------------
  // Setup a function to be called every second
  timer.setInterval(INTERVAL, SendDhtData);
  //-----------------------------------------------------------  
}


/************************************************************************************
 *  loop() function
 **********************************************************************************/
void loop()
{
  Blynk.run();
  timer.run();
}

These need to be the first lines of code in your sketch…

Pete.

I have moved it to the top but it still has a connection error


#define BLYNK_TEMPLATE_ID "TMPLrKAvPedF"
#define BLYNK_DEVICE_NAME "Dev 2 GSM"
#define BLYNK_AUTH_TOKEN "OTQ0an_SSlPvkE6r7fZU46h2IZx0mxPi"
//-----------------------------------------------------------------------
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
//-----------------------------------------------------------------------

//-----------------------------------------------------------------------
// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_BG96
//#define TINY_GSM_MODEM_XBEE
//-----------------------------------------------------------------------
// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30
//-----------------------------------------------------------------------
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
//-----------------------------------------------------------------------
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = BLYNK_AUTH_TOKEN;
//-----------------------------------------------------------------------
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[]  = "lte.vodacom.za";
char user[] = "";
char pass[] = "";
//-----------------------------------------------------------------------
// Hardware Serial on Mega, Leonardo, Micro
//#define SerialAT Serial1
//-----------------------------------------------------------------------
// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2, 3); // RX, TX
TinyGsm modem(SerialAT);
//-----------------------------------------------------------------------
#include <DHT.h>
#define DHT11_PIN 4
#define DHTTYPE DHT11
DHT dht(DHT11_PIN, DHTTYPE);
//-----------------------------------------------------------------------
BlynkTimer timer;
#define INTERVAL 1000L
//-----------------------------------------------------------------------



/************************************************************************************
 *  This function sends Arduino's up time every second to Virtual Pin.
 *  In the app, Widget's reading frequency should be set to PUSH. This means
 *  that you define how often to send data to Blynk App.
 **********************************************************************************/
void SendDhtData()
{
  //-----------------------------------------------------------------------
  //Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  //-----------------------------------------------------------------------
  //Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  //-----------------------------------------------------------------------
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }
  //-----------------------------------------------------------------------
  //Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);
  //-----------------------------------------------------------------------
  Serial.print("Temperature: ");
  Serial.println(t);
  Serial.print("Humidity: ");
  Serial.println(h);
  Serial.println("------------------------------------------");
  //-----------------------------------------------------------------------
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V0, t);
  Blynk.virtualWrite(V1, h);
  //-----------------------------------------------------------------------
}


/************************************************************************************
 *  setup() function
 **********************************************************************************/
void setup()
{
  //-----------------------------------------------------------
  // Debug console
  Serial.begin(115200);
  delay(10);
  //-----------------------------------------------------------
  // Set GSM module baud rate
  SerialAT.begin(9600);
  //SerialAT.begin(9600,SWSERIAL_8N1,D3,D4);
  delay(3000);
  //-----------------------------------------------------------
  dht.begin();
  //-----------------------------------------------------------
  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");
  //modem.restart();
  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");
  //-----------------------------------------------------------
Blynk.begin(auth, modem, apn, user, pass, "blynk-cloud.com", 8080);
  //-----------------------------------------------------------
  // Setup a function to be called every second
  timer.setInterval(INTERVAL, SendDhtData);
  //-----------------------------------------------------------  
}


/************************************************************************************
 *  loop() function
 **********************************************************************************/
void loop()
{
  Blynk.run();
  timer.run();
}

blynk-cloud.com belongs to the old blynk, now it’s blynk.cloud

I have changed it to

  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");
  //modem.restart();
  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");
  //-----------------------------------------------------------
Blynk.begin(auth, modem, apn, user, pass, "blynk.cloud", 8080);
  //-----------------------------------------------------------
  // Setup a function to be called every second
  timer.setInterval(INTERVAL, SendDhtData);
  //-----------------------------------------------------------  
}

But still get an Login timeout

You should probably be using port 80, not 8080, but I’d just go with…

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

Pete.

And if that doesn’t work then you should probably read this…

Pete.

Hi Pete

I managed to get it to connect with a global sim card, the issue was with Vodacom.
I now have a error
13:56:03.389 → [33099] >ny3.blynk.cloud[00]80
13:56:03.389 → [33099] Redirecting to ny3.blynk.cloud:80
13:56:03.482 → [33185] Connecting to ny3.blynk.cloud:80
13:56:04.700 → [34425] <[1D|00|01|00] JKKBMrNTb6SM12jWdBtilx6gEFzhASCd
13:56:05.447 → [35168] >[00|00|01|00|C8]
13:56:05.447 → [35169] Ready (ping: 641ms).
13:56:05.447 → [35170] Free RAM: 598
13:56:05.447 → [35171] >[14|00|01|00|08]
13:56:05.447 → [35173] >pm[00]3[00]out
13:56:05.541 → [35236] <[11|00|02|00|8C]ver[00]1.0.1[00]h-beat[00]60[00]buff-in[00]256[00]dev[00]Arduino Uno[00]cpu[00]ATmega328P[00]con[00]SIM800[00]fw-type[00]TMPLV2vFKdqU[00]build[00]Feb 21 2022 13:55:16[00]tmpl[00]TMPLV2vFKdqU[00]
13:56:06.581 → [36269] Cmd error

Please see my code below


#define BLYNK_TEMPLATE_ID "TMPLV2vFKdqU"
#define BLYNK_DEVICE_NAME "Dev1"
#define BLYNK_AUTH_TOKEN "JKKBMrNTb6SM12jWdBtilx6gEFzhASCd"
//-----------------------------------------------------------------------
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
//-----------------------------------------------------------------------

//-----------------------------------------------------------------------
// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_BG96
//#define TINY_GSM_MODEM_XBEE
//-----------------------------------------------------------------------
// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30
//-----------------------------------------------------------------------
#include <TinyGsmClient.h>
#include <BlynkSimpleTinyGSM.h>
#include "DFRobot_INA219.h"
//-----------------------------------------------------------------------
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = BLYNK_AUTH_TOKEN;
//-----------------------------------------------------------------------
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[]  = "Justworx";
char user[] = "";
char pass[] = "";
//-----------------------------------------------------------------------
// Hardware Serial on Mega, Leonardo, Micro
//#define SerialAT Serial1
//-----------------------------------------------------------------------
// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(2, 3); // RX, TX
TinyGsm modem(SerialAT);
//-----------------------------------------------------------------------
#include <DHT.h>
#define DHT11_PIN 7
#define DHTTYPE DHT22
DHT dht(DHT11_PIN, DHTTYPE);
DFRobot_INA219_IIC     ina219(&Wire, INA219_I2C_ADDRESS4);

//-----------------------------------------------------------------------

//-----------------------------------------------------------------------
BlynkTimer timer;
#define INTERVAL 1000L

//-----------------------------------------------------------------------
float busvoltage = 0;
float ina219Reading_mA = 1000;
float extMeterReading_mA = 1000;
//-----------------------------------------------------------------------


/************************************************************************************
 *  This function sends Arduino's up time every second to Virtual Pin.
 *  In the app, Widget's reading frequency should be set to PUSH. This means
 *  that you define how often to send data to Blynk App.
 **********************************************************************************/


void SendDhtData()
{
  //-----------------------------------------------------------------------
  //Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  //-----------------------------------------------------------------------
  //Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  //-----------------------------------------------------------------------
 float Voltage = ina219.getBusVoltage_V();
 //------------------------------------------------------------------------
 
  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t)) {
    Serial.println(F("Failed to read from DHT sensor!"));
    return;
  }
  //-----------------------------------------------------------------------
  //Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);
  //-----------------------------------------------------------------------
  Serial.print("Temperature: ");
  Serial.println(t);
  Serial.print("Humidity: ");
  Serial.println(h);
  Serial.println("------------------------------------------");
  //-----------------------------------------------------------------------
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, t);
  Blynk.virtualWrite(V6, h);
  Blynk.virtualWrite(V2,Voltage);
  //-----------------------------------------------------------------------
}


/************************************************************************************
 *  setup() function
 **********************************************************************************/
void setup()
{
  //-----------------------------------------------------------
  // Debug console
  Serial.begin(115200);
  delay(10);
  //-----------------------------------------------------------
  // Set GSM module baud rate
  SerialAT.begin(9600);
  //SerialAT.begin(9600,SWSERIAL_8N1,D3,D4);
  delay(3000);
  //-----------------------------------------------------------
  dht.begin();
  //-----------------------------------------------------------
  // Restart takes quite some time
  // To skip it, call init() instead of restart()
  Serial.println("Initializing modem...");
  //modem.restart();
  // Unlock your SIM card with a PIN
  //modem.simUnlock("1234");
  //-----------------------------------------------------------
  Serial.println();
  while (ina219.begin() != true) {
    Serial.println("INA219 begin faild");
    delay(2000);
  }
  ina219.linearCalibrate(ina219Reading_mA, extMeterReading_mA);
  Serial.println();
  
  //-----------------------------------------------------------
Blynk.begin(auth, modem, apn, user, pass);
  //-----------------------------------------------------------
  // Setup a function to be called every second
  timer.setInterval(INTERVAL, SendDhtData);
  //-----------------------------------------------------------  
}


/************************************************************************************
 *  loop() function
 **********************************************************************************/
void loop()
{
  Blynk.run();
  timer.run();
}

That seems like a very low number.

Pete.

Would that cause the Cmd Error?

I am using the same code with an ethernet shield an it is working

It seems you are commenting the lines where SIM800 is being initialized…
Use mode.init() or modem.restart(), but use one of them…

HTH

Would that affect the cmd error