Random Nerd Tutorials

Arduino Temperature Data Logger with SD Card Module


This post shows you how to create a temperature Arduino data logger. We’ll use the DHT11 to measure temperature, the real time clock (RTC) module to take time stamps and the SD card module to save the data on the SD card.

Recommended resources:

Parts required

Here’s a complete list of the parts required for this project:

Note: alternatively to the SD card module, you can use a data logging shield. The data logging shield comes with built-in RTC and a prototyping area for soldering connections, sensors, etc..

You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!


The following figure shows the circuit’s schematics for this project.

Note: make sure your SD card is formatted and working properly. Read “Guide to SD card module with Arduino“.

Installing the DHT sensor library

For this project you need to install the DHT library to read from the DHT11 sensor.

  1. Click here to download the DHT-sensor-library. You should have a .zip folder in your Downloads folder
  2. Unzip the .zip folder and you should get DHT-sensor-library-master folder
  3. Rename your folder from DHT-sensor-library-master to DHT
  4. Move the DHT folder to your Arduino IDE installation libraries folder
  5. Finally, re-open your Arduino IDE


Copy the following code to your Arduino IDE and upload it to your Arduino board.

In this code we create a loggingTime() function and a loggingTemperature() function that we call in the loop() to log the time and temperature to the DATA.txt file in the SD card.


Open the Serial Monitor at a baud rate of 9600 and check if everything is working properly.

Getting the data from the SD card

Let this project run for a few hours to gather a decent amount of data, and when you’re happy with the data logging period, shut down the Arduino and remove the SD from the SD card module.

Insert the SD card on your computer, open it, and you should have a DATA.txt file with the collected data.

You can open the data with a text editor, or use a spreadsheet to analyse and process your data.

The data is separated by commas, and each reading is in a new line. In this format, you can easily import data to Excel or other data processing software.

Wrapping up

This is a great project to learn how to use the SD card module with Arduino to build a data logger. You can apply this concept in pretty much any project you’d like.

If you like Arduino projects, make sure you check our latest Arduino course: Arduino Step-by-step Projects – Build 23 Projects

We hope you’ve found this project useful.

Thanks for reading.

Learn ESP32 with Arduino IDE

This is our complete guide to program the ESP32 with Arduino IDE, including projects, tips, and tricks! The registrations are open, so SIGN UP NOW »

Recommended Resources

Home Automation using ESP8266 »
Build IoT projects and home automation gadgets with the ESP8266 Wi-Fi module.

Build a Home Automation System »
Learn how to build a automation system using open-source hardware and software from scratch.

Arduino Step-by-Step Projects »
Build 25 cool Arduino projects with our course even with no prior experience!

Leave a Comment:

Add Your Reply

Enroll in our Electronics and Programming Courses:

ESP32, ESP8266, Arduino and much more.