i’m now creating a project, plotting temp and humidity to blynk app, at the same time store data in SD card,
i have arduino uno with ethernet shield w5100 when i run the program it always trying to connect to the cloud server
some times it connects, and once connected it stay about 1 or 2 minutes and than server is down…
here is my prog so you can help me
//#define BLYNK_PRINT Serial // Enables Serial Monitor
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h> // This part is for Ethernet stuff
#include <OneWire.h>
//#include <SimpleTimer.h>
#define LIMITMAX 35
#define LIMITMIN 10
#define LIMITDHT 80
#include <DHT.h>
#include <SD.h>
#define DHTPIN 3
#define DHTTYPE DHT11 // DHT 11
//SimpleTimer timer;
const int chipSelect = 4;
char auth[] = "d6f128e07e294f849ee3c3d2e8e12a23";
/* WiFi credentials */
/* TIMER */
/* DS18B20 Temperature Sensor */
#include<DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
int temp_0;
int temp_1;
int h;
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
dht.begin();
Serial.begin(9600);
//Blynk.begin(auth);
Blynk.begin(auth);
DS18B20.begin();
SD.begin(chipSelect);
}
void loop()
{ // timer.run(); // Initiates SimpleTimer
Blynk.run();
h = dht.readHumidity();
Blynk.virtualWrite(V2, h);
DS18B20.requestTemperatures();
temp_0 = DS18B20.getTempCByIndex(0); // Sensor 0 will capture Temp in Celcius
temp_1 = DS18B20.getTempCByIndex(1); // Sensor 0 will capture Temp in Celcius
File sdcard_file = SD.open("data.csv", FILE_WRITE);
if (sdcard_file) {
//Serial.print("Temp_0: ");
Serial.print(temp_0);
//Serial.print(" oC . Temp_1: ");
Serial.print(temp_1);
//Serial.println(" oF");
Serial.print(h);
}
Blynk.virtualWrite(V5, temp_0); //virtual pin V5 indoor temp
Blynk.virtualWrite(V6, temp_1); //virtual pin V6 outdoor temp
if(temp_0>LIMITMAX){
Blynk.email("bxxx@xxxfr", "Ethernet Alert", "Temperature Increased over limit");
Blynk.notify("Attention! température salle 1 élevé!");
}
if(temp_0<LIMITMIN){
Blynk.email("bxxx@xxxfr", "Ethernet Alert", "Temperature Increased over limit");
Blynk.notify("Attention! température salle 1 très faible!");
}
if(temp_1>LIMITMAX){
Blynk.email("benhassine.m@hotmail.fr", "Ethernet Alert", "Temperature Increased over limit");
Blynk.notify("Attention! température salle 2 élevé!");
}
if(temp_1<LIMITMIN){
Blynk.email("bxxx@xxxfr", "Ethernet Alert", "Temperature Increased over limit");
Blynk.notify("Attention! température salle 2 très faible!");
}
if(h>LIMITDHT){
Blynk.email("bxxx@xxxfr", "Ethernet Alert", "Temperature Increased over limit");
Blynk.notify("Attention! humidité très élevé!");
}
} // End of Void Loop