BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

ESP32 SIM800L It doesn't connect to the Blank server

Hello. I am making a GPS module. I try to connect the ESP32 devKit v.1 board via GPRS with the SIM800L, but it doesn’t connect to the Blynk server. I am using Blynk 2.0.

#define BLYNK_PRINT Serial

#define BLYNK_TEMPLATE_ID "TMPL-axGiH0u"
#define BLYNK_DEVICE_NAME "Hyundai GPS Tracker"
//#define BLYNK_AUTH_TOKEN "u2gcztwsLTn7cOUEcTy_zsyPq3E1ln0W"


#define TINY_GSM_MODEM_SIM800



#define BLYNK_HEARTBEAT 45

 
#include <TinyGsmClient.h> 
#include <BlynkSimpleTinyGSM.h>
#include <TinyGPS++.h>

char auth[] = "u2gcztwsLTn7cOUEcTy_zsyPq3E1ln0W";

char apn[]  = "bam.entelpcs.cl";
char user[] = "entelpcs";
char pass[] = "entelpcs";


#define rxPin 4
#define txPin 2
HardwareSerial sim800(1);
TinyGsm modem(sim800);

#define RXD2 16
#define TXD2 17
HardwareSerial neogps(2);
TinyGPSPlus gps;

WidgetMap myMap(V0);
BlynkTimer timer;
int pointIndex = 1;

void setup() {
   
  Serial.begin(115200);
  Serial.println("esp32 serial initialize");
  delay(10);
  

  neogps.begin(9600, SERIAL_8N1, RXD2, TXD2);
  Serial.println("neogps serial initialize");
  delay(10);

 
  sim800.begin(9600, SERIAL_8N1, rxPin, txPin);
  Serial.println("SIM800L serial initialize");
  delay(3000); 
   
  
  Serial.println("Initializing modem...");
  modem.restart();

  
  Blynk.begin(auth, modem, apn, user, pass, "blynk.cloud", 8080);
  timer.setInterval(5000L, sendToBlynk);
}

void loop() {
  
  while(neogps.available())
  {
    if (gps.encode(neogps.read()))
    {
      sendToBlynk();
    }
  }

  Blynk.run();
  //timer.run();
  
} 

void sendToBlynk()
{

  if (gps.location.isValid() )
  {
  
    float latitude = (gps.location.lat());
    float longitude = (gps.location.lng());
   
    float speed = gps.speed.kmph();

    float satellites = gps.satellites.value();
        
    
    Blynk.virtualWrite(V1, String(latitude, 6));
    Blynk.virtualWrite(V2, String(longitude, 6));
    myMap.location(pointIndex, latitude, longitude, "GPS_Location");
    
    Blynk.virtualWrite(V3, speed);

  }
}

Thank you very much, regards

What happens if you try port 80 rather than 8080 ?

Also, it’s probably a good idea to specify subdomain of the actual cloud server where your project resides, such as ny3.blynk.cloud as explained here…

https://docs.blynk.io/en/blynk.cloud/troubleshooting

Pete.

You should read this as well
https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean

1 Like