กลับไปหน้ารวมไฟล์
arduino-temperature-logger-with-sd-card-30059f-en.md

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!

invisible_mess_glasses_relay_schema_1772681179521.png

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).

  1. The Initialization: The code begins with SD.begin(4). The Arduino powers up the card and checks if it is formatted (FAT32) correctly.
  2. The Reading Phase: The Arduino pings a DHT11 or DHT22 digital sensor to grab the numerical temperature (e.g., 24.5).
  3. File I/O (Input/Output): The code opens a specific file: File dataFile = SD.open("templog.csv", FILE_WRITE);.
  4. The Write Phase: The microprocessor prints a string literal: "12:05:00, 24.5C\n" directly onto the card's silicon memory blocks using dataFile.println().
  5. 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.

ข้อมูล Frontmatter ดั้งเดิม

title: "Arduino Temperature Logger With Sd Card"
description: "Record the data! Build a robust standalone device that measures room temperature and permanently saves a log entry to a MicroSD card every 5 minutes."
category: "Sensors & Environment"
difficulty: "Intermediate"