Ho il seguente sketch che mi monitorizza l'impianto fotovoltaico e termosolarle.
Il tutto è visibile su: https://xively.com/feeds/281717909
Il mio problema è che ogni 2/3gg benchè arduino continui ad inviare i dati ( i led della scheda ethernet lampeggiano...) xively non ki aggiorna i grafici. Devo spegnere e riaccendere arduino e router che ho in casa. Mi sapete aiutare ad individuare il problema?
Grazie
Prima parte:
/* IDE 1.05
29/08/2013 V3
CONTROLLO POTENZA GENERATA DAI PANNELLI FOTOVOLTAICI
CONTROLLO CONSUMI IN CASA
CONTROLLO ACCENSIONE E SPEGNIMENTO CALDAIA CON SENSORE LM35 POSIZIONATO SUL TUBO DELL'ACQUA CHE ESCE DAL BOLLITORE DEL SOLARE TERMICO
CONTROLLO TEMPERATURA ACQUAL ALL'INTERNO DEL BOLLITORE DEL SOLARE TERMICO
CONTROLLO ACCENSIONE E SPEGNIMENTO VENTOLA DI ASPIRAZIONE
CONTROLLO TEMPERATURA IN CENTRALE TERMICA
CONTROLLO TEMPERATURA ACQUA IN INGRESSO DEL BOLLITORE DEL SOLARE TERMICO
CONTROLLO ACCENSIONE RESISTENZA DA 2KW COMANDATA DA CENTRALINA IMPIANTO FOTOVOLTAICO
Ethernet shield attached to pins 10, 11, 12, 13
Arduino uno
modified by Ettore Massimo Albani
*/
#include <SPI.h>
#include <Ethernet.h>
#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1; // Create an instance CORRENTE GENERATA DAL FOTOVOLTAICO
EnergyMonitor emon2; // Create an instance CORRENTE CONSUMATA IN CASA
#define APIKEY "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // replace your Cosm api key here
#define FEEDID xxxxxx // replace your feed ID
#define USERAGENT "xxxxxxxxxxxxxxxxxxxxxxxx" // user agent is the project name
byte mac[] = {0xDE, 0xBD, 0xCC, 0xEF, 0xFE, 0xBD};// MAC address of Ethernet controller
IPAddress ip(192, 168, 1, 22); // IP address on your network here
EthernetClient client; // initialize the library instance:
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
// IPAddress server(216, 52, 233, 121); // numeric IP for api.cosm.com
char server[] = "api.cosm.com"; // name address for Cosm API
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
boolean lastConnected = false; // state of the connection last time through the main loop
const unsigned long postingInterval = 10000; // delay between updates to Cosm.com (10 s)
String DataString = ""; // stringa per invio dati
char Buffer[10]; // buffer per dftostr()
int otherSensorReadingAria = 0;
int otherSensorReadingCaldaia = 0;
int otherSensorReadingResistenza2Kw = 0;
int caldaiaON = 0; //*INGRESSO digitale PER CONTROLLO WEB STATO CALDAIA
int Ventola = 0; //*INGRESSO digitale PER CONTROLLO WEB STATO VENTOLA
int Resistenza = 0; //*INGRESSO digitale PER CONTROLLO WEB STATO resistenza
const float AnaRef = 5.0; // valore tensione (5V)
const unsigned int Risoluzione = 1024; // risoluzione (10 bit)
const float RangeMin = 2.0; // temperatura minima °C sensore LM35DZ (alim. 5V, out con res. 2k in serie)
const float RangeMax = 100.0; // temperatura massima °C sensore LM35DZ (alim. 5V, out con res. 2k in serie)
const float Incremento = 0.01; // incremento (10 mV/°C)
float Volt = 0; // valore sensori analogici in volt
const float Isteresi = 1.0; // isteresi (1 °C)
float TempAria = 0.0; // temperatura aria
float TempAriaMin = 2.0; // soglia inferiore temperatura aria (min 2 °C = RangeMin)
float TempAriaMax = 30.0; // soglia superiore temperatura aria (max 100 °C = RangeMax)
float TempAcquaOUTtermosolare = 0.0; // temperatura acqua
float TempAcquaMin = 2.0; // soglia inferiore temperatura acqua (min 2 °C)
float TempAcquaMax = 43.0; // soglia superiore temperatura acqua (max 100 °C)
float TempAcquaINGtermosolare = 0.0; // temperatura acqua in ingresso al termosolare
extern unsigned long timer0_millis;
float mela;
void setup() {
mela=1;
analogReference(DEFAULT); // DEFAULT (5V), INTERNAL (1,1V), EXTERNAL (0÷5V)
pinMode(A0, INPUT); // sensore di temperatura aria
pinMode(A1, INPUT); // sensore di temperatura acqua
pinMode(A2, INPUT); // sensore di temperatura acqua ingresso termosolare
pinMode(A3, INPUT); // TA Fotovoltaico
pinMode(A4, INPUT); // TA Casa
pinMode(2, OUTPUT); // D2 uscita per relè in parallelo alla resistenza da 2Kw installata sul bollitore
pinMode(3, INPUT); //*D3 ingresso controllo stato ventola da D5
pinMode(4, INPUT); //*D4 ingresso controllo stato caldaia da D6
pinMode(5, OUTPUT); //*USCITA IN PARALLELO AL RELE CALDAIA PER VISUALIZZAZIONE WEB STATO VENTOLA
pinMode(6, OUTPUT); //*USCITA IN PARALLELO AL RELE ACQUA PER VISUALIZZAZIONE WEB STATO CALDAIA
pinMode(7, OUTPUT); // relay ventola ON/OFF
pinMode(8, OUTPUT); // relay caldaia ON/OFF
pinMode(9, INPUT); // D10 ingresso per relè in parallelo alla resistenza da 2Kw installata sul bollitore
Serial.begin(9600);
emon1.current(3, 111.1); // Potenza: A3 -POTENZA GENERATA DAL FOTOVOLTAICO- input pin, calibration.
emon2.current(4, 111.1); // Potenza: A4 -POTENZA CONSUMATA IN CASA- input pin, calibration.
if (Ethernet.begin(mac) == 0) { // start the Ethernet connection
Ethernet.begin(mac, ip); // DHCP failed, so use a fixed IP address
Serial.println(F("Failed to configure Ethernet using DHCP"));
}
}