_:nf5aea65716a0451aa5240aa92729745fxb0
<http://schema.org/articleBody>
"\nHello everybody, in today's project, you will learn to make your own RFID-based solenoid door lock system using Arduino. You will learn to interface and control the solenoid lock with Arduino and RFID MF-RC522 module.\n\n\n\n\n\nRFID (Radio Frequency Identification) is a cheap and accessible technology. It can be used in many applications such as access control, security, asset tracking, person tracking, etc. You may have seen RFID door lock systems in hotels, offices, and many other places. Basically, they provide you a card and you have to just place the card near the RFID reader, within a second and the door will open. \n\n\n\nThis RFID Solenoid door lock can be easily made at home just following this tutorial. Previously, we have also used the same technology on our RFID and IoT based projects.\n\n\n\n\n\n\n\nHere in this project, we are using Arduino and Relay to trigger the solenoid door lock. While RFID MF-RC522 is used to authenticate users so that your RFID tag acts as the key. If you place the wrong RFID card close to the RFID reader, a buzzer will beep to alert you about the wrong card.\n\n\n\n\n\n\n\nComponents Required\n\n\n\nThe following are the components required for RFID Based Contactless Door Lock Using Arduino.\n\n\n\nArduino UnoRFID-RC522 Module12v/9v Solenoid LockRelay ModuleRED and Green LEDBuzzerJumper Wires\n\n\n\nCircuit Diagram for RFID Solenoid Door lock using Arduino\n\n\n\nThe Circuit Diagram for&nbsp;RFID Based Solenoid Door lock using Arduino project&nbsp;is provided below. \n\n\n\nCircuit Diagram of RFID Based Solenoid Door Lock Using Arduino\n\n\n\nConnections between&nbsp;Arduino and RFID&nbsp;are given in the table below. The positive pin of the buzzer is connected to digital pin 2 of Arduino, and the GND pin is connected to the ground pin of Arduino. The solenoid lock is connected to Arduino through the relay module.\n\n\n\nRFID PinArduino Uno Pin&nbsp;&nbsp;SDADigital 10SCKDigital 13MOSIDigital 11MISODigital 12IRQUnconnectedGNDGNDRSTDigital 93.3V3.3V &nbsp;Relay PinArduino Uno Pin&nbsp;&nbsp;VccVccGNDGNDSinal3\n\n\n\nGreen LED Positive pin is connected to the digital pin 5 of Arduino and Negative pin to the GND. Similarly, RED LED Positive pin is interfaced with digital pin 4 and Negative pin to the GND.\n\n\n\nProgram Code\n\n\n\nLet's start coding by including all the required libraries. Here, this program only requires two libraries, one for SPI communication between Arduino and RFID, and the second for the RFID module. Both the libraries can be downloaded from the links provided below:\n\n\n\n\n\nDownload SPI.h Library\n\n\n\nDownload MFRC522.h Library\n\n\n\n\n\n//RFID Based Solenoid Door lock using Arduino\n//The IoT Projects https://www.youtube.com/c/TheIoTProjects\n//website:https://theiotprojects.com/\n\n#include &lt;SPI.h&gt;\n#include &lt;MFRC522.h&gt;\n \n#define SS_PIN 10\n#define RST_PIN 9\n#define LED_G 5 //define green LED pin\n#define LED_R 4 //define red LED\n#define RELAY 3 //relay pin\n#define BUZZER 2 //buzzer pin\n#define ACCESS_DELAY 2000\n#define DENIED_DELAY 1000\nMFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.\n \nvoid setup() \n{\n  Serial.begin(9600);   // Initiate a serial communication\n  SPI.begin();          // Initiate  SPI bus\n  mfrc522.PCD_Init();   // Initiate MFRC522\n  pinMode(LED_G, OUTPUT);\n  pinMode(LED_R, OUTPUT);\n  pinMode(RELAY, OUTPUT);\n  pinMode(BUZZER, OUTPUT);\n  noTone(BUZZER);\n  digitalWrite(RELAY, LOW);\n  Serial.println(\"Put your card to the reader...\");\n  Serial.println();\n\n}\nvoid loop() \n{\n  // Look for new cards\n  if ( ! mfrc522.PICC_IsNewCardPresent()) \n  {\n    return;\n  }\n  // Select one of the cards\n  if ( ! mfrc522.PICC_ReadCardSerial()) \n  {\n    return;\n  }\n  //Show UID on serial monitor\n  Serial.print(\"UID tag :\");\n  String content= \"\";\n  byte letter;\n  for (byte i = 0; i &lt; mfrc522.uid.size; i++) \n  {\n     Serial.print(mfrc522.uid.uidByte[i] &lt; 0x10 ? \" 0\" : \" \");\n     Serial.print(mfrc522.uid.uidByte[i], HEX);\n     content.concat(String(mfrc522.uid.uidByte[i] &lt; 0x10 ? \" 0\" : \" \"));\n     content.concat(String(mfrc522.uid.uidByte[i], HEX));\n  }\n  Serial.println();\n  Serial.print(\"Message : \");\n  content.toUpperCase();\n  if (content.substring(1) == \"83 23 38 BB\") //change here the UID of the card/cards that you want to give access\n  {\n    Serial.println(\"Authorized access\");\n    Serial.println();\n    delay(500);\n    digitalWrite(RELAY, HIGH);\n    digitalWrite(LED_G, HIGH);\n    delay(ACCESS_DELAY);\n    digitalWrite(RELAY, LOW);\n    digitalWrite(LED_G, LOW);\n  }\n \n else   {\n    Serial.println(\" Access denied\");\n    digitalWrite(LED_R, HIGH);\n    tone(BUZZER, 300);\n    delay(DENIED_DELAY);\n    digitalWrite(LED_R, LOW);\n    noTone(BUZZER);\n  }\n}\n\n\n\n\nNow copy the above Arduino Program code for RFID Based Solenoid Door lock using Arduino Project. Paste the copied code in your Arduino IDE. Here, you need to choose the correct Arduino Board and Its com port from Tools Menu. Basically, you need to compile the code before uploading the code to the Arduino to check any errors in the code.\n\n\n\nAfter the successful upload of the code, open the serial monitor at the baud rate of 9600. Scan your RFID card, Now copy the UID from the serial monitor and paste it to the program code in the following lines.\n\n\n\nif (content.substring(1) == \"83 23 38 BB\") //change here the UID of the card/cards that you want to give access\n\n\n\nVideo Demonstration of RFID Based Solenoid Door lock using Arduino\n\n\n\nHere, is a complete&nbsp;video demonstration of RFID Based Solenoid Door lock using the Arduino Project. I hope you will enjoy watching this video. If you did, then don’t forget to hit that&nbsp;like&nbsp;button. Share it with your friends and&nbsp;subscribe&nbsp;to this channel for more awesome content like this.\n\n\n\n\nhttps://youtu.be/5H9H4wCUw0c\n\n\n\n\nConclusion\n\n\n\nSo, that’s pretty much for this session. I hope you enjoyed making this&nbsp;RFID Based Solenoid Door lock using Arduino project. If you did, don’t forget to share this article with your friends. If you have any doubts regarding this weather station project then do let me know them in the comment section below.\n\n\n\nRecommended Readings:\n\n\n\n\n\n\n\nDigital Voltmeter using Arduino &amp; 16x2 LCDPassword Security Lock System Using Arduino &amp; KeypadIoT Weather Station using DHT11 SensorHow 555 IC works in Astable Operation &amp; Monostable OperationTemperature Controlled Home Automation using ArduinoInternet Clock Using NodeMCU ESP8266 and 16×2 LCD without RTC ModuleFire Security System using Arduino &amp; Flame SensorDual Axis Solar Tracker Arduino Project Using LDR &amp; Servo MotorsInterfacing DHT11 Humidity and Temperature Sensor with Arduino &amp; LCDIoT Based Patient Health Monitoring System Using ESP8266/ESP32 Web ServerIoT based Fire Detector &amp; Automatic Extinguisher using NodeMCUTop 10 Coolest IoT Devices of 2020BME280 Based Mini Weather Station using ESP8266/ESP32Home Automation with MIT App Inventor and ESP8266Interface LDR Photo Resistor to Arduino and Control LEDs\n"
<https://theiotprojects.com/rfid-based-solenoid-door-lock-using-arduino/>