Has anyone experienced connection issues when using the new Blynk 2.0 system with an Arduino Uno and Ethernet shield. Or does anyone have a suggestion for resolving/debugging the issue below?
Details
• Hardware: Arduino UNO with Ethernet Shield 2 (W5500) I’ve also tried with an Arduino Leonardo with no luck.
• Blynk server: The new blynk.cloud system
• Blynk Library version: v1.0.0-beta.3
When running my code, I get the following output. It looks like the device is unable to connect. It just repeatedly attempts connection and never enters the loop() function.
@parrot, we’re in business. Connecting to an actual IP did the trick. Trouble is… I’m using this device in an area where I can’t access it to update the IP if the server’s IP ever changes.
Why do you think the blynk.cloud domain isn’t working?
I don’t have any Ethernet2 shields atm, so I tried Arduino MKR 1010 with MKR ETH chip.
This setup uses ordinary Ethernet library.
Just added my BLYNK_TEMPLATE_ID and auth token, and I was able to connect. Both TCP and SSL worked:
Hi @vshymanskyy, thanks for the suggestion. The Ethernet2 library is also having issues connecting to blynk.cloud.
As bit of background, apparently the Ethernet2 library is unsupported as of a few years ago, as the original Arduino Ethernet library now supports W5500 (Ethernet2 shields).
I tried running the Ethernet2 library’s example “WebClient” sketch with one change. I modified the server URL that it’s trying to connect with to “blynk.cloud”. That did not work. However, when I change the library used by the sketch to the original Ethernet lib, it does work. Below is the code I’m running. The only thing I change is the include on line 18.
/*
Web client
This sketch connects to a website (http://www.google.com)
using an Arduino Wiznet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 18 Dec 2009
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe, based on work by Adrian McEwen
*/
#include <SPI.h>
//#include <Ethernet.h> // This works
#include <Ethernet2.h> // This doesn't work
// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(64,225,16,22); // numeric IP for Google (no DNS)
char server[] = "blynk.cloud"; // name address for Google (using DNS)
// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 0, 177);
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
// start the Ethernet connection:
Serial.println("Initialize Ethernet with DHCP:");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
// try to congifure using IP address instead of DHCP:
Ethernet.begin(mac, ip);
}
// give the Ethernet shield a second to initialize:
delay(1000);
Serial.println("connecting...");
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
client.println("GET /search?q=arduino HTTP/1.1");
client.println("Host: www.google.com");
client.println("Connection: close");
client.println();
}
else {
// kf you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
while (true);
}
}
But the IP address should be different depending on what country you are, am I right? In my case, ping blynk.cloud shows the following IP address: 64.225.16.22 who in turn is DigitalOcean, Inc. which is an American cloud infrastructure located in New York City.
Are there any other Blynk server located in the USA, or just in NYC?
Thank you, Sir. Good info. Now that Blynk will not free anymore, hopefully one day I see a server in Los Angeles area or in Nebraska or Kansas, right in the center of the USA.
I have the same setup, which was working fine on the old Blynk platform. Regarding item 2 of your fix, could you just import the BlynkSimpleEthernet.h library instead of modifying the BlynkSimpleEthernet2.h library?
I am still using this modified version of BlynkSimpleEthernet2.h as mentioned here above.
I re-did my old tests, and indeed without this patch I am still unable to connect to blynk.cloud.
Can we around this patch some-how?
Test summary for my Arduino Uno w/ W5500 Ethernet2 shield:
3/ OK: #include <Ethernet.h> #include <BlynkSimpleEthernet2.h> // *** PATCH*** modified version, line 18 now includes Ethernet.h
Blynk.begin(auth, "blynk.cloud, 80);
4/ OK: #include <Ethernet2.h> #include <BlynkSimpleEthernet.h2>
Blynk.begin(auth, "fra1.blynk.cloud, 80);
// But this we do not want - to error-prone due to regional server name changes