Things used in this project

Schematics

RFID Access Controller
This is a scematic of main system. This office consisted of an external door and an internal door. S1 and S2 are two reed swtiches installed with extermal door so that it informs access controller to open internal door once RFID access is granted.
This schematic has covers failure plan where for any issues with system, the guard can insert special fuse F1 and enable the manual buttons S3 and S4 to deactivate the lock.
Untitled sketch schem fm7c8qkksa

Code

RFID Access ControllerC/C++
This code is built to read the RFID/NFC card and then see if the visitor is authorised or no. For an authorised person, it will activate a relay that will deactivate the lock to open the door.
#include <Wire.h>
#include <SPI.h>
#include <LiquidCrystal.h>
#include <Adafruit_PN532.h>

#define PN532_SCK  (2)
#define PN532_MOSI (3)
#define PN532_SS   (4)
#define PN532_MISO (5)

Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup(void) {
    lcd.begin(16, 2);
    nfc.begin();
    nfc.SAMConfig();
    pinMode(2,OUTPUT);
    pinMode(3,OUTPUT);
    pinMode(4,OUTPUT);
    pinMode(5,OUTPUT);
    digitalWrite(2,LOW);
    digitalWrite(3,LOW);
    digitalWrite(4,LOW);
    digitalWrite(5,LOW);
}

void loop(void) {
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
  uint8_t uidLength; 
    digitalWrite(2,LOW);
    digitalWrite(3,LOW);
    digitalWrite(4,LOW);
    digitalWrite(5,LOW);
    success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
    if (success)
    {
        NfcTag tag = nfc.read();
        NdefMessage message = tag.getNdefMessage();
        int recordCount = message.getRecordCount();
        for (int i = 0; i < recordCount; i++)
        {
          NdefRecord record = message.getRecord(i);
          int payloadLength = record.getPayloadLength();
          byte payload[payloadLength];
          record.getPayload(payload);
          String payloadAsString = "";
          for (int c = 1; c < payloadLength; c++) 
          {
            payloadAsString += (char)payload[c];
          }
          if (payloadAsString=="Zeeshan"){
            digitalWrite(2,LOW);
            digitalWrite(3,HIGH);
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print("Access Granted!");
          }
          else if (payloadAsString!="Zeeshan"){
            digitalWrite(4,LOW);
            digitalWrite(5,HIGH);
            lcd.clear();
            lcd.setCursor(0, 0);
            lcd.print("You Don't have Access!");  
          }
        }  
    }
    delay(1000);
}
RFID WriteC/C++
This code is prepared to make RFID cards for the visitors
#if 1
#include <SPI.h>
#include <PN532_SPI.h>
#include <PN532.h>
#include <NfcAdapter.h>

PN532_SPI pn532spi(SPI, 10);
NfcAdapter nfc = NfcAdapter(pn532spi);
#else

#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>

PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
#endif

void setup() {
      Serial.begin(9600);
      Serial.println("NDEF Writer");
      nfc.begin();
}

void loop() {
    Serial.println("\nPlace a formatted Mifare Classic or Ultralight NFC tag on the reader.");
    if (nfc.tagPresent()) {
        NdefMessage message = NdefMessage();
        message.addUriRecord("Zeeshan");

        bool success = nfc.write(message);
        if (success) {
          Serial.println("Success.");        
        } else {
          Serial.println("Write failed.");
        }
    }
    delay(5000);
}

Credits

Terminator 2 1200x873 pvbxjjqkvz
Muhammad Zeeshan Akram

creative and destructive design master. ability to use the brain waves for both construction and destruction

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Arduino 101 Packet Radio IMU
Intermediate
  • 499
  • 2

Packet Radio on your Arduino 101 - The Arduino 101 Orientation Visualizer redone with Packet Radio!

ArduRadio AlarmClock
Intermediate
  • 2,357
  • 2

Full instructions

Build an FM radio with alarm clock.

Cat Door with Pet Recognition
Intermediate
  • 4,732
  • 22

Full instructions

Use object detection to let your cat in and out of the house with a motion-activated pet door.

Arduino: Switching ON/OFF Appliances Using IR Remote
Intermediate
  • 297
  • 3

Press 'Power' to switch everything ON/OFF. Press '1' for the fan and '2' for the lights.

Simple Digital Voltmeter Circuit with PCB using ICL7107
Intermediate
  • 40
  • 1

Here I built a simple digital voltmeter circuit with a PCB using ICL7107.

Sending Data from PC to Another Using Arduino UNO
Intermediate
  • 426
  • 3

Full instructions

Using cheap 433 MHZ RF module to establish communication between my PC and Laptop, but displays information encrypted on text LCD.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login