Micro SD Card Slot Module, SPI Serial Peripheral Interface (TF card compatible)
- Was RM8.50
-
RM4.50
- Product Code: micro-sd card slot
- Availability: In Stock
The micro-SD Card Module is a simple solution for transferring data to and from a standard SD card. The pin out is directly compatible with Arduino, but can also be used with other microcontrollers. It allows you to add mass storage and data logging to your project.
This module has SPI interface which is compatible with any sd card and it use 5V or 3.3V power supply which is compatible with Arduino UNO/Mega.
SD module has various applications such as data logger, audio, video, graphics. This module will greatly expand the capability an Arduino can do with their poor limited memory.
Features:
In this example we connect an SD card to our Arduino, we will log analog readings to a file on the SD card.
Enter the following sketch in Arduino IDE then upload it. If you open your Arduino serial monitor you will be able to see the progress.
#include <SD.h> //SD library comes with Arduino IDE const int chipSelect = 4; void setup() { Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. } Serial.print(“Initializing SD card…”); pinMode(10, OUTPUT); //iniot SD card if (!SD.begin(chipSelect)) { Serial.println(“Card failed, or not present”); return; } Serial.println(“card initialized.”); } void loop() { String dataString = “”; // read three sensors and append to the string for (int analogPin = 0; analogPin < 3; analogPin++) { int sensor = analogRead(analogPin); dataString += String(sensor); if (analogPin < 2) { dataString += “,”; } } // open the file. File dataFile = SD.open(“data.txt”, FILE_WRITE); // if the file is available, write to it: if (dataFile) { dataFile.println(dataString); dataFile.close(); } // if the file isn’t open else { Serial.println(“error opening data.txt”); } }
Libraries
The default Arduino library for SD card is huge! With the example read/write sketch, when compiled it’s 13690 Bytes which is half of the available flash space on an Arduino pro mini!
So if you are tight in sketch space, it’s a good idea to find a smaller library. Depends on the SD cards you have and the format you want to use, you have these options.
FAT32 Format (larger than 2GB card)
- Arduino SD
- Adafruit SD (almost the same as Arduino SD, except a few optimization on SRAM memory)
- SDFatLib
FAT16 Format (smaller than 2GB card)
I haven’t tested all of these libraries, so do your research and test them before using it.
Reference: