Sketch with RTC and Data Logger works with Arduino IDE but not when just powered

I have a sketch for my Uno where I get the RTC time from the Data Logger shield and write it to the SD card. When plugged into my computer running the Arduino IDE and compile/upload (but no serial monitor), it all works fine but when I just power it up with the USB but no uploading from the IDE or with a power supply, I don't get the RTC. Is the IDE providing the date/time or somehow getting the RTC when compiling.uploading?

Another question is how I get the files saved on the SD to get today's date? They all say "1/1/2000". The SD is formatted FAT32. I open and close the file and then open again but it didn't help.

jparkerri:
When plugged into my computer running the Arduino IDE and compile/upload (but no serial monitor), it all works fine

It probably isn't, you just think it is, but nobody will ever know because your code is apparently a secret. it appears that you can be pretty sure that there is nothing wrong with the SD or its relevant code but there is a specific formatting process for SD and reference to it in this forum.

You can name the file by date after midnight with code like

void getFileName(){
sprintf(filename, "%02d%02d%02d.csv", year, month, day);
}

jparkerri:
I have a sketch for my Uno where I get the RTC time from the Data Logger shield and write it to the SD card. When plugged into my computer running the Arduino IDE and compile/upload (but no serial monitor), it all works fine but when I just power it up with the USB but no uploading from the IDE or with a power supply, I don't get the RTC. Is the IDE providing the date/time or somehow getting the RTC when compiling.uploading?

Another question is how I get the files saved on the SD to get today's date? They all say "1/1/2000". The SD is formatted FAT32. I open and close the file and then open again but it didn't help.

You will have to provide the date to the SDfat.h library.

This thread talks about it.

Chuck.