[SOLVED] Arduino WiFi Shield can't connect to any server

Now it’s WORKS!!! Thank you so mutch Murilopicanco!!
But now have often disconnection problem

[0] Connecting to wlElstudija…
[21293] My IP: 192.168.10.54
[21294] Blynk v0.3.1
[21295] Connecting to 45.55.195.102:8442
[25056] Ready (ping: 1013ms).
[44918] Connecting to 45.55.195.102:8442
[54919] Connecting to 45.55.195.102:8442
[64922] Connecting to 45.55.195.102:8442
[77100] Login timeout
[77101] Connecting to 45.55.195.102:8442
[88950] Connecting to 45.55.195.102:8442
[98953] Connecting to 45.55.195.102:8442
[100948] Ready (ping: 1848ms).
[110601] Connecting to 45.55.195.102:8442
[120603] Connecting to 45.55.195.102:8442
[130605] Connecting to 45.55.195.102:8442
[140607] Connecting to 45.55.195.102:8442
[150609] Connecting to 45.55.195.102:8442
[160610] Connecting to 45.55.195.102:8442
[164675] Ready (ping: 1048ms).
[248502] Connecting to 45.55.195.102:8442
[258504] Connecting to 45.55.195.102:8442
[260551] Ready (ping: 1898ms).
[435694] Connecting to 45.55.195.102:8442
[445696] Connecting to 45.55.195.102:8442
[455699] Connecting to 45.55.195.102:8442
[465701] Connecting to 45.55.195.102:8442
[475703] Connecting to 45.55.195.102:8442
[485704] Connecting to 45.55.195.102:8442
[495706] Connecting to 45.55.195.102:8442

at several reconnection stops and can’t connect anymore.
It’s connects sometimes only for about 5 seconds, sometimes it works about 1 min. But after several connect and disconnect it can’t connect anymore until I restart it and then starts again. Connected, lost connection, connected, lost connection… and red ERROR led ar lith.

Please show your code.

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <WiFi.h>
#include <BlynkSimpleWifi.h>

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

// Your WiFi credentials
char ssid[] = "my NetworkName is there";
char pass[] = "my Password is there";        // Set to "" for open networks
IPAddress server_ip (45,55,195,102);


void setup()
{
  Serial.begin(9600);
  //Blynk.begin(auth, ssid, pass);
  // Or specify server using one of those commands:
  //Blynk.begin(auth, ssid, pass, "server.org", 8442);
  Blynk.begin(auth, ssid, pass, server_ip, 8442);
}

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

Does your WIFI shield work well without Blynk?

Hello Janis,

Have you tried using it in another network to make sure yours is stable enough?
It is hard to say from here why you are getting disconnected but it could be your network. Try testing it elsewhere.

Murilo

Hi, murilopicanco,
I have try it on another network, but I have the same problem with disconection. I have tryied in this network C3000 WiFi Shield and it is working well, also I have tryied Arduino Ethernet Shield (with wire) and it is too working well.
@Dmitriy Arduino WiFi Shield works fine without Blynk.

Hi @Janis

I’m afraid I’ve run out of options on what to try.
I can just tell you the exact versions of what I am running here where everything is working fine, so that you can compare:

On my home router I had to open ports 8441 to 8443 for the specific IP address of my shield to get it to connect.
The Sketch I’m using is the example one that comes with the Blynk library but with that small modification I sent to you earlier, since the standard sketch does not work properly with the WiFi due to the “Connecting to … **?**loud.blynk.cc” where a weird question mark appears out of nowhere on the serial monitor instead of the “c” for “cloud”.

Hope you manage to find the problem.
Cheers

This kind of weird stuff usually happend when there is a lot of radio interference in the air. However, since it works fine by itself it is a bit unlikely, but still possible. What kind of area do you live? Does it have lots of other wifi networks? Especially 2.4Ghz is nasty. You could check with tools like inssider.

It could be a difference in handleing connections from one library to another that causes this, but then again, the hardware probably is ok. Wifi is really hard to diagnose ( I manage about 700 accesspoints and well over 1500 wifi clients per day on average at work … ).

I have test it in non populated place, so there is just one my WiFi router. Also I have WiFi C3000 and it’s works fine. It have ping about 150ms
but if I connect with Arduino WiFi shield it show ping more than 950ms and if I start slide a slider on blynk app then it was disconnects very fast!

Dear @Janis

This may not be your particular issue with connections dropping frequently, but since this topic is discussing connectivity issues, I thought I should add something I came across this week that does affect the stability of some (if not most) boards. USB cables!

I started playing around with the Arduino Yun about 2 weeks ago. With a high quality USB cable it is steady as a rock with Blynk. :smile: One day I needed to use the cable for something else as it was the correct length, so I replaced it temporarily with a shorter (and cheaper looking) cable. With this setup I started losing my connection every couple of minutes. Swapped the cables back and the problem was gone.

With that in mind a did some tests with my Arduino Uno and the original WiFi shield, trying a few cables I had lying around. The same happens. Some cables could transport the correct amount of current for the boards and some could not.

So for each board that you use (Uno, Mega, Yun, etc.) and each model of shield you select to connect to them without an additional cable (i.e. the shield is stacked on top of the board being powered by the same USB cable), the system will draw a total amount of current to keep both the board and shield running properly.

If a particular cable offers too much electrical resistance, the system may be unstable/erratic and in the case of a board + WiFi shield configuration, the first thing that would fail would be your connection as the chip requires a reasonable amount of current to operate properly.

If the cable is good, the last thing to check is if the power supply being used (of the correct output voltage) is actually capable of supplying the required current for the board and the shield(s) considering the losses caused by the cable.

3 Likes

Thank you murilopicanco !! You was right, I was tested with good one now, and it is helps! Now connection is stable! I found the same problem with diferent PC’s. Some of PC can give as mutch power as others on USB.

2 Likes

:clap: I’m glad it is working @Janis.

As per my experience you must check the library of your code and the address which you are using for your router.
What are the specifications of your router that you are using with the Arduino?
Also which interface you are using between both of your devices?
Does router contain any firmware and is it compatible with the Arduino code?

assembling pcb

Hi,

I had the same problem as Janis, except my serial monitor wrote Connecting to ÿloud.blynk.cc:8442. I’m using the arduino wifi shield on an arduino mega.

The problem has been fixed by following murilopicanco’s steps.

Thanks a lot!

3 Likes

SAME STORY HERE! Fixed using IP address instead of domain name, but when Blynk came out everything was fine, I guess something got messed up by last updates. No need to open ports on router.

Hi Murilo,

I have come back to this after a few weeks working on other stuff.
Just wanted to ask you something else if thats ok?

I have this ethernet shield (without POE) below sitting on top of the Arduino Uno.

https://store.arduino.cc/product/A000072

It is just to get Blynk talking to the board so have a basic flashing LED Arduino sketch set up. I have set up the Blynk button etc…when I upload the arduino sketch with the blynk authorisation code in it is ok, no errors.
but when I press play in the Blynk app, I get an error saying ‘Arduino UNO is offline’.
I think it is just some basic cable or port error?

- Is my Arduino UNO below the shield meant to be connected to the usual power supply cable OR is it meant to be connected to my imac via USB?

- Is my shield (sitting on top of the UNO) at the same time meant to be also connected to the imac via CAT 5 cable (with RJ45 connector going from shield to imac?)

- my port setting on the uno says ‘/dev/cu.usbmodem641 (Arduino Uno)’ does this sound correct?

Would you say it is a port issue or cable issue that is stopping Blynk talking to the board?

any help appreciated.

Hello @stackr

You only need to power up the Uno board.
The Ethernet shield will obtain power from the Uno.

To power up the Uno you can use anything within its voltage & current working range. A USB cable connected to your Mac or an external power source (for instance 5V, 1000mA) will both work.

Your port setting sounds correct.

I have not seen your code so no idea why you can’t connect to Blynk. It could be a bad cable, it could be the type of cable (twisted pair vs direct), or configurations in your local router, etc. but the standard example that comes with the Blynk library should work perfectly fine if everything is correct.

Try using any of the internet examples that comes with the Arduino software and forget Blynk for now. If they work, there is no reason why Blynk should not work other than port settings as far as I see it.

hI Murilo,

ok forgetting about using blynk for time being until I make sure the shield is getting online.
I have a power supply now running into the UNO board only.

The initial Arduino sketch with LED as pin 7 was working on the UNO board locally.

after setting up as pin 7 as Blynk I am running the default ethernet sketch as suggested below but get his error in the serial monitor window.

[0] Blynk v0.3.1
[1] Gewtting IP…
[60460] DHCP failed!

am I meant to put in other info in the sketch below or missing something really basic?


/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno it is attached to digital pin 13.

*/

char auth[] = “MY TOKEN GOES HERE”; // Put your Auth Token here.

void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud.
}

void loop()
{
Blynk.run(); // All the Blynk Magic happens here…

// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
}


Please edit your post. Code should be formatted.
Wrap the code by pressing this magic button (Backtick`) 3 times (before the code and after it):**

This makes your code beautiful with highlighted syntax, like this:

//comment goes here 
void helloWorld() { 
   String message =  "hello" + "world"; 
}

You can also select the code and press </> button in the top menu:

Can you get the ethernet shield working without Blynk? Does it run any example sketches that come with the library?