Hi everyone,
I work on a project to build an arduino UNO R3 based data logger. It will (hopefully) receive data from two NMEA 0183 devices (GPS and Anemometer) and store it on a micro SD card. So far I’ve written a code to parse NMEA sentence from the GPS module (AT6588 based, works fine as far as I can see).
I’ve modified the data logger example of the SD library to put the parsed NMEA data (latitude and longitude only in my case) on the SD card. I use this SD card module, it is connected to the arduino as shown in the picture attached. I’ve triple checked the wiring, its correct. My full code, if of any interest, is attached as ino file.
When I run the program it looks fine. Most of the time the SD card is successfully initialized. The data I want is saved on the SD card in a text file, just as required. Unfortunately the problem occurs after about 830 samples of data on the text file. The serial monitor puts out the error message “error opening log.txt” and no further data is recorded. This happens repeatedly every time I run the program. I’ve never recorded beyond 900 samples.
I thought it might be my code so I tried the original SD library data logger example (unchanged but chip select port 10 instead of 4). The exact same error occurs, the program fails to open the txt file after about 800 something samples. When I try to continue to write on the SD with the log file already filled with 800 + x samples the card is initialized but the file cant be opened. Seems like something keeps my program and even the example from saving more than these number of lines in one txt file. When I change the name of the file in the program (so that the code creates a brand new and empty file) it still doesent work.
Is there something obvious I forgot? Does anybody has experienced this problem before?
What could I try next to debug the code and build a data logger that runs for at least 10h?
test_custom_nmea_comparser.ino (7.87 KB)