Permanent Data: SD Card Temperature Logger
Viewing numbers flowing on an LCD screen is fleeting. To track the efficiency of your home insulation or server room over a month, you must create a Data Logger. The SD Card Temperature Logger project is the backbone of all serious scientific Arduino builds, saving exact CSV files for Excel analysis!

SPI Communication: The SD Card Shield
An SD Card is an incredibly fast, complex memory device. It does not use raw digital pins; it requires the Hardware SPI Bus (MISO, MOSI, SCK, CS).
- The Initialization: The code begins with
SD.begin(4). The Arduino powers up the card and checks if it is formatted (FAT32) correctly. - The Reading Phase: The Arduino pings a DHT11 or DHT22 digital sensor to grab the numerical temperature (e.g.,
24.5). - File I/O (Input/Output): The code opens a specific file:
File dataFile = SD.open("templog.csv", FILE_WRITE);. - The Write Phase: The microprocessor prints a string literal:
"12:05:00, 24.5C\n"directly onto the card's silicon memory blocks usingdataFile.println(). - The Failsafe: Crucially, the code must execute
dataFile.close();immediately after writing. If the power is pulled before closing the file, the entire CSV is corrupted!
Component List
- Arduino Uno (often paired with a dedicated "Data Logging Shield" that combines the SD slot and the RTC chip).
- MicroSD Card Module Breakout.
- DS3231 RTC Module: To provide the "12:05:00" timestamp. (Without this, the Arduino doesn't know what time of day it is).
- DHT11/DHT22 or DS18B20 Temp Probe.