Introduction: Micro SD Card Tutorial

Picture of Micro SD Card Tutorial

Description

This Micro SD Card is used for transfering data to and from a standard sd card. The pin out is directly compatible with Arduino and also can be used with other microcontrollers. It allow us to add mass storage and data logging to our project.

Features

  1. Input Voltage: 3.3V/5V
  2. With all SD SPI Pins out :MOSI, SCK, MISO and CS ,for further connection
  3. Through programming, you can read and write to the SD card using your arduino
  4. Make your SD application more easier and simple
  5. Communicate with Arduino using SPI interface
  6. Push-pop socket with card slightly over the edge of the PCB so its easy to insert and remove
  7. 4 mounting holes with 2.2mm diameter
  8. Only use 4 I/O pins on the Arduino
  9. Size: 42mm x 25mm x 5mm

Step 1: Step 1 : Material Planning

Picture of Step 1 : Material Planning

For this tutorial, the items needed to run this project are:

  1. Arduino Uno
  2. USB Cable type A to B
  3. Micro Sd Card Module
  4. Female to male jumper wire
  5. SD Card

Step 2: Step 2 : Hardware Installation

Picture of Step 2 : Hardware Installation

Micro SD Card Module

This module uses the standard SPI interface for communication, which involve SPI buses, MISO, MOSI, SCK, and a CS signal pin. through programming, the data can easily be read and wrote into SD Card by using the Arduino or other microcontrollers.

  • CS (chip select)
  • SCK (serial clock)
  • MOSI (master out slave in)
  • VCC (3.3V or 5V)
  • GND (ground)

Diagram above shows the simple connection between Micro SD Card Module and Arduino UNO:

  1. Connect VCC with 5V in the Arduino.
  2. Then, connect the GND of SD card to the ground of Arduino.
  3. Connect CS to pin 14
  4. Connect SCK to pin 13
  5. MOSI connect to the pin 11
  6. Lastly, connect MISO to pin 12

After completing the connection, connect the Arduino to power supply with USB cable.

Step 3: Step 3: Insert Coding

Picture of Step 3: Insert Coding

Lets try an example in the Arduino.

  1. Open the Arduino software
  2. Click 'file'
  3. Find the 'example'
  4. Click 'SD'
  5. Choose 'ReadWrite'

Step 4: Step 4 : Choose COM Port

Picture of Step 4 : Choose COM Port

Just click at 'Tools', then choose your port available on your PC.

Step 5: Step 5 : Upload Souce Code

Picture of Step 5 : Upload Souce Code

Upload the source code into the Arduino and open the Serial Monitor to se the result.

Step 6: Ster 6 : Result

Picture of Ster 6 : Result

The following result will be displayed in the monitor. In this example, the .txt file named "test.txt" was created and the sentence "testing 1,2,3." were wrote into the .txt file. After this, the sentence "testing 1,2,3." were read back from .txt file and display on serial monitor.

Comments

soceraso made it! (author)2017-12-16

I set it up with my Nano too! I connected MISO to D12, MOSI to D11, SCK to D13, and CS to D10. I'm working on a project that writes analog voltage readings to the SD card.

BastianM6 (author)soceraso2018-01-10

1. hola amigo, queria consultar si lograste hacer el codigo que querias...resulta que estoy trabajando en algo similar.


soceraso (author)BastianM62018-01-14

hola Bastian, contento para ayudar. Mi espanol es OK. No he enviado el codigo a GitHub, pero envia me un mensaje privado y puedo ayudar

soceraso (author)2017-12-15

I'm getting the "initialization failed!" error and wondering what's not correct. Can anyone explain this code?

if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}

soceraso (author)soceraso2017-12-16

Got it! For an Arduino Mega, we want to use pins 50, 51, 52, and 53 for MISO, MOSI, SCK, and CS, respectively.

MathB3 (author)2017-11-26

Nice,

I notice CS is to be plugged in pin4 as drawn. But you wrote 'Connect CS to pin 14'

Best regards

About This Instructable

9,784views

30favorites

License:

More by mybotic:Tutorial to Interface Sparkfun RGB Led WS2812B With Arduino UNOTutorial to Interface OLED 0.91inch 128x32 With Arduino UNOTutorial to Interface HX711 With Load Cell Straight Bar 50kg
Add instructable to: