Software Serial has failed me on this piece though. You absolutely must use the standard hardware serial (Serial.println() ) functions in order to not lose data. Even with large multi-second delays and very little information being transferred, the Arduino Software Serial library failed to keep up.
This is unusual, as I’ve found the Software Serial library very reliable for use with GPS and 3DR radios’ serial interfaces.
I’ve successfully used the setup() routine to specify the file I want to save to. This required a bit of hackery. To send a Ctrl+Z character in Arduino (required for setting up the open log in command mode) you need to do the following in code:-
Serial.print((char)0x1A); // Ctrl + z Serial.print((char)0x1A); Serial.print((char)0x1A); delay(1000); Serial.println("append " + file); // tell open log to append to a named file (file created if it doesn't exist) delay(1000); logGpx(file,team,now); // my customised logging setup function
Those delay() calls probably aren’t strictly required, but they don’t slow down my app either.
Note that char 0x1A is a hexadecimal number for ASCII character 26 (the A is the 10th character in a sequence, the 1 in the second column means 1×16 (base 16), thus 10 + 16, which is character code 26. ASCII character 26 is the same as Ctrl+Z in a terminal in Windows CoolTerm, which is the required character for entering and leaving command mode in OpenLog.
I’m using the XML based GPX format to write updates. In future I’m going to hook this up to a GPS, so it makes sense to use this format rather than NMEA as it can easily be read by online and desktop tools. You could use KML instead (Google Earth format).
I wonder how much current this little device draws?…
Power usage of just the memory card (doesn’t include the Arduino itself):-
- During command mode, up to 12mA
- During normal standby operation, 1.57 mA
- During writing data, anywhere from 6.5 to 11.5 mA, averaging approx 7.8mA