Arduino does not connect to the local blynk server

My server is running on RPi3, on ip 192.168.0.4
The blynk app connects to the server, I can see it on the server’s administrative page.
However, my Arduino, on the same network as the RPi3, with ip 192.168.0.20, can not connect to the server.

Displays this message:
[325065] Connecting to 192.168.0.4
[330066] Connecting to 192.168.0.4
[335067] Connecting to 192.168.0.4
[340068] Connecting to 192.168.0.4

or when I change the scketch:
[10002] Connecting to 192.168.0.4:8443
[15003] Connecting to 192.168.0.4:8443
[20004] Connecting to 192.168.0.4:8443

I’ve already changed the scketch ports to 8442, 8443, 9443. The app on my smartphone is 8443.

Can you help me?

Thanks!

How you connected Arduino ?
post your Arduino code.

#define BLYNK_PRINT Serial


#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxx";

IPAddress server_ip (192, 168, 0, 4);

// Mac address should be different for each device in your LAN
byte arduino_mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
IPAddress arduino_ip ( 192,   168,   0,  20);
IPAddress dns_ip     (  8,   8,   8,   8);
IPAddress gateway_ip ( 192,   168,   0,   1);
IPAddress subnet_mask(255, 255, 255,   0);

#define W5100_CS  10
#define SDCARD_CS 4

void setup()
{
  // Debug console
  Serial.begin(9600);

  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  Blynk.begin(auth, "192.168.0.4",8443, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
  // Or like this:
  //Blynk.begin(auth, "blynk-cloud.com", 8442, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
}

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

Change the 8443 to 8442.
Are you sure the token is correct, i.e. has it come from the Pi or the cloud (must be from the Pi)?
Everything else looks ok in the sketch.

1 Like

I’ve tested it by doing this switch, not just for 8442, but some as well.
And yes, the toke is correct and comes from the RPi.
At the moment I’m at work and as much as I access my computer at home, my RPi is off.
As soon as I can upload images!

See, it’s the same token

Have you used the W5100 for other none Blynk related projects i.e. does it work as there are lots of references on the internet about faulty hardware i.e. wrong resistors on the board etc?

Yes, I’ve used it several times. When I use the cloud (blynk-cloud.com), it works normally.

That suggests your local server is not configured correctly.

Can you ping the Arduino on 192.168.0.20 and is it showing up in your router etc?

Anything of interest in the server logs?

You must use port 8442 and the app uses a different port i.e. 8443, don’t try to set them to match.

Finally, I did. Thank you @Costas!
I was not able to ping the arduino IP, so it was not connected.
I was able to do a network share (ICS) from my wifi to lan, so the arduino connected with ip 192.168.137.39 and it ran normally!