BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Stuck at Connecting to IP XXX.XXX.XX.XXX for Blynk Server

Hi,
• Hardware model + communication type. NodeMCU with CD74HC0467
• Smartphone OS (Android) 9.0
• Blynk server or local server (0.41)
• Blynk Library version (0.6.1)
It is stuck at connecting to server
I have installed the java server
Blynk administration page is opening and I am also able to log in through the App using Custom Server.

Please tell what I have done wrong.

#define S0 D0
#define S1 D1
#define S2 D2
#define S3 D3

#define analogpin A0

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "MIudt3uHbsE5_jgb6JeSDw4bJsBlKeJv";

char ssid[] = "CA Parul Gupta";
char pass[] = "9a346f62b700";



int s1value = 0; //SENSOR 1A
int s2value = 0; //SENSOR 1B
int s3value = 0; //SENSOR 1C
int s4value = 0; //SENSOR1D
int s5value = 0; //SENSOR2A
int s6value = 0; //SENSOR2B
int s7value = 0; //SENSOR2C
int s8value = 0; //SENSOR2D
int s9value = 0; //SENSOR3A
int s10value = 0; //SENSOR3B
int s11value = 0; //SENSOR3C
int s12value = 0; //SENSOR3D
int s13value = 0; //SENSOR4A
int s14value = 0; //SENSOR4B
int s15value = 0; //SENSOR4C
int s16value = 0; //SENSOR4D

BlynkTimer timer;

void setup() {

  pinMode(analogpin, INPUT);
  pinMode(S0, OUTPUT);
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass, IPAddress(192,168,43,168), 9443);
  // Setup a function to be called every second
  timer.setInterval(1000L, myTimerEvent);
  // put your setup code here, to run once:
}

void myTimerEvent() {

  digitalWrite(S0, LOW);
  digitalWrite(S1, LOW);
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 1: ");
  s1value = analogRead(analogpin);
  Serial.print(s1value);
  Serial.print("\n");
  Blynk.virtualWrite(V1, s1value);

  digitalWrite(S0, HIGH);
  digitalWrite(S1, LOW);
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 2 ");
  s2value = analogRead(analogpin);
  Serial.print(s2value);
  Serial.print("\n");
  Blynk.virtualWrite(V2, s2value);

  digitalWrite(S0, LOW);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 3 ");
  s3value = analogRead(analogpin);
  Serial.print(s3value);
  Serial.print("\n");
  Blynk.virtualWrite(V3, s3value);
  
  digitalWrite(S0, HIGH);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 4 ");
  s4value = analogRead(analogpin);
  Serial.print(s4value);
  Serial.print("\n");
  Blynk.virtualWrite(V4, s4value);
  
  digitalWrite(S0, LOW);
  digitalWrite(S1, LOW);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 5 ");
  s5value = analogRead(analogpin);
  Serial.print(s5value);
  Serial.print("\n");
  Blynk.virtualWrite(V5, s5value);
  
  digitalWrite(S0, HIGH);
  digitalWrite(S1, LOW);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 6 ");
  s6value = analogRead(analogpin);
  Serial.print(s6value);
  Serial.print("\n");
  Blynk.virtualWrite(V6, s6value);
  
  digitalWrite(S0, LOW);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 7 ");
  s7value = analogRead(analogpin);
  Serial.print(s7value);
  Serial.print("\n");
  Blynk.virtualWrite(V7, s7value);
  
  digitalWrite(S0, HIGH);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 8 ");
  s8value = analogRead(analogpin);
  Serial.print(s8value);
  Serial.print("\n");
  Blynk.virtualWrite(V8, s8value);
  
  digitalWrite(S0, LOW);
  digitalWrite(S1, LOW);
  digitalWrite(S2, LOW);
  digitalWrite(S3, HIGH);
  Serial.print("Sensor 9 ");
  s9value = analogRead(analogpin);
  Serial.print(s9value);
  Serial.print("\n");
  Blynk.virtualWrite(V9, s9value);
  
  digitalWrite(S0, HIGH);
  digitalWrite(S1, LOW);
  digitalWrite(S2, LOW);
  digitalWrite(S3, HIGH);
  Serial.print("Sensor 10 ");
  s10value = analogRead(analogpin);
  Serial.print(s10value);
  Serial.print("\n");
  Blynk.virtualWrite(V10, s10value);
  
  digitalWrite(S0, LOW);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, LOW);
  digitalWrite(S3, HIGH);
  Serial.print("Sensor 11 ");
  s11value = analogRead(analogpin);
  Serial.print(s11value);
  Serial.print("\n");
  Blynk.virtualWrite(V11, s11value);
  
  digitalWrite(S0, HIGH);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, LOW);
  digitalWrite(S3, HIGH);
  Serial.print("Sensor 12 ");
  s12value = analogRead(analogpin);
  Serial.print(s12value);
  Serial.print("\n");
  Blynk.virtualWrite(V12, s12value);
  
  digitalWrite(S0, LOW);
  digitalWrite(S1, LOW);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, HIGH);
  Serial.print("Sensor 13 ");
  s13value = analogRead(analogpin);
  Serial.print(s13value);
  Serial.print("\n");
  Blynk.virtualWrite(V13, s13value);
  
  digitalWrite(S0, HIGH);
  digitalWrite(S1, LOW);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, HIGH);
  Serial.print("Sensor 14 ");
  s14value = analogRead(analogpin);
  Serial.print(s14value);
  Serial.print("\n");
  Blynk.virtualWrite(V14, s14value);
  
  digitalWrite(S0, LOW);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, HIGH);
  Serial.print("Sensor 15 ");
  s15value = analogRead(analogpin);
  Serial.print(s15value);
  Serial.print("\n");
  Blynk.virtualWrite(V15, s15value);
  
  digitalWrite(S0, HIGH);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, HIGH);
  Serial.print("Sensor 16 ");
  s16value = analogRead(analogpin);
  Serial.print(s16value);
  Serial.print("\n");
  Blynk.virtualWrite(V16, s16value);
  
  delay(5000);
  // put your main code here, to run repeatedly:

}

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

Serial monitor output

19:08:20.793 -> ⸮H⸮l⸮h⸮⸮⸮H<p⸮E⸮[60] Connecting to CA Parul Gupta
19:08:23.898 -> [3064] Connected to WiFi
19:08:23.898 -> [3064] IP: 192.168.43.209
19:08:23.932 -> [3065] 
19:08:23.932 ->     ___  __          __
19:08:23.967 ->    / _ )/ /_ _____  / /__
19:08:24.001 ->   / _  / / // / _ \/  '_/
19:08:24.035 ->  /____/_/\_, /_//_/_/\_\
19:08:24.069 ->         /___/ v0.6.1 on NodeMCU
19:08:24.103 -> 
19:08:24.103 -> [3142] Connecting to 192.168.43.168
19:08:29.050 -> [8196] Connecting to 192.168.43.168
19:08:34.060 -> [13205] Connecting to 192.168.43.168

You have a function which is being called with a timer once every second, but that function contains code which may well take most of that time to execute then at the end of the function you have a 5 second delay which blocks all further code execution.
Do you think that makes sense?

In addition, your timed function contains 16 Blynk.virtualWrites.
If you send more than 10 virtual writes per second you risk flooding the server - although BlynkTimer may well step in and discard some of those virtualWrites to prevent this happening.

My advice would be to get rid of the delay, comment-out half of your digital reads/virtual writes, and change the timer frequency to something more sensible.
Once you have that working correctly then create a second timed event which handles the other digital reads/virtual writes and attach it to a timer that doesn’t overlap your first one.

Pete.

1 Like

No, it does not

Code changed but issue still persists:

#define S0 D0
#define S1 D1
#define S2 D2
#define S3 D3

#define analogpin A0

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "tDUJKWT72VJclvEwIk0nTNXX0k_x0sW6";

char ssid[] = "CA Parul Gupta";
char pass[] = "9a346f62b700";

int s1value=0;
int s2value=0;
int s3value=0;
int s4value=0;
int s5value=0;
int s6value=0;
int s7value=0;
int s8value=0;
int s9value=0;
int s10value=0;
int s11value=0;
int s12value=0;
int s13value=0;
int s14value=0;
int s15value=0;
int s16value=0;


BlynkTimer timer;

void setup() {

  pinMode(analogpin, INPUT);
  pinMode(S0, OUTPUT);
  pinMode(S1, OUTPUT);
  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
   timer.setInterval(2000L, myTimerEvent);
  
}

void myTimerEvent() {

  digitalWrite(S0, LOW);
  digitalWrite(S1, LOW);
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 1: ");
  s1value = analogRead(analogpin);
  Serial.print(s1value);
  Serial.print("\n");
  Blynk.virtualWrite(V1, s1value);

  digitalWrite(S0, HIGH);
  digitalWrite(S1, LOW);
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 2 ");
  s2value = analogRead(analogpin);
  Serial.print(s2value);
  Serial.print("\n");
  Blynk.virtualWrite(V2, s2value);
  
  digitalWrite(S0, LOW);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 3 ");
  s3value = analogRead(analogpin);
  Serial.print(s3value);
  Serial.print("\n");
  Blynk.virtualWrite(V3, s3value);
  
  digitalWrite(S0, HIGH);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, LOW);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 4 ");
  s4value = analogRead(analogpin);
  Serial.print(s4value);
  Serial.print("\n");
  Blynk.virtualWrite(V4, s4value);

  digitalWrite(S0, LOW);
  digitalWrite(S1, LOW);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 5 ");
  s5value = analogRead(analogpin);
  Serial.print(s5value);
  Serial.print("\n");
  Blynk.virtualWrite(V5, s5value);

  digitalWrite(S0, HIGH);
  digitalWrite(S1, LOW);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 6 ");
  s6value = analogRead(analogpin);
  Serial.print(s6value);
  Serial.print("\n");
  Blynk.virtualWrite(V6, s6value);

  digitalWrite(S0, LOW);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 7 ");
  s7value = analogRead(analogpin);
  Serial.print(s7value);
  Serial.print("\n");
  Blynk.virtualWrite(V7, s7value);

  digitalWrite(S0, HIGH);
  digitalWrite(S1, HIGH);
  digitalWrite(S2, HIGH);
  digitalWrite(S3, LOW);
  Serial.print("Sensor 8 ");
  s8value = analogRead(analogpin);
  Serial.print(s8value);
  Serial.print("\n");
  Blynk.virtualWrite(V8, s8value);

}

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

So does a very basic sketch work with your local server?

Pete.

No, it does not.
In command prompt, it showed that Blynk server successfully started. I am able to go to Administration page and create an account on Blynk app for the server.
But when I open the app after logging into, it shows error, Sorry, server can’t talk right now. Try later.

Do you have the matching port open on your router?

1 Like

Yes, I have set the port.

Sorry for late reply, but the issue is still persisting.