Arduino UNO with MIFARE RC522 and SD Card Reader module

Hi. I already made a simple RFID Card Reader with my Arduino UNO and MIFARE RC522. I also got it working with my Custom Time Attendance System by reading the serial output of the Arduino after reading the card. Now I'm looking at expanding this by attaching an SD Card Module to make it as a standalone device for collecting attendance logs. My problem now is that the sample code for Read/Write to SD Card uses the SPI pins 10 to 13, which the said pins are already used by my RFID Module.

Here's my pin assignments for the RFID Module:

SDA D10
SCK D13
MOSI D11
MISO D12
IRQ N/A
GND GND
RST D9
3.3V 3.3V

Can the 2 modules share these pins? If not, anyone can help me with mapping the pins needed for the SD Card module? Thanks in advance.

the pin 10 of the SD card is probable the Device Select pin (also other names)
so if you can connect that pin to lets say pin 8, and rewrite the sd library a bit so it uses pin 8 to enable the SD card
then you can disable the RFID when you want to write to SD and vice versa

get the idea?

Thanks for the reply, I'll try it out.

Hi Rude, did you manage to sort it out because I am a student and I have project to design and build attendance system and I am gathering information as much as I can and how can you help as well?

mashigtl:
Hi Rude, did you manage to sort it out because I am a student and I have project to design and build attendance system and I am gathering information as much as I can and how can you help as well?

If you are a student you should try to design it yourself and show your work (project code) here.
If it doesn't work then you will get more help (but most people do not make your homework :wink:

Hi robtillaart,
I am currently struggling to make work my Arduino Uno with RFID RC522 and a stand-alone micro SD Card.They are both SPI, therefore share the same MISO, MOSI and SCK pins. I assigned pin 10 for SDA (Slave Select) RFID, pin 9 for RST RFID and pin 4 for CS (Slave Select) SD Card. Individually RFID and SD Card sketch work well, but when it is combined it does not work...
I made sure to disable RFID by making the SDA Pin High before enabling the micro SD CS pin. But the program is still not working. It stops after printing "Card Ready" on the monitor and it did not respond to any RFID Card.

Here I attach the sketch...

Any help would be appreciated
Thank you very much...

RFID and SD Card.txt (8.78 KB)

I have the exact same problem. Rfid and sd work fine seperately, but sd doesnt init when put together. Has anybody found a solution yet?

I am aslo doing this ,,, please help me how i will connect the RF reader and Sd Card Pin to Arduino UNO

Same. I am working on mega controller and i need to open and read the file from the SD card.

when i am using RFID card, i want that chip id of the RFID card to be as a file name to open a file, store in SD card. but its not working after converting to string format too.
basically i am facing this issue in loop file system. on set up are thing is work file but on loop file system it showing error

some times: file dosn't exist.
: invalid (controller do not open the file)

If it helps I managed to get the SD card reader work alongside the RC522 RFID reader.

I worked out that if I disconnected the SD's MISO pin, the RC522 still worked.
So I tried to isolate them by adding a diode on each MISO line. The diode on the RC522's line stopped the RC522 from working at all (I'm guessing that this is because it's on 3.3V and the diode drops the signal by 0.7V and that's too low to be considered 'high' by the 5v Arduino) so I just left the other diode in and it solved the problem. I have to admit that I'm not sure why it helps.

To summarize:
I got it to work by adding a diode between the SD card reader's MISO pin and the Arduino's MISO input (pin 12 on the UNO). The diode's direction is anode to SD Reader, cathode to Arduino.

Hope this helps and if anyone can explain to me why it works I'd appreciate it!

Thanks

Hi jonnyg, I can't tell you why it works but I want to ask you if you can send me your sketch.
Thanks

Hi, For me it only worked when I put a 330R resistor in SD Miso Pin, before join RC522 Miso to the board. I dont know exactly why worked (got some clue here), tried everything else, only worked this way good luck to you folks !

I try with 330R resistor between MISO Arduino and MISO SD and works.. best regards... :slight_smile:

Hello. I try the same with 330R and that worked but when I want to play file audio through SD module and speaker of 8 ohm something happened, the speaker sounds like BEEP. If I disconnect the module RFID the file audio sounds in the speaker. I use the library tmrpcm.

Can somebody help me?