Sim800l и gprs

Всем привет! Прошу помощи :worried: Почитал похожие топики, но решения которые там есть никак не работают. У меня останавливается скетч если нет подключения gprs.
Blynk.config пробовал из разных топиков. За основу сейчас взят скетч от PeteKnight (этот)

Hello! I ask for help :worried:. I read similar topics, but the solutions that are there do not work in any way. My sketch stops if there is no gprs connection.
I tried Blynk.config from different topics. The sketch from PeteKnight is now taken as a basis.(
this
)

The code that you’ve linked to wasn’t a complete sketch, just part of void setup that deals with the GPRS and Blynk connection process.

Maybe you should post you’re entire code and explain exactly what happens when no GPRS connection is available.
Explaining your hardware would also be a good idea.

Pete.

#define TINY_GSM_MODEM_SIM800                                                                      
#include <TinyGsmClient.h>                                                                        
#include <BlynkSimpleSIM800.h>                                                                    
#include <SoftwareSerial.h>                                                                                                                                                     

char auth[] = "8N6uXCtovERLsgEvIcRA1VXXXXXXXXXX";                                   
char apn[]  = "internet";                                                           
char user[] = "";                                                                   
char pass[] = "";                                                                   

SoftwareSerial SerialAT(10, 11); // RX, TX                                          
TinyGsm modem(SerialAT);                                                            

void setup()                                                                        
{  
  Serial.begin(9600);                                                               
  delay(10);                                                                        
  SerialAT.begin(9600);                                                             
  delay(3000);                                                                                 
  String modemInfo = modem.getModemInfo();
  Serial.print("Modem: ");
  Serial.println(modemInfo);

   Serial.print("Waiting for network...");
  if (!modem.waitForNetwork(240000L)) {
    Serial.println(" fail");
    delay(5000);
    return;
  }
  Serial.println(" OK");

  if (modem.isNetworkConnected()) {
    Serial.println("Network connected");
  }

  Serial.print(F("Connecting to APN: "));
  Serial.print(apn);
  if (!modem.gprsConnect(apn, user, pass)) {
    Serial.println(" fail");
    delay(5000);
    return;
  }
  Serial.println(" OK");

  Blynk.config (modem, auth, "blynk-cloud.com", 8080);
  Blynk.connect();
   
    

}                                                                                   
void loop(){                                                                         
                                                                                   
  Blynk.run(); 
  if(SerialAT.find("RING")){                                                                                                                                                                     
  delay(10);                                                                                          
  SerialAT.println("ATA");                                                        
  Serial.println("Модуль ответил на звонок");}          
  }                                                                    
22:13:40.151 -> Waiting for network... OK
22:13:40.185 -> Network connected
22:13:40.218 -> Connecting to APN: internet OK
22:13:45.269 -> [8200] 
22:13:45.269 ->     ___  __          __
22:13:45.303 ->    / _ )/ /_ _____  / /__
22:13:45.337 ->   / _  / / // / _ \/  '_/
22:13:45.371 ->  /____/_/\_, /_//_/_/\_\
22:13:45.371 ->         /___/ v0.6.1 on Arduino Mega
22:13:45.439 -> 
22:13:45.439 -> [8368] Connecting to blynk-cloud.com:8080
22:13:47.844 -> [10783] Ready (ping: 1574ms).
22:14:07.840 -> Модуль ответил на звонок

Hardware: Arduino Mega 2560, SIM800L.
With this code I connect to gprs, everything works, it connects to Blynk. If I call the module from a mobile phone, it picks up the receiver. But if gprs is not connected, then the module constantly tries to connect to gprs and does NOT pick up the phone when calling from a mobile phone.

In my future project, I will manage everything using Blynk, and if there is no gprs connection, then the module should enable what I need using a call from a mobile phone.

I believe that this explains why this is happening…

Pete.

I read this topic. It says “solved” But I didn’t see anything that could suit me. And the module is “not busy”. There are beeps when you call.

Can it be somehow possible to do that after several attempts the modem will stop connecting and start processing calls for a few minutes, and then try to connect again?

You could disconnect from Blynk on a regular basis and listen for incoming calls, but then you have the worst of both worlds.
I suppose you could have a widget to switch the Blynk connection off, then re-connect once the Incommunities g call has been handled, but also very messy.

In my opinion you need two devices - one to communicate with Blynk via GPRS and one to handle your incoming calls.

Pete.

I also had such a thought. And there is just one more module SIM800l. Thanks for the answer. Perhaps this will be the best option.

#include <TinyGsmClient.h>                                                                        
#include <BlynkSimpleSIM800.h>                                                                    
#include <SoftwareSerial.h>                                                                                                                                                     

char auth[] = "8N6uXCtovERLsgEvIcRA1VXXXXXXXXXX";                                   
char apn[]  = "internet";                                                           
char user[] = "";                                                                   
char pass[] = "";                                                                   

SoftwareSerial SerialAT(10, 11); // RX, TX 
SoftwareSerial SIM800(12, 13); // RX, TX                                         
TinyGsm modem(SerialAT);                                                            

void setup()                                                                        
{  
  Serial.begin(9600);                                                               
  delay(10);
  SIM800.begin(9600);
  delay(3000);                                                                               
  SerialAT.begin(9600);                                                             
  delay(3000);                                                                                 
  String modemInfo = modem.getModemInfo();
  Serial.print("Modem: ");
  Serial.println(modemInfo);

   Serial.print("Waiting for network...");
  if (!modem.waitForNetwork(240000L)) {
    Serial.println(" fail");
    delay(5000);
    return;
  }
  Serial.println(" OK");

  if (modem.isNetworkConnected()) {
    Serial.println("Network connected");
  }

  Serial.print(F("Connecting to APN: "));
  Serial.print(apn);
  if (!modem.gprsConnect(apn, user, pass)) {
    Serial.println(" fail");
    delay(5000);
    return;
  }
  Serial.println(" OK");

  Blynk.config (modem, auth, "blynk-cloud.com", 8080);
  Blynk.connect();
   
    

}                                                                                   
void loop(){                                                                         
                                                                                   
  Blynk.run(); 
  if(SIM800.find("RING")){                                                                                                                                                                     
  delay(10);                                                                                          
  SIM800.println("ATA");                                                        
  Serial.println("Модуль ответил на звонок");}          
  } 

I connected the second modem. First, I checked it separately, it works, it responds to commands. But I can’t figure out how to manage two modems. Please look at the sketch, what am I doing wrong?

I have no idea, as I’ve never used a modem to answer incoming calls, but I guess I would start by looking at the separate sketches that work, and see what the difference is between them and this combined sketch.

In your “non Blynk connection, answer ring only” sketch, are you declaring a modem object? I ask because you only have one declared and initialised in your sketch.

Pete.

I cannot understand what this line means when translated into my language. Please formulate a question differently.

You said that

That means you must have two sketches - one that connects to Blynk and communicates with the Blynk server using GPRS, and the second one that does not connect to Blynk but just sits and listens for incoming calls.

It’s the second sketch than I’m talking about when I say your “non Blynk connection, answer ring only” sketch.

Pete.