This might seem an old question. However quite recently my professor has assigned a project to me to develop a Attendance-cum-Access System for his Lab. The problem Statement is: "Develop a Arduino based Security system, that reads a RFID card and grants access to the lab. For the same you are allowed to use Arduino Nano v3 with the following components: 1 MFRC522 Reader (NXP Semiconductor), a SD Card Module (6-pin Config) to store the access information, an RTC module(DS3231) to maintain the time logs, an 16x2 LCD panel to display messages and a Relay connected to Door (and an Optional GSM800A module to send SMS of unauthorized access)."

So far I have used of the above components individually and all of them are working perfectly fine by using their respective library available on Arduino Libraries or GitHub repository. However the real problem arises when I am trying the save the access info on the SD Card. The moment the Reader and SD card share the Common SPI Wires, the SD card malfunctions showing varied errors ranging from SD initialization failed or FAT16/32 partition not found or Filename does not exist. I have been searching a solution for the past 1 month but without any success and my project seems to remain stuck here. The workflow is as follows:

1 Wait for Card:

2 Once detected Check the UID

3 Make note of the UID, time and date.

4 Check for the UID in access.txt file in SD Card.

4a. If UID exists: grant access by activating Relay. Show relevant info on LCD

4b. If UID does not exist: Deny access (if needed send SMS of the unauthorised access)

Well SMS module is not that crucial now keeping in mind the cost (It cost more than all the other modules together). So we can keep it aside for now. But any help in managing the SPI communication between Nano (master) and the slaves (SD, Reader) will be beneficial. I have tried the solutions posted in previous discussions but none seem to work out effectively, including adding a 220K resistor / diode in the wiring.

  • \$\begingroup\$ "the Reader and SD card share the Common SPI Wires" You can not share ALL the wires. The CS must be different AND beware that the SD card checks the SPI interface even if CS is high. (Checks for ~74 idle cycles) \$\endgroup\$ – Oldfart Jun 16 '18 at 10:28
  • \$\begingroup\$ Practically speaking you'll want to move one of the SPI devices to a different set of pins and bit-bang it, because the card does not quite behave like a real SPI device should. \$\endgroup\$ – Chris Stratton Jun 16 '18 at 15:15
  • \$\begingroup\$ Can you share your schematics? \$\endgroup\$ – Umar Jun 17 '18 at 5:27
  • \$\begingroup\$ @Oldfart I agree that the SS/CS Pins are different and that has been taken care of. \$\endgroup\$ – Gaurav Kamila Jun 17 '18 at 9:58
  • \$\begingroup\$ @ Umar: Here's the link to the schematic: drive.google.com/file/d/1WHGahmBEs8td_vwd0oppV7I0wunzAwr9/… \$\endgroup\$ – Gaurav Kamila Jun 17 '18 at 10:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.