DataShield is an Arduino-based interface to LadyAda's Data Logger Shield.
HackPittsburgh has launched two high-altitude balloon projects.
One was successful, one was not. Our third launch is pending, and the payload is anticipated to include a number of sensors not previously flown. This will require high-capacity real-time data logging capabilities, as air-to-ground data communication has not yet been developed.
To address this requirement, LadyAda's Data Logging Shield will be attached to the flight computer (an Arduino). Sensors will be periodically read and a string-encoded representation of their data will be written to the Data Logging Shield's SD card file system. In addition, each logged entry will be associated with a timestamp generated by the Data Logging Shield's onboard real-time clock.
This software library provides an interface to the Data Logging Shield.
- An Arduino (http://arduino.cc)
- Arduino 0021 (http://arduino.cc)
- Adafruit Data Logging Shield (http://www.ladyada.net/make/logshield)
- SdFatLib 10-10-2010 (http://code.google.com/p/sdfatlib)
- Adafruit's fork of RTClib (http://github.com/adafruit/RTClib)
Follow the installation and build instructions at http://www.ladyada.net/make/logshield to ensure that the minimum requirements are met.
To use DataShield in your project, you must ensure that a few preprocessor definitions are accurate, and you must of course build and connect the shield The best place to see what is required is in Lady Ada's tutorial and the code itself. If you have any questions, email me.
Initialize the logging subsystem by calling the
Write strings to the log by calling the
logString function. It should be noted that this function
does not immediately write log data to the SD card's filesystem. The
logFlush function must be
periodically called to do so. A good rule of thumb is to call this function approximately once per
second. Don't log too much data between calls to
logFlush or unsatisfactory performance may
When initializing the log subsystem, a new log file is always generated. The subsystem will look at
the SD card's filesystem, searching for files named
XX is a two-digit number
between 00 and 99. If a file is found, the log subsystem will try the filename that is one
increment above the existing file. This process will continue until a nonexistent file is found.
If there are already files named
log99.csv present on the filesystem, the log
subsystem will fail to open a log file. Subsequent calls to
logString will do nothing. The
current filename may be found by calling
getLogFilename, but please be aware that if log file
opening fails, this function will return a proper filename even though no logging is taking place.
DataShield has been marginally tested, and is completely unreviewed. The code compiles, and rudimentary tests for log integrity and filename generation have been performed, but the code should in no way be considered robust. I tried to be careful with the coding and design, I read the tutorials, and I tested code before checking it in. Nevertheless, I haven't actually tested this thing yet.
- Error-handling is not my favorite. I think it could be made to be more robust. I did pull out a fair chunk of error handling stuff in favor of fault-tolerance, but I think a happy medium could be found.
- I think some functions could be refactored; the code that finds the next filename, for example, could be split out of the init code.
- I feel as though the RTC functionality, the SD card functionality, and the file manipulation functionality all belong as isolated modules/classes.
I started with Lady Ada's Fridgelogger demo (http://github.com/adafruit/Light-and-Temp-logger), which is an excellent Data Logger Shield demo.
Ed Paradis (http://www.edparadis.com) built the Data Logger Shield I was using, and kicked off the actual code project by getting the thing running, examining and installing the dependencies, and being all-around helpful.
- Initial release (lightly bench-tested with an Arduino Duemilanove and the Data Logging Shield)
The MIT License Copyright (c) 2010 Jonathan Speicher Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.