What you need and how the parts fit together
An SD card module is a small circuit board that lets your Arduino read and write files to an SD card — the same kind of memory card used in cameras and phones. The module sits between your Arduino and the SD card, translating the Arduino's signals into commands the card understands. You connect them with five wires that carry power, ground, and three data signals.
The module itself is cheap — usually under $5 — and comes pre-soldered with a slot for a full-size or microSD card. Your Arduino board, a breadboard, five jumper wires, and an SD card are all you need to get your free guide. The whole setup takes about ten minutes to wire.
Key Takeaways
- An SD card module connects to Arduino using five wires: power (5V or 3.3V), ground, and three data lines (MOSI, MISO, SCK).
- The exact pins on your Arduino depend on which board you have — Arduino Uno uses pins 11, 12, and 13 for data, but Arduino Mega uses different pins.
- You must install the SD library in the Arduino IDE before you can write code that reads or writes files.
- The module needs either 5V or 3.3V power depending on the version — check your module's label or datasheet to be sure.
Identifying the five pins on your SD card module
Every SD card module has five pins labeled on the circuit board itself. Look at the side with the metal contacts and find the text printed next to each pin. The labels are small but readable with a phone camera or magnifying glass.
The five pins are: GND (ground), VCC (power), MOSI (data from Arduino to module), MISO (data from module to Arduino), and SCK (clock signal that synchronizes the data). Some modules also have a CS pin, which stands for chip select — this tells the module when the Arduino is talking to it. If your module has CS, you will use it; if not, the module works without it.
Write down the pin labels as you see them. You will need this list when you wire the breadboard.
Wiring the module to your Arduino board
Start by plugging your Arduino into the breadboard or laying it flat on your work surface. Insert the SD card module into the breadboard next to it, leaving at least two rows of empty space between them so you have room for jumper wires.
Connect the five wires in this order. First, connect GND on the module to any GND pin on your Arduino — usually labeled GND on the board itself. Second, connect VCC on the module to either the 5V or 3.3V pin on your Arduino. Check your module's label: most common modules use 5V, but some require 3.3V. If you use the wrong voltage, the module may not work or may be damaged.
Next, connect the three data pins. On an Arduino Uno, connect MOSI to pin 11, MISO to pin 12, and SCK to pin 13. If you have an Arduino Mega, use pin 51 for MOSI, pin 50 for MISO, and pin 52 for SCK. If your module has a CS pin, connect it to pin 10 on a Uno or pin 53 on a Mega. If your module does not have a CS pin, you can skip this step.
Double-check each wire by tracing it from the module pin to the Arduino pin. A loose or reversed wire is the most common reason the module does not work.
Installing the SD library in the Arduino IDE
Before you write any code, you need to add the SD library to your Arduino IDE. This is a collection of pre-written code that handles all the complicated communication between your Arduino and the SD card module.
Open the Arduino IDE on your computer. Click Sketch in the menu bar, then click Include Library, then click Manage Libraries. A window will open showing all available libraries. In the search box at the top, type SD. The official SD library by Arduino will appear at the top of the list. Click on it, then click the Install button. Wait for the installation to finish — it usually takes less than a minute.
Once the library is installed, you can close the library manager. The SD library is now ready to use in any sketch you write.
Writing code to test the connection
Plug your Arduino into your computer with a USB cable. Open a new sketch in the Arduino IDE. Copy and paste this test code into the editor:
#include <SD.h> const int chipSelect = 10; void setup() { Serial.begin(9600); if (!SD.begin(chipSelect)) { Serial.println("SD card failed"); return; } Serial.println("SD card ready"); } void loop() { }
Change the number 10 in the line const int chipSelect = 10; if you connected your CS pin to a different Arduino pin. If your module does not have a CS pin, use 4 as the default. Click the Upload button to send the code to your Arduino.
Once the upload finishes, click Tools, then Serial Monitor. A window will open showing messages from your Arduino. If you see "SD card ready", your wiring is correct and the module is working. If you see "SD card failed", check that all five wires are firmly connected and that the SD card is fully inserted into the module slot.
Common wiring mistakes and how to fix them
The most common mistake is using the wrong Arduino pins for the data lines. Each Arduino board has a different set of pins for SPI communication — the protocol that talks to the SD card module. Uno uses 11, 12, and 13; Mega uses 50, 51, and 52; Leonardo uses 16, 14, and 15. If you wire the wrong pins, the Serial Monitor will show "SD card failed" even though the wiring looks correct. Check your Arduino board's pinout diagram on the Arduino website to be sure.
The second mistake is connecting VCC to the wrong voltage. If your module is labeled for 3.3V but you connect it to 5V, it may work for a few seconds and then stop responding. If you are not sure which voltage your module needs, look for a label on the circuit board itself or check the seller's product page. When in doubt, use 5V — most modules are designed for it.
The third mistake is a loose wire on the breadboard. Breadboard connections are friction-fit and can come loose if the wire is moved or if the breadboard is bumped. If the Serial Monitor shows "SD card failed" and you have checked the pins, try removing each wire one at a time and reinserting it firmly. Often this fixes the problem without any other changes.
What to do after the connection works
Once the test code shows "SD card ready", you can start writing code that actually reads and writes files. The SD library includes examples for creating files, writing data to them, and reading data back. In the Arduino IDE, click File, then Examples, then scroll down to SD to see the available examples.
A common next step is logging sensor data to a file. You can read temperature from a sensor, add a timestamp, and write both to a text file on the SD card every few seconds. This is useful for long-term experiments or data collection where you cannot keep the Arduino connected to a computer the whole time.
Frequently Asked Questions
Do I need a breadboard, or can I solder the wires directly?
You can solder directly if you are comfortable with a soldering iron, but a breadboard is safer for learning because you can disconnect and rewire without damaging the module or Arduino. Breadboards are cheap and reusable, so most people start there.
What if my SD card is not recognized even though the wiring is correct?
The SD card itself may be corrupted or formatted in a way the Arduino cannot read. Try formatting the card on a computer first — right-click the card in File Explorer or Finder and select Format. Use FAT32 format, which is the most compatible. Then reinsert the card and test again.
Can I use a microSD card instead of a full-size SD card?
Yes, if your module has a microSD slot. The wiring and code are identical — the module handles the size difference. Some modules come with both slots, so check which one yours has before buying a card.
Do I need to power the Arduino from a separate power supply, or is USB power enough?
USB power is usually enough for the Arduino and the SD card module together, especially if you are just reading and writing files. If you add many other sensors or components, a separate power supply becomes necessary, but for a basic setup, USB is fine.
What happens if I unplug the SD card while the Arduino is writing to it?
The file may become corrupted and unreadable. Always stop your sketch or wait for a write operation to finish before removing the card. If you need to swap cards frequently, add code that closes the file before you remove it, or use a button to signal when it is safe to unplug.