I think this should be a fairly simple thing. Arduino Mego board with three DHT22 temp/humidity sensors. An SD Card module. A RTC clock module.
Logic is simple enough: Read the values of the three sensors. Read time. Put it into a string. Open the SD Card, write string to log file. Close the SD card. Wait five minutes and do it all over again.
The only ‘fancy’ thing is to check that the readings are greater than zero and if not, delay two seconds and re-read the values.
The code I have works fine for some period of time, seems about 12 hours. Then the SD card fails to open the log file and the whole mess stops.
Inside the code, I have added sections that write the values to serial so I can see what is going on.
This includes the sensor values, date/time, what is about to be written, then it reads back the data in the log file.
Can anyone explain what might be going on?
Thanks in advance.
IndoorTempSensor-2.ino (11 KB)