Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino RFID-Controlled Solenoid Door Lock System

View and Edit Project In Cirkit DesignerImage of Arduino RFID-Controlled Solenoid Door Lock System

Circuit Documentation

Summary

This circuit is designed to control a 12V solenoid door lock using an RFID-RC522 module and an Arduino UNO. When an authorized RFID tag is detected, the relay is activated, unlocking the door. The door remains unlocked for 5 seconds before locking again.

Component List

  1. 12V Solenoid Lock

    • Description: A solenoid lock that operates on 12V.
    • Pins: VCC, GND
  2. RFID-RC522

    • Description: An RFID reader module that operates on 3.3V.
    • Pins: VCC (3.3V), RST, GND, IRQ, MISO, MOSI, SCK, SDA
  3. Arduino UNO

    • Description: A microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  4. 12V Single Channel Relay

    • Description: A relay module that can be controlled by a microcontroller to switch a 12V load.
    • Pins: NC, COM, NO, IN, GND, VCC
  5. 12V Power Supply

    • Description: A power supply that provides 12V DC.
    • Pins: +, -

Wiring Details

12V Solenoid Lock

RFID-RC522

Arduino UNO

12V Single Channel Relay

12V Power Supply

Code Documentation

Arduino UNO Code

/*
 * Solenoid Door Lock Control with RFID RC522
 *
 * This Arduino sketch controls a 12V solenoid door lock using an RFID-RC522 module.
 * When an authorized RFID tag is detected, the relay is activated, unlocking the door.
 * The door remains unlocked for 5 seconds before locking again.
 */

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
#define RELAY_PIN 2

MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
  Serial.begin(9600);
  SPI.begin();
  rfid.PCD_Init();
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, LOW); // Ensure relay is off initially
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    return;
  }

  // Assuming a specific UID for authorized access
  byte authorizedUID[] = {0xDE, 0xAD, 0xBE, 0xEF};
  if (memcmp(rfid.uid.uidByte, authorizedUID, rfid.uid.size) == 0) {
    digitalWrite(RELAY_PIN, HIGH); // Unlock door
    delay(5000); // Keep door unlocked for 5 seconds
    digitalWrite(RELAY_PIN, LOW); // Lock door
  }

  rfid.PICC_HaltA();
}

12V Single Channel Relay Code

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

12V Power Supply Code

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}