Fixed IP address with GPRS (SIM800)

Hi,

I have trouble with SIM800 module, SIM card, and with Blynk. I connect an Arduino UNO to the internet with a SIM800L module, with SIM card (GPRS) (no wifi available). After 1 day running the connection with the Blynk server switches off, but after a restart it works well.
I have read that it can be caused by the dynamic IP address. Firstly, it is true? The second question: how can I set a fixed IP address on SIM800 module, with GSM internet?

The code is the following:


#include "HX711.h"
#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <SoftwareSerial.h>

#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>

//#include <Adafruit_GFX.h>
//#include <Adafruit_SSD1306.h>

//To HX711 Load cell:
const int LOADCELL_DOUT_PIN = 2;
const int LOADCELL_SCK_PIN = 3;
const int battery_pin = A0;
HX711 scale;

//To BME280:
#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10
#define SEALEVELPRESSURE_HPA (1013.25)
//Adafruit_BME280 bme; // I2C
Adafruit_BME280 bme(BME_CS); // hardware SPI
//Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI

//To Blynk:
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM800
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
char auth[] = "................................................";
char apn[]  = "internet.telekom";
char user[] = "";
char pass[] = "";
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(10, 11); // RX, TX //D10(RX) to TXD, D11(TX) to RXD
TinyGsm modem(SerialAT);

BlynkTimer timer; // Announcing the timer


double temp, hum;

void setup() {
  Serial.begin(9600);
  //To HX711 Load cell:
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

  //To Blynk:
  delay(10);
  // Set GSM module baud rate
  SerialAT.begin(9600);
  delay(3000);
  // 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("1303");
  Blynk.begin(auth, modem, apn, user, pass);


  pinMode(battery_pin, INPUT);

  timer.setInterval(14400000L, sensorDataSend);
  
}

void loop() {

   
  Blynk.run(); 
  timer.run();    

  //blynk(mass_,temp,hum,batv_);
  
}

double HX711read(){
   double mass = 0;
  if (scale.is_ready()) {
    float reading = scale.read();
    mass = (reading-24034)/12077;
  } 
  else {
    mass = 0;
  }
  delay(100);
  return(mass);
}
/*
void blynk(double &mass, double &temp, double &hum, double &batv) {
  Blynk.virtualWrite(V1, mass);
  delay(10);
  Blynk.virtualWrite(V2, temp);
  delay(10);
  Blynk.virtualWrite(V3, hum);
  delay(10);
  Blynk.virtualWrite(V4, batv);
  delay(10);
}*/

void sensorDataSend()
{

  double mass = HX711read();
   /*Serial.print("HX711 reading: ");
   if(mass_==0){
    Serial.println("HX711 not found.");
   }
   else{
    Serial.println(mass_);
   }
   */
  double batv = batteryvoltage();

  Blynk.virtualWrite(V1, mass);
  delay(10);
  Blynk.virtualWrite(V4, batv);
  delay(10);
}

double batteryvoltage(){
  double batv = 0;
  batv = (((analogRead(battery_pin)/204.8)*3.23)+0.1);
  delay(10);
  return(batv);
}

If you were running your own local Blynk server and your home ISP gave you a dynamic IP address (as most do) then it could be impossible for your mobile device (phone) running Blynk, and any devices connecting from outside your local network, to connect to your local server if your home public IP changed.
As you aren’t running a local server then this isn’t the issue.

You can’t, but you don’t need to.

Your issue lies elsewhere, possibly with your GSM internet provider.

Pete.