Gps serial can't connect to blynk

the program runs normally but when I add the command “”

SoftwareSerial gpsSerial(6, 7);

system could not connect to blynk

#define BLYNK_PRINT Serial       // Bagian ini terhubung ke server BLYNK         
#define TINY_GSM_MODEM_SIM800    //   Agar SIM800L berfungsi
#include <TinyGsmClient.h>       // library
#include <BlynkSimpleSIM800.h>
#include <SoftwareSerial.h>
//#include <SPI.h>
#include <TinyGPS++.h>
#include <RH_ASK.h>
RH_ASK driver;
const int Pin12 = 12;
const int Pin10 = 10;
const int Pin5 = 5;
const int Pin3= 3;
int x = 0;
char auth[] = "3NC7a1Gz_jfIKnoLNAp28fSE1FCOovkF";
char apn[]  = "indosatooredoo.com";
char user[] = "";
char pass[] = "";

SoftwareSerial SerialAT(4, 5); // RX, TX
WidgetMap myMap(V0);
TinyGsm modem(SerialAT);
//SoftwareSerial gpsSerial(6, 7);
BlynkTimer timer;
int d=0; 
int counter=0;
void setup()
{ pinMode(Pin5, OUTPUT);
  pinMode(Pin3, OUTPUT);
  pinMode(Pin12, OUTPUT);
  pinMode(Pin10, OUTPUT);
  digitalWrite(Pin3, HIGH);
  Serial.begin(9600);
  if (!driver.init())
  { Serial.println("init failed");}
  SerialAT.begin(9600);
  delay(10);
  SerialAT.begin(9600);
  delay(3000);  
  Blynk.begin(auth, modem, apn, user, pass);
  timer.setInterval(1000L, myTimerEvent);
}
void loop()
{  Blynk.run();
  timer.run(); 
  
}
void myTimerEvent()
{
  rf();
  checkBlynk();
  
}

void checkBlynk(){  // called every 3 seconds by SimpleTimer

  bool isconnected = Blynk.connected();
  if (isconnected == true){
   digitalWrite(Pin10, HIGH);
   delay(50);
   digitalWrite(Pin10, LOW);
   delay(500);
  }
  else if (isconnected == false){
    d++; 
    delay(1000) ;   
  }
  if(d > 2){
       Blynk.begin(auth, modem, apn, user, pass);
       Serial.println("connected");
       d=0;
     }
  }

void rf()
{
   uint8_t buf[1];
  uint8_t buflen = sizeof(buf);
  if (driver.recv(buf, &buflen))
  {
    Serial.println((char*)buf);
    if (buf[0] == '1')
    { x = 0;
      digitalWrite(Pin12, HIGH);
      digitalWrite(Pin10, LOW);
      digitalWrite(Pin5, LOW);
      
      delay(100);
    }
    else if (buf[0] == '2')
    { x = 0;
      digitalWrite(Pin3, LOW);
      delay(100);
    }
  }
  digitalWrite(Pin12, LOW );
  if (Pin12 != HIGH )
  {
    x++;
    delay(1000);
    if (x == 5)
    {
      //digitalWrite(Pin5, HIGH);
      digitalWrite(Pin10, HIGH);
     delay(1000);
     call();
      x = 0;
      }
  }
  
}
void call()
{
  Serial.println("ok");
  Blynk.notify("ALARM");
counter++;
counter=0;
  
}
20:29:04.387 -> [8509] Connecting to blynk-cloud.com:80
20:29:05.766 -> [9908] Ready (ping: 674ms).
20:29:16.578 -> [20717] Connecting to blynk-cloud.com:80
20:29:17.913 -> [22036] Ready (ping: 650ms).

What hardware are you running this on?

Pete.

arduino nano, sim 800l, gps neo 6m, rf 433 mhz

marino.

I’m not sure why the Blynk connection drops when you add the second SoftwareSerial line, but there are some issues with the rest of the code, one of which is likely to affect your Blynk connection…

Your SerialAT connection is being used for the connection to Blynk:

however, as well as being your Tx pin for the SerialAT software UART, it’s aso being uised here:

forcing the Tx pin LOW in this way is going to interfere with the communication between the Nano and the SIM800, most likely causing the connection to be lost.

BTW, you are also initialising the SerialAT port twice:

and of course, you aren’t initialising your gpsSerial port at all.

Pete.

I tried the new code but the coordinates from the GPS did not appear
I have to comment on this command in order to connect to blynk

//ne06mgps.listen();
#define BLYNK_PRINT Serial       // Bagian ini terhubung ke server BLYNK         
#define TINY_GSM_MODEM_SIM800    //   Agar SIM800L berfungsi
#include <TinyGsmClient.h>       // library
#include <BlynkSimpleSIM800.h>
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include <RH_ASK.h>
//RH_ASK driver;
const int Pin12 = 12;
const int Pin10 = 10;
const int Pin2 = 2;
const int Pin3= 3;
int x = 0;
char auth[] = "3NC7a1Gz_jfIKnoLNAp28fSE1FCOovkF";
char apn[]  = "indosatooredoo.com";
char user[] = "";
char pass[] = "";
SoftwareSerial SerialAT(4, 5); // RX, TX
WidgetMap myMap(V4);
TinyGsm modem(SerialAT);
int GPSBaud = 9600;
SoftwareSerial ne06mgps(6, 7);
TinyGPSPlus gps;
BlynkTimer timer;
int d=0; 
int counter=0;
void setup()
{ pinMode(Pin2, OUTPUT);
  pinMode(Pin3, OUTPUT);
  pinMode(Pin12, OUTPUT);
  pinMode(Pin10, OUTPUT);
  digitalWrite(Pin3, HIGH);
  Serial.begin(9600);
  ne06mgps.begin(9600);
  delay(10);
//  if (!driver.init())
  { Serial.println("init failed");}
  SerialAT.begin(9600);
  delay(10);
  Blynk.begin(auth, modem, apn, user, pass);
  timer.setInterval(1000L, myTimerEvent);
}
void loop()
{  Blynk.run();
  timer.run(); 
}
void myTimerEvent()
{
  rf();
  checkBlynk();
  location1();
}

void location1()
{ 
//if (gps.location.isValid()){
    ne06mgps.listen();
    while (ne06mgps.available() > 0)
    if (gps.encode(ne06mgps.read()))
    {
    float latitud = (gps.location.lat());    
    float longitud = (gps.location.lng()); 
    Serial.print("latitud:  ");
    Serial.println(latitud, 6); 
    Serial.print("longitud: ");
    Serial.println(longitud, 6);
    ne06mgps.end();
    SerialAT.listen();
    myMap.location(1, gps.location.lat(), gps.location.lng(), "location");
    SerialAT.end();
    }
    delay(100);
}
//}
void checkBlynk()
{  
   bool isconnected = Blynk.connected();
   if (isconnected == true){
   digitalWrite(Pin10, HIGH);
   delay(50);
   digitalWrite(Pin10, LOW);
   delay(500);
  }
  else if (isconnected == false){
    d++; 
    delay(1000) ;   
  }
  if(d > 2){
       Blynk.begin(auth, modem, apn, user, pass);
       Serial.println("connected");
       d=0;
     }
  }
void rf()
{
   uint8_t buf[1];
   uint8_t buflen = sizeof(buf);
//  if (driver.recv(buf, &buflen))
  {
    Serial.println((char*)buf);
    if (buf[0] == '1')
    { x = 0;
      digitalWrite(Pin12, HIGH);
      digitalWrite(Pin10, LOW);
      digitalWrite(Pin2, LOW);
      delay(100);
    }
    else if (buf[0] == '2')
    { x = 0;
      digitalWrite(Pin3, LOW);
      delay(100);
    }
  }
  digitalWrite(Pin12, LOW );
  if (Pin12 != HIGH )
  {
    x++;
    delay(1000);
    if (x == 5)
    {
      //digitalWrite(Pin2, HIGH);
      digitalWrite(Pin10, HIGH);
      delay(1000);
      call();
      x = 0;
      }
  }
}
void call()
{
    Serial.println("ok");
    Blynk.notify("ALARM");
    counter++;
    counter=0;
}

marino

Did you read my comment about your use of pin 5?

Pete.

sorry my fault.
I’ve tried changing d5 to d2 but when I uncomment this command
//ne06mgps.listen();
remains problematic

16:12:31.817 -> [116] Modem init...
16:12:31.965 -> [339] Connecting to network...
16:12:32.069 -> [431] Network: INDOSAT
16:12:32.103 -> [431] Connecting to indosatooredoo.com ...
16:12:37.089 -> [5457] Connected to GPRS
16:12:37.158 -> [5529] Connecting to blynk-cloud.com:80
16:12:38.396 -> [6752] Ready (ping: 550ms).
16:12:39.806 -> ⸮
16:12:50.626 -> ⸮
16:12:53.785 -> [22078] Connecting to blynk-cloud.com:80

marino

But you’re already using pin 2 for something else!

Pete.

maybe you mean pin 12

marino

Pete.

i use pin 2 for buzzer
I changed it from pin 5 to pin 2

You’ve totally lost me with this.
You have the hardware in front of you, and you should be able to see how you’ve wired everything up.
I’d suggest that you check this against what you have declared in your code and ensure that each pin is only being used for one thing, and that you have no pinMode declarations for pins that are being used for SoftwareSerial.

Pete.

i have checked pin 6,7 for gps.
pin 5,4 for sim 800.
pin 3 for relay.
and pin 2 for the buzzer

marino