I have a project with a DHT11 which reports information via (cloud.blynk.cc) Blynk Server. The problem is I can not get the record last longer than 1 hour. A proimadamente hour after the Arduino Uno loses communication.
I tried several times and consistently makes the same problem and do not know if there are any limitations on this in the server Blynk.
My project code:
#include “DHT.h”
#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#define ledPin 9 // LED conectado en D9
#define DHTPIN 2 // what digital pin we’re connected to
#define DHTTYPE DHT11 // DHT 11
#include <SimpleTimer.h>
SimpleTimer timer; // the timer object
DHT dht(DHTPIN, DHTTYPE); // se definen los parámetros del sensor/tipo
char auth[] = “xxxx”; // Put your blynk token here
int i;
IPAddress server_ip (192, 168, 1, 1);
// Mac address should be different for each device in your LAN
byte arduino_mac[] = { 0xDE, 0xED, 0xBC, 0xFE, 0xFE, 0xED };
IPAddress arduino_ip ( 192, 168, 1, 199);
IPAddress dns_ip ( 192, 168, 1, 1);
IPAddress gateway_ip ( 192, 168, 1, 1);
IPAddress subnet_mask(255, 255, 255, 0);
void setup() {
Serial.begin(9600);
Blynk.begin(auth, “cloud.blynk.cc”, 8442, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
Serial.println(auth);
timer.setInterval(3000, readTemp);
dht.begin();
i=0; // inicializo la variable de control para el envio de mails de alarma;
}
void loop() {
Blynk.run();
timer.run(); // Initiates SimpleTimer
}
void readTemp (){
// Wait a few seconds between measurements.
delay(10000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(“Failed to read from DHT sensor!”);
return;
}
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h, false);
Serial.print(“Humedad: “);
Serial.print(h);
Serial.print(” %\t”);
Serial.print("Temperatura: “);
Serial.print(t);
Serial.print(” *C ");
Serial.print("Sensacion Termica: “);
Serial.print(hic);
Serial.println(” *C ");
if (hic >= 24.00) {
// Send e-mail cuando la temperatura supere o iguale el valor determinado
// Just put the recepient’s “e-mail address”, “Subject” and the “message body”
if (i==0){
Blynk.email("palermogabriel@gmail.com", “ALARMA ALTA TEMPERATURA”, “Conectese para identificar la anomalía”);
i=1;
}
digitalWrite(ledPin, HIGH); // turn LED 9 on:
} else {
digitalWrite(ledPin, LOW); // turn LED 9 off:
i=0;
}
Blynk.virtualWrite(V10, hic); // le envio el valor de la sensación térmica
Blynk.virtualWrite(V11, h); // le envio el valor de la humedad
}