SD Card Module With Arduino: How to Read/Write Data

About: ElectroPeak is your one-stop place to learn electronics and take your ideas into reality. We offer top-notch guides to show you how you can make your projects. We also offer high-quality products so you have...

Overview

Storing data is one of the most important parts of every project. There are several ways to store data according to the data type and size. SD and micro SD cards are one of the most practical ones among the storage devices, which are used in devices such as mobile phones, minicomputers and etc.
In this tutorial, you’ll learn how to use SD and micro SD cards with Arduino. In the end, as a simple project, you will measure the environment temperature every hour and store it on the SD card.

What You Will Learn

How to use SD and micro SD card

Writing data on SD card

Reading data from SD card

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: What Is SD and Micro SD Card Module?

The SD and micro SD card modules allow you to communicate with the memory card and write or read the information on them. The module interfaces in the SPI protocol.

To use these modules with Arduino you need the SD library. This library is installed on the Arduino application by default.

Note

These modules can not handle high-capacity memory cards. Usually, the maximum identifiable capacity of these modules is 2 GB for SD cards, and 16 GB for micro SD cards.

Step 2: Required Components

Step 3: Important SD Module Library Commands

A brief explanation of practical SD library’s commands is provided in the attached table.

*file is an instance from File class.
You can find more information about the SD library Here.

Step 4: How to Use SD and Micro SD Card With Arduino?

Tip

The module used in this tutorial is the micro SD module, however, you can use the code and tutorial for SD modules as well.

Step 5: Circuit

Using this module is very simple and its configuration is as picture.

Step 6: Code

Writing data on SD card with Arduino

Step 7: Result

The result of the above code execution

Step 8: Reading Data

Reading data from SD card with Arduino

Step 9: Result

The result of the above code execution

Step 10: Project: Save Temperature Data on a MicroSD Using DS3231 Module

You can find DS3231 here. In addition to the IC clock and calendar, this module also has a temperature sensor.

Step 11: Circuit

Step 12: Code

To work with the DS3231 module, you must first add the library (Sodaq_DS3231.h) to the Arduino application.

After storing the temperature at different times of the day, you can draw this information into Excel using the chart.

Step 13: Draw a Chart in Excel:

To do this, follow these steps:

Connect the SD card to your PC.

Enter the Excel software and select the From Text option from the data window and select the file from your memory card.

Step 14: What’s Next?

  • Create an entry/exit control device. Using the RFID module and Arduino, save entrance and exit time for several persons on the memory card. (Consider an RFID card for each person)
  • Like our FaceBook page to notice the latest projects and also support our team.

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    Discussions

    0
    None
    oyeka

    4 weeks ago

    Kudos welldone!

    Can you help, I want to build a mini child monitor, that its size is less than or equsl to size of a key holder. Powered buy coin battery.
    To detect location and eavesdrop the child's surroundings.
    Thanks.