Hello,
I've build the following powermonitor system/thermostat:
- an arduino MASTER with ethernet/sd shield (sdfat libs) + LCD display + temperature (ds1820) sensor + RF transeiver module (RFM12)
It measures temperature and acts as thermostat (PID in software). It also receives temperatures and power measurement values from slaves and write all this data to SD card . - jeenode slave(s) with temperature(DS1820) sensor (send value to master every 60 sec) and power monitorring (CT sensor,send value to master every 20 sec).
It all works well, but the arduino always crashes after 2-10 hours running. It's always hanging on this code (but it was already executed about 500-10000 times in these 2-10 hours running):
if (!file.open(&root, data_file, O_CREAT | O_APPEND | O_WRITE)) {sprintf(msg, "open failed data.csv file"); writeError(msg);}
file.print(currentDateTime);file.print(';');file.println(msg2);
if (file.writeError) {sprintf(msg,"write failed data.csv file"); writeError(msg);}
if (!file.close()) {sprintf(msg,"closed file failed data.csv "); writeError(msg);}
to be more specific: on the file.print or file.writeError it ends.
I've tried:
- with less writes to SD card (with syncvalues every 10 min) and file.sync etc...
- lower the speed of the spi bus
- checked the available memory (always 2500 bytes SRAM available)
Does anyone know how to proceed (more debug) ?
Thanks, Jeroen.