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

WiFi Messenger
Intermediate
  • 539
  • 10

Protip

Calling my son from his room using 2 ESP8266 modules, instead of shouting.

Smart Garden
Intermediate
  • 1,246
  • 12

Smart Garden is plant environmental monitoring system.

Pool Buddy
Intermediate
  • 577
  • 7

Work in progress

Monitor and log water quality (pH & ORP) and temperature from everywhere.

Intel Curie TinyTILE Dress: Accelerometer + Optical Fibers
Intermediate
  • 339
  • 10

Full instructions

A dress using Intel Curie accelerometer on TinyTILE and its small form factor to control colors of the optical fibers with arm movements.

Pre-Collision Assist with Pedestrian Detection - Honda Civic
Intermediate
  • 1,744
  • 20

Full instructions

Combine Walabot's RF radar with real-time hazard detection and classification from camera, powered by TensorFlow with YOLO approach.

MEGA BREAD - Atari Joystick Linking for Robotics Control
Intermediate
  • 323
  • 6

Work in progress

The oldie but goodie returns in the form of the infrared joystick set from an old Atari game system. These will control multiple things.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback