ArrowtronElectronics Store
Free shipping over ₹999
100% genuine components
Dispatch in 1–2 days
Secure payments · UPI, Cards

Temperature Data Logger with SD Card and RTC Timestamps

Log temperature readings to a CSV file on an SD card, each stamped with the exact date and time — then open the file straight in Excel.

Intermediate~2 hours6 components

What you’ll build

Every minute the Arduino Nano reads the DHT11, asks the DS3231 RTC for the current time, and appends a line like 2026-06-30 14:05,31.2,58 to LOG.CSV on the SD card. Perfect for monitoring a room, greenhouse or fridge over days.

Components you’ll need

ComponentQtyPrice
Arduino Nano ATmega328P Compatible Board1₹149
SD Card Module1₹19
RTC DS32311₹89
DHT111₹69
400 Point Breadboard1₹299
Jumper Wires MM1₹299
Total₹924

Step-by-step guide

  1. Wire the SD card module over SPI: VCC to 5V, GND to GND, CS→D10, MOSI→D11, MISO→D12, SCK→D13.
  2. Wire the DS3231 over I2C (SDA→A4, SCL→A5) and the DHT11 data pin to D4.
  3. Format a microSD card as FAT32 and insert it.
  4. Install the RTClib and DHT libraries; the SD library ships with the IDE.
  5. Set the RTC once with rtc.adjust (see the clock project), then upload this sketch.
  6. Let it run, then pop the card into your computer — LOG.CSV opens directly in Excel or Sheets for graphing.

The code

The sketch appends one CSV row per minute. Opening and closing the file each write makes it safe to pull the power at any time.

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <RTClib.h>
#include <DHT.h>
RTC_DS3231 rtc; DHT dht(4, DHT11);
void setup(){
  Serial.begin(9600); dht.begin(); rtc.begin();
  if(!SD.begin(10)){ Serial.println("SD failed"); while(1); }
}
void loop(){
  DateTime now = rtc.now();
  float t = dht.readTemperature(), h = dht.readHumidity();
  File f = SD.open("LOG.CSV", FILE_WRITE);
  if(f && !isnan(t)){
    char stamp[20];
    sprintf(stamp, "%04d-%02d-%02d %02d:%02d", now.year(), now.month(), now.day(), now.hour(), now.minute());
    f.print(stamp); f.print(','); f.print(t,1); f.print(','); f.println(h,0);
    f.close();
  }
  delay(60000L);
}

Build this project

Add all 6 required components to your cart in one click — total ₹924.

Add all components to cart
Scroll to Top