Arduino and ESP8266 RFID Door Lock System with WiFi Connectivity
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
The circuit in question is designed to integrate an Arduino UNO with an RFID-RC522 module, an ESP8266 ESP-12E WiFi module, a KY-019 Relay module, and a 12V solenoid lock, all powered by a 12V battery. The Arduino UNO serves as the central controller, interfacing with the RFID module for card reading capabilities and communicating with the ESP8266 for potential WiFi connectivity. The relay module is used to control the solenoid lock, which acts as an actuator in response to signals from the Arduino.
Component List
Arduino UNO
- Microcontroller board based on the ATmega328P
- Features digital I/O pins, analog input pins, and various power pins
- Provides SPI interface for communication with RFID module
- Serial communication with ESP8266 WiFi module
RFID-RC522
- RFID reader/writer module
- Operates at 13.56 MHz for NFC and RFID communication
- Interfaces with Arduino UNO via SPI
KY-019 Relay module 1 channel
- Single-channel relay module capable of controlling high power devices
- Controlled by Arduino UNO to switch the solenoid lock
12V solenoid lock
- Electromechanical lock powered by 12V
- Actuated by the relay module
ESP8266 ESP-12E WiFi Module
- WiFi module with capability for internet connectivity
- Communicates with Arduino UNO via serial (RX/TX)
Battery 12V
- Provides power to the solenoid lock and relay module
Wiring Details
Arduino UNO
GNDconnected to common ground3.3Vsupplies power to RFID-RC522 and ESP8266 modules5Vsupplies power to KY-019 Relay moduleD13connected toSCKof RFID-RC522D12connected toMISOof RFID-RC522D11connected toMOSIof RFID-RC522D10connected toSDAof RFID-RC522D9connected toRSTof RFID-RC522D7connected toSof KY-019 Relay moduleD1(TX) connected toRXDof ESP8266D0(RX) connected toTXDof ESP8266
RFID-RC522
VCC (3.3V)connected to3.3Vof Arduino UNORSTconnected toD9of Arduino UNOGNDconnected to common groundIRQnot connectedMISOconnected toD12of Arduino UNOMOSIconnected toD11of Arduino UNOSCKconnected toD13of Arduino UNOSDAconnected toD10of Arduino UNO
KY-019 Relay module 1 channel
Sconnected toD7of Arduino UNO5Vconnected to5Vof Arduino UNOGNDconnected to common groundNCnot connectedCOMconnected to+of 12V batteryNOconnected toVCCof 12V solenoid lock
12V solenoid lock
VCCconnected toNOof KY-019 Relay moduleGNDconnected to-of 12V battery
ESP8266 ESP-12E WiFi Module
GNDconnected to common groundVCCconnected to3.3Vof Arduino UNORXDconnected toD1(TX) of Arduino UNOTXDconnected toD0(RX) of Arduino UNO- Remaining pins not connected or used for other functions not specified in this documentation
Battery 12V
+connected toCOMof KY-019 Relay module-connected toGNDof 12V solenoid lock
Documented Code
Arduino UNO Code (sketch.ino)
#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
MFRC522 mfrc522(SS_PIN);
void setup() {
SPI.begin();
mfrc522.PCD_Init();
Serial.begin(9600);
}
void loop() {
if (mfrc522.PICC_IsNewCardPresent()) {
if (mfrc522.PICC_ReadCardSerial()) {
Serial.print("UID:");
for (byte i = 0; i < mfrc522.uid.size; i++) {
Serial.print(mfrc522.uid.uidByte[i], HEX);
}
Serial.println();
}
}
delay(500);
}
This code initializes the RFID-RC522 module and continuously checks for new RFID cards. When a card is detected, it reads the UID and prints it to the serial monitor. The SS_PIN is defined as pin 10, which corresponds to the SDA pin on the RFID-RC522 module. The SPI library is used for communication between the Arduino UNO and the RFID module.