





Welcome

About The Project

Project Structure
This project is a simple RFID smart lock using an Arduino as the pillar and a few components.
The technology behind this project is used all over the world. RFID identifies data stored on a chip in a card and compares them to a list of tags that have already been scanned. The software used to enable the tag will be specified to ensure that only the specified tag works.
we will also create a simple LED readout to tell us what is happening in the system.
Finally, we will add a solenoid to act as the lock, and a N-type MOSFET to safely trigger it on and off using our Arduino.
I USED THESE COMPONENTS
-
Arduino uno board
-
12v power supply
-
220-ohm resistors - 3
-
10kohm resistor - 1
-
Logic-level N channel Mosfet
-
MFRC522 module with at least two cards/fobs to read.
-
Red, blue, and green LEDs
-
12v Solenoid
-
Breadboard and jumper wires
MFRC522 MODULE SETUP
​
MFRC522 MODULE CODE
#include <SPI.h>
#include <RFID.h>
#define SS_PIN 10
#define RST_PIN 9
RFID rfid(SS_PIN, RST_PIN);
String rfidCard;
void setup() {
Serial.begin(9600);
Serial.println("Starting the RFID Reader...");
SPI.begin();
rfid.init();
pinMode(8, OUTPUT);
}
void loop() {
if (rfid.isCard()) {
if (rfid.readCardSerial()) {
rfidCard = String(rfid.serNum[0]) + " " + String(rfid.serNum[1]) + " " + String(rfid.serNum[2]) + " " + String(rfid.serNum[3]);
Serial.println(rfidCard);
if (rfidCard == "160 188 45 34") {
Serial.println("Access Granted!");
digitalWrite(8, HIGH);
delay(100);
digitalWrite(8, LOW);
delay(100);
digitalWrite(8, HIGH);
delay(100);
digitalWrite(8, LOW);
delay(100);
digitalWrite(8, HIGH);
delay(100);
digitalWrite(8, LOW);
delay(100);
} else {
Serial.println("Access Denied!");
digitalWrite(8, HIGH);
delay(2000);
digitalWrite(8, LOW);
}
}
rfid.halt();
}
}
Connect the Arduino board to my computer device to run the code on the MFRC522 MODULE
We have two key tags for the Module one of which was specified. Access will only be granted to the tag specified in the code
​
​
Test results:
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
CONNECTING THE LEDS TO THE ARDUINO BOARD
-
The LEDS are connected to pins 2, 3, and 4 and to the ground rail through 220-ohm resistors.
CONNECTING THE 12v Solenoid TO THE ARDUINO BOARD
-
Connect the positive terminal of the 12v Solenoid, and the VIN of the Arduino to the 12v rail on the breadboard.
CONNECTING THE N-Type Mosfet To The Breadboard
-
Our MOSFET's gate leg connects to pin 5, and to ground through a 10k ohm resistor. The drain leg (middle) connects to the negative terminal of our 12v solenoid, and the source leg connects to the ground rail.
The Full Setup
When the circuit is functional, the Blue LED should light up to show that the device is operational. Holding the master card over the reader puts it in admin mode should cause all three LEDs to flash. While they are flashing you can hold other cards or fobs over the reader to add or take away access rights. It will flash for giving access, and blue for taking away. Use the master card again to exit admin mode.
Now when you hold a card or fob with access up to the reader it should flash red and open the lock. If it flashes yellow, access has been denied!
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
Image Credit: Annmarie Young via Shutterstock.com



