Difference between revisions of "Arduino SD card Module"

From Geeetech Wiki
Jump to: navigation, search
(Created page with "==Introduction== The Arduino SD Card Shield is a simple solution for transferring data to and from a standard SD card. The pinout is directly compatible with Arduino, but can ...")
 
 
(18 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Introduction==
 
==Introduction==
 +
[[File:IMG_0283.jpg | 500px]]
 +
 
The Arduino SD Card Shield is a simple solution for transferring data to and from a standard SD card. The pinout 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.
 
The Arduino SD Card Shield is a simple solution for transferring data to and from a standard SD card. The pinout 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.
  
 
==Features==  
 
==Features==  
*Break out board for standard SD card and Micro SD (TF) card
+
 
 +
*Break out board for standard SD card.
 
*Contains a switch to select the flash card slot  
 
*Contains a switch to select the flash card slot  
 
*Sits directly on a Arduino  
 
*Sits directly on a Arduino  
 
*Also be used with other microcontrollers  
 
*Also be used with other microcontrollers  
  
==Connection Diagram==
+
==Usage==
[[File:SD card wiring.jpg]]
+
[[File:SD card wiring.jpg|400px]]
 +
 
 +
==Document==
 +
Another SD card library [http://www.henningkarlsen.com/electronics/library.php?id=37 tinyFAT]
 +
 
 +
==example code==
 +
Open Files ->Examples ->SD ->datalogger
 +
 
 +
#include <SD.h>
 +
const int chipSelect = 4;
 +
void setup()
 +
{
 +
  Serial.begin(9600);
 +
  Serial.print("Initializing SD card...");
 +
  // make sure that the default chip select pin is set to
 +
  // output, even if you don't use it:
 +
  pinMode(10, OUTPUT);
 +
 
 +
  // see if the card is present and can be initialized:
 +
  if (!SD.begin(chipSelect)) {
 +
    Serial.println("Card failed, or not present");
 +
    // don't do anything more:
 +
    return;
 +
  }
 +
  Serial.println("card initialized.");
 +
}
 +
void loop()
 +
{
 +
  // make a string for assembling the data to log:
 +
  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 += ",";
 +
    }
 +
  }
 +
  File dataFile = SD.open("datalog.txt", FILE_WRITE);
 +
  if (dataFile) {
 +
    dataFile.println(dataString);
 +
    dataFile.close();
 +
    Serial.println(dataString);
 +
  } 
 +
  else {
 +
    Serial.println("error opening datalog.txt");
 +
  }
 +
}
 +
 
 +
= How to buy=
 +
click here to buy [http://www.geeetech.com/sd-card-reader-module-for-memory-read-and-write-p-170.html SD card]

Latest revision as of 09:44, 23 July 2014

Introduction

IMG 0283.jpg

The Arduino SD Card Shield is a simple solution for transferring data to and from a standard SD card. The pinout 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.

Features

  • Break out board for standard SD card.
  • Contains a switch to select the flash card slot
  • Sits directly on a Arduino
  • Also be used with other microcontrollers

Usage

SD card wiring.jpg

Document

Another SD card library tinyFAT

example code

Open Files ->Examples ->SD ->datalogger

#include <SD.h>
const int chipSelect = 4;
void setup()
{
 Serial.begin(9600);
 Serial.print("Initializing SD card...");
 // make sure that the default chip select pin is set to
 // output, even if you don't use it:
 pinMode(10, OUTPUT);
 
 // see if the card is present and can be initialized:
 if (!SD.begin(chipSelect)) {
   Serial.println("Card failed, or not present");
   // don't do anything more:
   return;
 }
 Serial.println("card initialized.");
}
void loop()
{
 // make a string for assembling the data to log:
 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 += ","; 
   }
 }
 File dataFile = SD.open("datalog.txt", FILE_WRITE);
 if (dataFile) {
   dataFile.println(dataString);
   dataFile.close();
   Serial.println(dataString);
 }  
 else {
   Serial.println("error opening datalog.txt");
 } 
}

How to buy

click here to buy SD card