Project runs for some minutes, then stops!

Hello Blynkers,

My project runs for some 3 minutes, then it belly up! It does the same running in a “local” (“local” means a cloud server running Ubuntu latest release) server. I’m using the Mega2560 together with an Ethernet shield, Ethernet library updated It does the same using an ESP8266.

UPDATE: Issue resolved, a sensor was the problem.

Here is the sketch, I retouched it a little bit, the Mega2560 is a happy camper. I will post the library and some instructions if someone want to play around with the HIH6130 weather sensor.

/**************************************************************
 *    
 *    HIH6130 WX Sensors
 *    Author: Alex Rodriguez
 *    Reviewed: March 27, 2016 
 *  
 **************************************************************/

#define BLYNK_PRINT Serial    
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
SimpleTimer timer;
#include <Wire.h>
#include <A_HIH6130.h>

char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxx";
//============== HIH6130 Entries ==================

// Define the addresseses used by the HIH6130s
byte address1 = 0x29; HIH6130 hih6130_1(address1); // Master Bedroom Sensor
byte address2 = 0x27; HIH6130 hih6130_2(address2); // Backyard Sensor


void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth);
  // =========={ Initialize the HIH6130s }============================
  hih6130_1.begin(); // Initialize the HIH6130
  hih6130_2.begin(); // Initialize the HIH6130

  // Functions to be called every 3 seconds
  timer.setInterval(3000L, virtualPins);
  timer.setInterval(3000L, masterBedroom);
  timer.setInterval(3000L, backYard);
  } 

// ======================{ FUNCTIONS BEGIN HERE }=====================

 void masterBedroom() // Master Bedroom Sensor
{
   hih6130_1.readSensor();  //HIH6130 print data to the  serial port.
   Serial.println();
   Serial.print("Master Bedroom Temp       :");Serial.println(hih6130_1.temperature_F);
   Serial.print("Master Bedroom Humidity   :");Serial.println(hih6130_1.humidity);
   Serial.print("Master Bedroom Heat Index :");Serial.println(hih6130_1.computeHeatIndex_F());
   Serial.print("Master Bedroom Dew Point  :");Serial.println(hih6130_1.dewPoint());
}

void backYard() // Backyard Sensor
{
   hih6130_2.readSensor();//HIH6130 print data to the serial port
   Serial.println();
   Serial.print("Backyard Bedroom Temp     :");Serial.println(hih6130_2.temperature_F);
   Serial.print("Backyard Humidity         :");Serial.println(hih6130_2.humidity); 
   Serial.print("Backyard Heat Index       :");Serial.println(hih6130_2.computeHeatIndex_F());
   Serial.print("BackYard Dew Point        :");Serial.println(hih6130_2.dewPoint());
}

void virtualPins()
{  
   hih6130_1.readSensor();  // Master Bedroom Sensor
   hih6130_2.readSensor();  // Backyard Sensor
   //================{ Master Bedroom Sensor }==========================
   Blynk.virtualWrite(1, hih6130_1.temperature_F);        // Master Bedroom Temperature in F 
   Blynk.virtualWrite(2, hih6130_1.humidity);             // Master Bedroom Humidity 
   Blynk.virtualWrite(3, hih6130_1.computeHeatIndex_F()); // Master Bedroom Heat Index
   Blynk.virtualWrite(4, hih6130_1.dewPoint());           // Master Bedroom DewPoint in F
   Blynk.virtualWrite(5, hih6130_1.temperature_F);        // Master Bedroom Temperature - Graph
   Blynk.virtualWrite(6, hih6130_1.humidity);             // Master Bedroom Humidity    - Graph
   //================{ BackYard Sensor }================================ 
   Blynk.virtualWrite(7, hih6130_2.temperature_F);        // Backyard Temperature in F
   Blynk.virtualWrite(8, hih6130_2.humidity);             // Backyard  Humidity
   Blynk.virtualWrite(9, hih6130_2.computeHeatIndex_F()); // Backyard Heat Index in F
   Blynk.virtualWrite(10, hih6130_2.dewPoint());          // Backyard DewPoint 
}

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

try taking out all the blynk.run calls from the non loop sections

Dave1829: I took the blynk.run out of the non loop, still the same problem :frowning:

I think I read somewhere that if you are limited to so many writes to server per second or you’ll get disconnected for flooding(not sure about local server)
I’m no great programmer but although you only send every 3 seconds you have 10 virtualwrites in 1 go?
Maybe splitting them into 2 functions and setting another timer to call the new function might work :thinking:

This should not be the case. Blynk can handle many more writes to vPins. 3 seconds is like an eternity in Blynk time, lol.

The timer function as you implemented it, is spot on. I also use an ethernet port with the arduino and it works pretty well. The only thing I can imagine is that your sensors take too long to take the readings and that is what causing your issue. For the sake of argument, can you disable the sensor and see what happens?

Lichtsignaal: I thought about the sensors, too. actually, I have 4 of them connected in parallel using the I2C bus. 3 are HIH6130, plus a barometer/altimeter sensor(MS5611). One HIH6139 and the MS5611 are not in the sketch yet.

Here is a detail. The serial output goes dormant, as I said, after some 3 minutes, so does the Iphone app using the virtual pins , but, if I close the serial port monitor, and enable again, it works for some more minutes, and stop again.

Here is another detail, before using Blynk, I monitored them using some Web configuration, I never had this problem.

I thought I was flooding the server, as Rob.b said, so I configured my own server using a cloud provider, still the same problem.