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
12V Solenoid Lock
- Description: A solenoid lock that operates on 12V.
- Pins: VCC, GND
RFID-RC522
- Description: An RFID reader module that operates on 3.3V.
- Pins: VCC (3.3V), RST, GND, IRQ, MISO, MOSI, SCK, SDA
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
12V Single Channel Relay
- Description: A relay module that operates on 12V.
- Pins: NC, COM, NO, IN, GND, VCC
12V Power Supply
- Description: A power supply that provides 12V.
- Pins: +, -
Wiring Details
12V Solenoid Lock
- VCC connected to NC of 12V Single Channel Relay
- GND connected to + of 12V Power Supply
RFID-RC522
- VCC (3.3V) connected to 3.3V of Arduino UNO
- GND connected to GND of Arduino UNO
- MISO connected to D12 of Arduino UNO
- MOSI connected to D11 of Arduino UNO
- SCK connected to D13 of Arduino UNO
- SDA connected to D10 of Arduino UNO
Arduino UNO
- 3.3V connected to VCC (3.3V) of RFID-RC522
- GND connected to GND of RFID-RC522
- D12 connected to MISO of RFID-RC522
- D11 connected to MOSI of RFID-RC522
- D13 connected to SCK of RFID-RC522
- D10 connected to SDA of RFID-RC522
- 5V connected to VCC of 12V Single Channel Relay
- GND connected to GND of 12V Single Channel Relay
- D2 connected to IN of 12V Single Channel Relay
12V Single Channel Relay
- NC connected to VCC of 12V Solenoid Lock
- COM connected to - of 12V Power Supply
- VCC connected to 5V of Arduino UNO
- GND connected to GND of Arduino UNO
- IN connected to D2 of Arduino UNO
12V Power Supply
- + connected to GND of 12V Solenoid Lock
- - connected to COM of 12V Single Channel Relay
Documented Code
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:
}
This documentation provides a comprehensive overview of the circuit, including a summary, component list, wiring details, and the code used in the microcontroller.
