Drop connection uno + W5500

ok, I already addressed a similar question, spent another month looking for a problem, but I could not solve it. arduino uno and shield 2 (W5500) I control a fan that carries warm air into the room, at a random moment it turns off, maybe after an hour, half an hour, a day or two, to control the connection, I added the timer_control function that checks the status every 10 minutes connection, it helps, but the connection is still lost, I used the ping command in Linux, thinking that the board disappears from the network, but everything is ok with the board. I can use example
arduino_etnernet_manual for W5500?


#include <SPI.h>
#include <Ethernet2.h>
#include <BlynkSimpleEthernet2.h>
#include <Arduino.h>

#include <OneWire.h>           
#include <DallasTemperature.h> 
#include <OneWire.h>
#define ONE_WIRE_BUS 2 
#define term_power 4   
#define VENT 7
char auth[] = "";

OneWire oneWire(ONE_WIRE_BUS);       
DallasTemperature sensors(&oneWire); 
BlynkTimer timer_Send;
BlynkTimer timer_control;
BlynkTimer timer_logic;
int need_temp = 0; 
int gester = 0;

void logic();
void control_connect();
void Send();

void setup()
{



  sensors.begin();             
  pinMode(term_power, OUTPUT);  
  pinMode(VENT, OUTPUT);
  Blynk.begin(auth);
  timer_Send.setInterval(3031, Send);
  timer_control.setInterval(600000UL,control_connect);
  timer_logic.setInterval(3013,logic);

}

BLYNK_WRITE(V0)
{
  need_temp = param.asInt();
}
BLYNK_WRITE(V1)
{
  gester = param.asInt();
}
BLYNK_CONNECTED()
{
  Blynk.syncAll();
}
double temp()
{

  digitalWrite(term_power, HIGH); 
  sensors.requestTemperatures(); 
  sensors.requestTemperatures();                         
  double real_temp = double(sensors.getTempCByIndex(0)); 

  digitalWrite(term_power, LOW); 

  return real_temp;
}

void control_connect(){
  bool conect = Blynk.connected() ;
  if (conect != true)
  {
      Blynk.connect(30);
  }
  
}


void logic() 
{
  double t_value = temp();

  if (t_value < need_temp - gester)
  {
    digitalWrite(VENT, HIGH);
  }
  if (t_value > need_temp + gester)
  {
    digitalWrite(VENT, LOW);
  }
  
}
void Send()
{
  double t_value = temp();

  Blynk.virtualWrite(V2, t_value);
}




void loop()
{
  Blynk.run();
  timer_Send.run();
  timer_control.run();
 timer_logic.run();  

  }

I spent many months trying to get a W5100 Ethernet shield working consistently, and failed.
The LEDs on the Ethernet shield would eventually start flashing rapidly and the connection would be lost. The only solution was to press the reset button on the shied to reset the connection - and this wouldn’t work all of the time.

There are discussions about placing a capacitor across the reset button, or a resistor and a capacitor and bending one of the legs out of the way to overcome a problem, like this:

These solutions didn’t work for me, and I eventually implemented a solution where I’d use one if the GPIO pins on the Arduino to simulate a hardware reset of the Ethernet shield, and do a ping to check that the reset had worked and if not repeat the process.
Even this didn’t always work with some Ethernet shields and eventually ‘saw the light’ and abandoned Arduinos and moved over to NodeMCU boards with WiFi connections and I’ve never looked back.

Pete.

Also, you don’t need three different timers, one timer object will support upto 16 different timers and will save you memory…

BlynkTimer timer;

 
  timer.setInterval(3031, Send);
  timer.setInterval(600000UL,control_connect);
  timer.setInterval(3013,logic);


  timer.run();

Pete.

Thanks for the help, but I don’t fully understand how a capacitor can help in this situation, will it accumulate charge and reboot the board simulating a button press? that is, it turns out this is a problem of the board and not the code? just the Ethernet goes along the power cables and I thought that they were interfering, then I began to believe that this was due to lack of memory, but the on and off logic continued to work

No, if you read the link it overcomes a problem where a manual button press fails to restart the Ethernet board - except it didn’t work for me.

Is your Ethernet shield going into a state where the LEDs are flashing rapidly?

Possibly, powerline Ethernet adapters aren’t generally very reliable.

How much memory do you have when the sketch compiles?

The bottom line is that you’d be far better off using WiFi rather than Ethernet and a NodeMCU or ESP32 rather than an Arduino.

Pete.

except for the LED power supply, I no longer have diodes on the shield