Installing MicroSD Card Adapter to arduino RFID reader

Hello!

I need help on how to install my MicroSD Card Adapter v1.0 11/01/2013 on my arduino rfid reader.

Link to RFID reader: Tutorial 12 for Arduino: RFID Card Reading – JeremyBlum.com

And here is a picture of the RFID reader:

Here is pictures of the MicroSD Card Adapter:


What pins should I using to connect the MicroSD card adapter to the rfid reader?

This is the code I am using:

//Jeremy Blum's Arduino Tutorial Series - Episode 12 - RFID Cards
//Sample Code - RFID Code Reading
//http://www.jeremyblum.com
//Some Code Adapted from http://www.cooking-hacks.com
//Code Updated on 1/21/2012 to comply with Arduino 1.0 Changes

 byte data[5];  //For holding the ID we receive
 int val = 0;
 byte jeremy[5] = {0x3E,0x00,0xFC,0xBD,0x88};
 byte david[5]  = {0x3E,0x00,0xFC,0xFF,0xA5};

 void setup()
 {
   // Start serial port 19200 bps
   Serial.begin(19200);
   
   // Setting Auto Read Mode - EM4102 Decoded Mode - No password
   // command: FF 01 09 87 01 03 02 00 10 20 30 40 37
   Serial.write(0xFF);  //Header
   Serial.write(0x01);  //Reserved
   Serial.write(0x09);  //Length (Command + Data)
   Serial.write(0x87);  //Command (0x87 sets auto mode behavior
   Serial.write(0x01);  //Data 1: Enable Auto-Read
   Serial.write(0x03);  //Data 2: Mode – Parity decoded – Manchester RF/64
   Serial.write(0x02);  //Data 3: Total number of block to be read (2)
   Serial.write((byte)0x00);  //Data 4: No password expected
   Serial.write(0x10);  //Data 5: Password byte 1
   Serial.write(0x20);  //Data 6: Password byte 2
   Serial.write(0x30);  //Data 7: Password byte 3
   Serial.write(0x40);  //Data 8: Password byte 4
   Serial.write(0x37);  //Checksum
   
   delay(500);
   while(Serial.available()>0)
   {
     Serial.read();
   }
   Serial.println();
   Serial.println("RFID module started in Auto Read Mode, Waiting for Card...");
 }

 void loop()
 {
 
   val = Serial.read();
   while (val != 0xff)
   {  //On Successful read, first byte will always be 0xFF
      val = Serial.read();
      delay(1000);
   }
   
   //we already read the header (0xff)
   Serial.read();              // reserved
   Serial.read();              // length
   Serial.read();              // command (indicates tag data)
   data[0] = Serial.read();    // we read data 1
   data[1] = Serial.read();    // we read data 2
   data[2] = Serial.read();    // we read data 3
   data[3] = Serial.read();    // we read data 4
   data[4] = Serial.read();    // we read data 5
   Serial.read();              // checksum
   
   // Indentify RFID Card
   boolean j_card = true;
   boolean d_card = true;
   Serial.print("Card found - Code: ");
   for (int i=0; i<5; i++)
   {
     if (data[i] < 16) Serial.print("0");
     Serial.print(data[i], HEX);
      
     //cross-check
     if (data[i] != jeremy[i]) j_card = false;
     if (data[i] != david[i]) d_card = false;
   }
   Serial.println();
   
   if (j_card) Serial.println("Hello Jeremy!");
   else if (d_card) Serial.println("Hello David!");
   else Serial.println("Not Recognized!  Get out of Here!");
   Serial.println();
 }

And my other problem is that I want to store every RFID tag, that is used on my RFID reader, inside an MicroSD card. So when I use for exeple a tag on the rfid, the arduino will store the data from the tag inside the sd card. When I put the SD card inside my pc it will show a .txt file with the RFID tag
information in it.

So I wanna know what codes I shall use, where I need to put the code and what I need to change in order to make it work?

Thank you in advance!!

For the connections, make sure your VCC and GND connections are connected as they will be the ground and 5V connections to make the card run, as for the other ones, they are data carrying connections and connect them accordingly.

For the code part:

You need to assign a name to the MicroSD card and reference that in your code, You would also need to code something along the lines of an identifier that acts as the name and text file of your code, and tell it to store onto the MicroSD card using the referencing code.

I have been out of Arduino for a while so please excuse me if I do not make sense or it does not work. This is just a logical idea that came to my head as I looked at your post.

Kind regards,

For the connections, make sure your VCC and GND connections are connected as they will be the ground and 5V connections to make the card run, as for the other ones, they are data carrying connections and connect them accordingly.

That is done.

For the code part:

You need to assign a name to the MicroSD card and reference that in your code, You would also need to code something along the lines of an identifier that acts as the name and text file of your code, and tell it to store onto the MicroSD card using the referencing code.

Well the name thing is the only thing left.

This is where the code is showing the tag ID:

  // Indentify RFID Card
   Serial.print("Card found - Code: ");
   for (int i=0; i<5; i++)
   {
     if (data[i] < 16) Serial.print("0");
     Serial.print(data[i], HEX);
   }

And this is where I need to put it:

dataFile.println("Print to SCcard here");

This is the code of that part (this is not the full code)

// Indentify RFID Card
   Serial.print("Card found - Code: ");
   for (int i=0; i<5; i++)
   {
     if (data[i] < 16) Serial.print("0");
     Serial.print(data[i], HEX);
   }
   
  File dataFile = SD.open("tags.txt", FILE_WRITE);
  
  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println("Print to SCcard here");
    dataFile.println();
    dataFile.close();
    // print to the serial port too:
    Serial.println();
  }
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening tags.txt");
  }
  Serial.println("Tag ID has been saved");
  Serial.println();

Anyone that could help me?

There is a similar thread with the same functions as yours here.

This should help you out with the coding part and the implementation part.

Kind regards,

Goldfile:
There is a similar thread with the same functions as yours here.

This should help you out with the coding part and the implementation part.

Kind regards,

I solved my problem myself. Thank you for your support! :smiley: