Logging data on an SD card
Let's start with the first topic of this chapter—logging data on a SD card using the integrated SD card slot of the Ethernet shield. What we are going to do is perform some measurements on the Arduino board and log each of these measurements to the SD card in a simple text file.
However, compared to the project of the Chapter 2, Sending Data to a Web Server, we don't actually know the date when the measurement was taken. In the previous chapter, we simply used the date of the computer, but we don't have this information here. To get the time on the Arduino board, we are going to use another strategy. We are going to use the Ethernet shield to connect to an NTP time server, grab the time once when the Arduino sketch starts, and then use the Time
library to track the time from there.
To learn more about the
Time
library, you can visit the following page on the Arduino website:
http://playground.arduino.cc/Code/Time
The process of logging data...