The SD Card Module is a versatile component used to interface with SD cards, enabling data storage and retrieval in various electronic projects. This module is particularly useful in applications where large amounts of data need to be logged, such as in data logging systems, multimedia projects, and portable devices. It is commonly used with microcontrollers like the Arduino UNO to expand their storage capabilities.
Parameter | Value |
---|---|
Operating Voltage | 3.3V - 5V |
Interface | SPI (Serial Peripheral Interface) |
Supported Cards | SD, SDHC |
Storage Capacity | Up to 32GB (depending on the card) |
Current Consumption | 100mA (typical) |
Pin | Name | Description |
---|---|---|
1 | GND | Ground |
2 | VCC | Power Supply (3.3V - 5V) |
3 | MISO | Master In Slave Out (SPI Data Output) |
4 | MOSI | Master Out Slave In (SPI Data Input) |
5 | SCK | Serial Clock (SPI Clock) |
6 | CS | Chip Select (SPI Enable) |
Wiring the SD Card Module to Arduino UNO:
GND
pin of the SD Card Module to the GND
pin on the Arduino.VCC
pin of the SD Card Module to the 5V
pin on the Arduino.MISO
pin of the SD Card Module to the 12
pin on the Arduino.MOSI
pin of the SD Card Module to the 11
pin on the Arduino.SCK
pin of the SD Card Module to the 13
pin on the Arduino.CS
pin of the SD Card Module to the 10
pin on the Arduino.Arduino Code Example:
#include <SPI.h>
#include <SD.h>
const int chipSelect = 10;
void setup() {
Serial.begin(9600);
// Initialize the SD card
if (!SD.begin(chipSelect)) {
Serial.println("Initialization failed!");
return;
}
Serial.println("Initialization done.");
// Open a file for writing
File dataFile = SD.open("datalog.txt", FILE_WRITE);
if (dataFile) {
dataFile.println("Hello, SD card!");
dataFile.close();
Serial.println("Data written to file.");
} else {
Serial.println("Error opening file.");
}
}
void loop() {
// Nothing to do here
}
Initialization Failed:
Error Opening File:
Data Corruption:
By following this documentation, users can effectively integrate the SD Card Module into their projects, enabling reliable data storage and retrieval. Whether you are a beginner or an experienced user, this guide provides the necessary information to get started and troubleshoot common issues.