Long-running project suddenly can’t connect

My project has been running virtually non-stop for about a year, but it suddenly went offline yesterday and hangs up on “Connecting to blynk-cloud.com“. I’ve made no hardware or software changes in months. I just reset the router, but that didn’t solve it. I don’t even know where to begin to troubleshoot. Suggestions? Thanks!

first, please provide some usable information, like in part II. and III.:

Sure, thanks. Most of the details in the post you linked to are not relevant here, so I’ll just mention a few that might be:

I’m using blynk’s server, not a local server.
MCU is Mega 2560.
Blynk library version is v0.3.4

The project has been running autonomously in one form or another for a few years without trouble, so this connect issue is new to me, and I’m not sure how to troubleshoot it.

Did any significant software changes take place on the blynk server side this week that might have made my project incompatible, or is it more likely a sudden hardware, networking, or other malfunction at my end? My code hasn’t been modified for months.

I’d say this is a safe bet seeing as how the latest stable library is v0.4.10

if you still have the source code, please update everything to latest (arduino ide, blynk lib, app, etc) and try again.

there were some major changes in blynk library in the last years, i’m not sure when, like introducing blocking blynk routine, solved some geo dns issues, etc. you should try to search for those keywords and check for details.

please report back here how it is going.

I updated the blynk libraries and IDE. Now I can connect to blynk, but the rest of my project doesn’t work. In particular, it can’t connect to an http site. It also has a temperature / humidity sensor that is now reading zero, so that’s not working either. No idea at all how to troubleshoot this.

do you mean, the widgets for this sensors in the app show zero all the time, or, it reads zero even when reading in serial monitor?

do you mind sharing the code with us?

It reads zero in the serial monitor. The code dies before ever writing anything to blynk. I haven’t had time to refresh my memory about the code as to why it does that. Probably I’m restarting when it figures out that it can’t access an http site.

I’d be happy to share the code, but I’m not sure you’d want to look at it, as it’s pretty long. It operates an aquarium/terrarium to maintain climate in the tank to recreate current weather and sunrise/sunset times in Florida in real time by fetching weather from an API.

Let me know if you’d still like me to post it.

My project suddenly last week lost connection to blynk after a year of working smoothly. I’ve made no code or hardware changes redently. I was running on v0.3.4 library, so I just updated to the latest. Now I can connect to blynk, but I can’t connect to an http site. I have no idea how to troubleshoot this, because my code to fetch from an http server has worked fine. Here’s the code that can no longer make a connection. Is there something about the new blynk library that has created a new incompatibility somewhere? How can I track this down? MCU is a Mega 2560. Here’s the code that can’t connect…

if (client.connect(server, 80)) {

    // send the HTTP GET request:
    client.println(F("GET / HTTP/1.1"));   
    client.println(F("Host: 10.0.1.36:80")); // ip address of http server
    client.println();     
    client.println();
    client.println(F("Connection: close"));
    client.println();
    
     // parse JSON data fetched from api
    parseWeather();     

    // note the time that the connection was made:
    lastConnectionTime = millis();
 
  } 
  else {
    // if connection fails:
    ShowSockStatus();
    client.stop();
    ShowSockStatus();
  }

Please don’t post duplicate topics… I have merged your last post back into this existing topic on the same issue.

Since it looks like the site you are trying to connect to uses an internal IP address… then this sounds like an issue with something in your own local network.

Sorry, thanks, I got the feeling I was in the wrong category and needed to simplify the question, and didn’t know how to move it / correct it.
Thanks for the advice about my issue.

Updating the blynk library restored my ability to connect to blynk’s server, so I presume that something changed at the blynk server side that made my setup incompatible. Also, if I start up a local blynk server on the same local machine that I am having trouble connecting to, that works fine. So I can connect locally too, but not by http.

I’m not sure how to troubleshoot from here. Sorry again for the screw-up with the post. Thanks for your help.

Quite possibly… Blynk is constantly being developed, and thus tends to require the somewhat regular updating of your App, Library (and reflashing and MCU with said library) and, if implemented, Local Server… I am surprised you haven’t ran into issues sooner :slight_smile:

As for whatever your project does and is trying to connect to… we would need more information to even determine if it is still a Blynk related issue, or just something in your network.

I’ve done various tests, and I’ve pretty well ruled out a local network issue.
My theory is that a server side change caused me to be unable to connect to blynk, and then updating the blynk libraries caused me to be unable to connect to http servers (perhaps an incompatibility between new blynk library and shield?).
Ethernet shield is a W5100 on a Mega 2560.
This is a big problem, because this code automates an aquarium/terrarium, and I’m going out of town soon!
The code is extensive, so I’m posting a highly abbreviated version that only has chunks that are related to networking. The key connections are blynk and a local http server (in the function getWeather).
At present, the code successfully connects to blynk, but fails to connect to the http server in getWeather.

EDIT: It’s not actually connecting properly to blynk’s server after all. It tries repeatedly, occasionally connects momentarily, then loses the connection. So I set up a local blynk server, and the project connects to that fine. But it still cannot connect to either an http server on the same machine, or to a remote http server.

Do I need to change the include statements? Frankly, I’m confused about the role of each one, and I see there are multiple version numbers in the library folders.

Abbreviated code…

...
// include statements
...
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <BlynkSimpleEthernet.h>
#include <utility/w5100.h>
...
// setup for blynk    
char auth[] =   "*******************************"; // (not shown here for security reasons)
...
// mac, ip, dns addresses for ethernet shield
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};  // invent MAC address for ethernet shield
IPAddress ip(10,0,1,199);  // set IP address
IPAddress myDns(75,75,75,75);  // set DNS address
byte server[] = { 10, 0, 1, 36 }; // fixed ip address of local server
...
// initialize the library instance for ethernet shield
EthernetClient client;

/*******************************************************************************************************************************
 * void setup() 
 ********************
 * Purpose: Sets up arduino
 *******************************************************************************************************************************/
void setup() {
  Serial.begin(115200);   // start serial port
  while (!Serial) {
    ; // wait for serial port to connect. 
  }
  Blynk.begin(auth);   // start blynk & ethernet connection (blynk server option)
  delay(5000);   // give it time 
  Udp.begin(localPort);  // start udp for ntp reading
}

/*******************************************************************************************************************************
 * void loop() 
 ********************
 * Purpose: Main code, runs forever
 *******************************************************************************************************************************/

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

/*******************************************************************************************************************************
 * void getWeather() 
 ********************
 * Purpose: makes HTTP request to local server, which is repeating dark sky without https
 *******************************************************************************************************************************/
void getWeather() {
  
  char c;
  client.stop();
  
  // if there's a successful connection:
  Serial.println("connecting to local server for conditions...");

  if (client.connect(server, 80)) {
       
    // send the HTTP GET request:
    client.println(F("GET / HTTP/1.1"));   
    client.println(F("Host: 10.0.1.36:80")); // ip address of mac mini in music room, which is http server
    client.println();     // APACHE SERVER SEEMS TO REQUIRE 2 LINE FEEDS HERE !!!  SimpleHttpServer did not!
    client.println();

    client.println(F("Connection: close"));
    client.println();
    
     // parse JSON data fetched from api
    parseWeather();     

    // note the time that the connection was made:
    lastConnectionTime = millis();
 
  } 
  else {
    // if  couldn't make a connection:
    client.stop();
    Serial.print(F("weather connection failed: "));Serial.println(nFailures_weather);
  }

}

...

Can somebody help?

Are you sure your local server is actually working correctly and able to respond to GET requests?

I can’t see how Blynk changes could affect the functionality of the communication between your Arduino and local server, so a networking issue seems most likely to me.
The W5100 shields on the Arduino are extremely flakey and that would be the first thing I’d look at. If you have a spare then swap it out. If you don’t then beg, borrow or steal one before you head out of town.

Pete.