Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use SD SDHC: Examples, Pinouts, and Specs

Image of SD SDHCDesign with SD SDHC in Cirkit Designer

Introduction

The SD/SDHC Card Module is an electronic component that allows microcontrollers to interface with Secure Digital (SD) or Secure Digital High Capacity (SDHC) memory cards. These cards are widely used for data storage and transfer in portable devices. The module is commonly used in embedded systems for logging data, storing configurations, or even for multimedia storage purposes.

Common applications include:

Explore Projects Built with SD SDHC

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino UNO SD Card Data Logger: A project utilizing SD SDHC in a practical application
Arduino UNO SD Card Data Logger

This circuit consists of an Arduino UNO connected to an SD card module. The Arduino provides power and ground to the SD module and interfaces with it using SPI communication through digital pins D10 (CS), D11 (MOSI), D12 (MISO), and D13 (SCK). The setup is intended for reading from or writing to an SD card using the Arduino.

Open Project in Cirkit Designer

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Name Description
CS Chip Select, active low
MOSI Master Out Slave In, SPI data input
MISO Master In Slave Out, SPI data output
SCK Serial Clock, SPI clock input
VCC Supply Voltage, 3.3V to 5V
GND Ground

Usage Instructions

Interfacing with a Circuit

To use the SD/SDHC Card Module with a microcontroller like an Arduino UNO, follow these steps:

  1. Connect the module's VCC pin to the 5V output on the Arduino.
  2. Connect the GND pin to one of the Arduino's GND pins.
  3. Connect the CS, MOSI, MISO, and SCK pins to the corresponding SPI pins on the Arduino. For an Arduino UNO, the connections are as follows:
    • CS to digital pin 10 (or another pin if you modify the CS pin in your code)
    • MOSI to digital pin 11
    • MISO to digital pin 12
    • SCK to digital pin 13

Important Considerations and Best Practices

Example Arduino Code

#include <SPI.h>
#include <SD.h>

File myFile;
const int chipSelect = 10; // Chip select pin for the SD card module

void setup() {
  Serial.begin(9600);
  while (!Serial) {
    ; // Wait for serial port to connect.
  }

  Serial.print("Initializing SD card...");

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

  // Open a new file and immediately close it to create it.
  myFile = SD.open("test.txt", FILE_WRITE);
  if (myFile) {
    Serial.println("Writing to test.txt...");
    myFile.println("Hello, SD card!");
    myFile.close(); // Close the file
    Serial.println("Done.");
  } else {
    // If the file didn't open, print an error
    Serial.println("error opening test.txt");
  }
}

void loop() {
  // Nothing here for now.
}

Troubleshooting and FAQs

Common Issues

Solutions and Tips for Troubleshooting

FAQs

Q: Can I use a microSD card with this module? A: Yes, with a microSD to SD adapter, you can use microSD cards.

Q: What is the maximum size of SD card I can use? A: The module supports SD cards up to 2GB and SDHC cards up to 32GB.

Q: How do I create directories or multiple files on the SD card? A: You can use the SD.mkdir() function to create directories and SD.open() with different filenames to create multiple files.

Q: Can I use this module with other microcontrollers? A: Yes, as long as the microcontroller supports SPI communication and operates at a compatible voltage level.