ESP32 Dev Module - Connecting to blynk-cloud.com:80

Hello, I’m doing a simple Blynk project using ESP32 and Arduino Uno. Basically, I want to show the sensor data from the Uno to the app that I created in Blynk but it seems to have a problem in connecting to the server. I’ve included my sketch, its output, and some troubleshooting that I have done.

Sketch:


//Initialize libraries
#define BLYNK_TEMPLATE_ID "TMPLUr589UVh"
#define BLYNK_DEVICE_NAME "LPG Monitoring System"

#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

#define RXp2 16
#define TXp2 17

char auth[] = "pCd_SDnkHPL84TdXDOJC8qut3-zKU8cB";

//WiFi credentials.
char ssid[] = "IoTWIFI";
char pass[] = "iotwifi1";

BlynkTimer timer;

void sendSensor()
{
  float ppm = Serial2.parseFloat();
  Blynk.virtualWrite(V1, ppm);
}

void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  Serial2.begin(9600, SERIAL_8N1, RXp2, TXp2);
  timer.setInterval(1000L, sendSensor);
}

void loop() 
{
  Blynk.run();
  timer.run();
}

Output:

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1240
load:0x40078000,len:13012
load:0x40080400,len:3648
entry 0x400805f8
[17] Connecting to IoTWIFI
[4127] Connected to WiFi
[4127] IP: 192.168.68.108
[4127] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP32

[4134] Connecting to blynk-cloud.com:80
[9135] Connecting to blynk-cloud.com:80
[14136] Connecting to blynk-cloud.com:80
[19137] Connecting to blynk-cloud.com:80

and so on...

The troubleshoot that I have done so far are:

  • changing to Blynk.begin(auth, ssid, pass, “blynk-cloud.com”, 8080/443); or
    Blynk.begin(auth, ssid, pass, IPAddress(188,166,206,43), 8080/443);

  • I tried pinging blynk-cloud server and it looks fine

  • Added port forwarding on the router

  • Turning off firewall

  • Using mobile data

  • Resetting/rebooting router

  • Opened port 80 in Windows

Is that serialmonitor screen from the code you posted? If so then something is going wrong. With Blynk IOT and Library 1.0.1 it should connect to blynk.cloud.
if you do manual changes use blynk.cloud instead of blynk-cloud.com

Yes, the serial monitor output is from the code I posted. I don’t know why it is not connecting properly. I have done every troubleshooting method that I found in this forum and nothing worked. I tried contacting ISP but it is also no good.

I tried putting blynk.cloud and still has the same output

Same as in still want to connect to blynk-cloud.com?

May I ask you why are you using arduino and esp32 while you can do it without arduino ?

Yup, connecting to blynk-cloud.com:80

They are requiring us to use an atmega microprocessor in this project but there is no problem in that part. Serial communication is working, only the blynk part is the problem

You are using blynk iot right ?

I guess you have some conflicting old library in memory/use, but just to be sure… you have Blynk library 1.0.1 installed in Arduino IDE?

Please undo these actions.

Is the code that you’ve posted the EXACT code that you used? (You didn’t omit any additional lines of code at the beginning of your sketch?)

blynk-cloud.com is the url for the Blynk Legacy cloud servers.

These two lines (which by the way MUST be the first two lines of code in your sketch) imply that you are using Blynk IoT rather than Legacy.
Can you confirm that your auth token is from Blynk IoT?
The url for the IoT cloud servers is blynk.cloud or https://sgp1.blynk.cloud (THis forces a connection to the Singapore cloud server, rather than relying on DNS to correctly resolve to the Singapore server.

Pete.

2 Likes

I double checked all libraries, all are latest version in arduino ide

Done.

Yes, that is the exact code.

I’m using Blynk IoT for this project so that’s must be why it’s not working? Sorry, I’m fairly new on using Blynk :sweat_smile:

Which lines are you pertaining to?

Yes, the auth token is from Blynk IoT.

So should I try changing my code to Blynk.begin(auth, ssid, pass, "https://sgp1.blynk.cloud", 80) ?

Sorry, i meant to quite these two lines…

These tell the Blynk library that this is an IoT sketch, so it should try to connect to blynk.cloud rather than blynk-cloud.com but for some reason that’s not working.

I’d manually delete ALL of the Blynk libraries from your machine then re-install the 1.0.1 library.

You could, and you could try specifying port 8080 instead, as your ISP may be blocking some traffic on port 80

Pete.

1 Like

I put these lines on top for some reason it is still not working :confused:

I’ll try these and if it still doesn’t work then I’ll try to delete and install Blynk libraries again

So, I tried changing my code to this one, putting template ID, device name, and auth token on top of the code. I also reinstalled the 1.0.1 Blynk library and still has the same output :cry: It is still not connecting to the server

Code:

#define BLYNK_TEMPLATE_ID "TMPLUr589UVh"
#define BLYNK_DEVICE_NAME "LPG Monitoring System"
#define BLYNK_AUTH_TOKEN "pCd_SDnkHPL84TdXDOJC8qut3-zKU8cB";

char auth[] = BLYNK_AUTH_TOKEN;

//WiFi credentials.
char ssid[] = "IoTWIFI";
char pass[] = "iotwifi1";

#define BLYNK_PRINT Serial

//Initialize Libraries
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

//Define receive and transmit pins for UART
#define RXp2 16
#define TXp2 17

BlynkTimer timer;

void sendSensor()
{
  float ppm = Serial2.parseFloat();
  Blynk.virtualWrite(V1, ppm);
}

void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass, "https://sgp1.blynk.cloud", 8080);
  Serial2.begin(9600, SERIAL_8N1, RXp2, TXp2);
  timer.setInterval(1000L, sendSensor);
}

void loop() 
{
  Blynk.run();
  timer.run();
}

Output:

[4122] Connected to WiFi
[4122] IP: 192.168.68.108
[4122] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP32

[4129] Connecting to https://sgp1.blynk.cloud:8080
[9130] Connecting to https://sgp1.blynk.cloud:8080
[14131] Connecting to https://sgp1.blynk.cloud:8080

But did you manually delete all traces of the old Blynk library first?

I’d revert back to Blynk.begin(auth, ssid, pass); if I were you, and see what the serial monitor says.

Pete.

1 Like

I also tried changing it back to Blynk.begin(auth, ssid, pass) and the serial monitor output is

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1240
load:0x40078000,len:13012
load:0x40080400,len:3648
entry 0x400805f8
[17] Connecting to IoTWIFI
[4127] Connected to WiFi
[4127] IP: 192.168.68.108
[4127] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP32

[4134] Connecting to blynk.cloud:80
[9135] Connecting to blynk.cloud:80

Before it was blynk-cloud and now it’s blynk.cloud. I guess I’m in the right direction for now but it is still not connecting

Yes, I manually deleted before reinstalling

Try…

Blynk.begin(auth, ssid, pass, “blynk.cloud”, 8080);

Pete.

1 Like

Still does not work. I’m already thinking that the problem is my ISP. Should I try connecting on different ISP? I tried connecting it again using mobile data since I updated the library and still doesn’t work :frowning: