Null data is getting written on the SD card for some interval in particular patt


I am using Arduino UNO R3, Ethernet shield, RTC and two IR sensors in my system.

After every two seconds sensors data get written on SD card and when the web server is accessed the data from SD card gets written there and gets deleted from the SD card. This is what is requirement.

But i am observing that some times there are blank spaces on the web server and XXXXX to corresponding data in the SD card.

And there is particular pattern for the blank space/ XXXXX i.e

  1. From 00:00 till i retrieve in the morning it gives all the readings.
  2. After that first retrieval, next all start of the hr e.g 09:00, 10:00, 11:00 etc it gives data for 10-11 continuous minutes.
  3. All the start of each minute but not the start of the hour it gives m data till 9 seconds.

rest all data comes as blank.

I tried to format the SD card few times but doesn’t seems to be working.

Also since data comes correctly in between and I can access on my serial monitor all the time I think there is no issue with code!(May be I am wrong)

Is there anything I am missing??


Is there anything I am missing??

Your code and some examples of correct and incorrect data.


Attaching herewith my code and Reading sample. The blank spaces in between is wrong! Need continuous readings like we can see after 00:00 till I retrieved.


MCT_SD_Ethernet_Ver1.7.3.ino (7.72 KB)

Sorry could not attach the readings in last post!

Readings.pdf (324 KB)

      myFile.println(String(fourDigitYear) + "-" + String(month) + "-" + String(date) + " " + String(hour) + ":" + String(minute) + ":" + String(second) + ".000" + " " + "," + " " + String("11") + " "  + "," + " " + String("1")+ " " + "," + " " + String(binLevel));

Pissing away resources on the String class just so you can avoid using multiple myFile.print() statements is unbelievable.

And do you think that can be the reason??!!
Will try for sure..:smiley:

That seems to be working. Though need to be check for longer time.
Thank you so much!!
Is it related to the RAM allocation?? and limit on string length??
Sorry for those questions. I am very new to Arduino n given done code to work on with.
Thanks. :slight_smile:

Is it related to the RAM allocation?


and limit on string length?

C strings are not a problem. Instances of the String class are.

Ahh I see!!

Thank you so much..I appreciate your help!!