0% found this document useful (0 votes)
66 views11 pages

RFIDbasedsecuritysystem

The document describes an RFID based security system for an army base using Arduino. The system uses RFID cards and sensors to control access through a gate. When an authorized card is scanned, the gate servo motor opens if both entry and exit sensors are clear. Unauthorized access is denied and cards can be recharged through the keypad interface.

Uploaded by

techgirl3105
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views11 pages

RFIDbasedsecuritysystem

The document describes an RFID based security system for an army base using Arduino. The system uses RFID cards and sensors to control access through a gate. When an authorized card is scanned, the gate servo motor opens if both entry and exit sensors are clear. Unauthorized access is denied and cards can be recharged through the keypad interface.

Uploaded by

techgirl3105
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

RFID BASED SECURITY

SYSTEM
( A PROJECT BASED
ON ARMY DEFENSE
TECH )

TEAM – TITANS
MEMBERS –
1. SPRIHA SINGH
2. AGRIMA SINGH
3. ANANYA SINGH
4. SHIVA YADAV
5. ARADHY SINGH RAWAT
PRINCIPLE :
We have made this project for Army Cantt.
Every person in the army will have a Rfid card and
whenever an army person goes inside the gate. So when
the Rfid touches the card on the reader only then it will
open.Otherwise, the gate will remain closed, due to
which every person of the army will be monitored.
If a person goes to Army Cantt, the gate will not open
until he touches the registered card on the reader.In this
way the security of Army Cantt can be further improved.

MATERIALS REQUIRED –
1- Arduino UNO
2- RFID Card Reader
3- Two IR Sensor
4- Servo Motor
5- Male to Male Jumper Wires - 10
6- Male to Female Jumper Wires - 10
7- 5 volt, 2 Amp Adapter
8- Breadboard
CIRCUIT DIAGRAM –
CODE –
#include <SPI.h>
#include <MFRC522.h>
#include <OnewireKeypad.h>
#include <LiquidCrystal.h>
#include <Servo.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

Servo servo;
int servoPos = 0;

#define sensorPin1 A2
#define sensorPin2 A3

int senVal1 = 0;
int senVal2 = 0;

#define RST_PIN 8
#define SS_PIN 10

int card1Balance = 5000;


int card2Balance = 5000;

#define num 7
char Data[num];
byte data_count = 0;

String num1, num2, card, card2;


int a, b;
char Key;

bool recharge = true;

MFRC522 mfrc522(SS_PIN, RST_PIN);

int state = 0;

char KEYS[] = {
'1', '2', '3', 'A',
'4', '5', '6', 'B',
'7', '8', '9', 'C',
'*', '0', '#', 'D'
};

OnewireKeypad <Print, 16 > KP2(Serial, KEYS, 4, 4, A0, 4700, 1000, ExtremePrec );

void setup () {
lcd.begin(16, 2);
Serial.begin(9600);

servo.attach(9);

servo.write(30);

pinMode(sensorPin1, INPUT);
pinMode(sensorPin2, INPUT);

KP2.SetKeypadVoltage(5.0);

SPI.begin();
mfrc522.PCD_Init();

lcd.setCursor(0, 0);
lcd.print("Army Safety &");
lcd.setCursor(0, 1);
lcd.print("Security Project");
delay(3000);
lcd.clear();
}
void loop()
{

if (recharge == 0)
{
reCharge();
}
else
{
lcd.setCursor(0, 0);
lcd.print(" Welcome!!!");
sensorRead();
rfid();
KeyPad();
if (senVal1 == 0)
{
servoDown();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Vehicle detected");
delay(1000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Put your card to");
lcd.setCursor(0, 1);
lcd.print("the reader......");
delay(2000);
lcd.clear();

}
else if (senVal2 == 0 && state == 1)
{
servoUp();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Have a safe");
lcd.setCursor(0, 1);
lcd.print("journey");
delay(1000);
lcd.clear();
state = 0;
}
}
}

void servoDown()
{
servo.attach(9);
for (servoPos = 30; servoPos <= 120; servoPos += 1)
{
servo.write(servoPos);
delay(5);
}
}

void servoUp()
{
servo.attach(9);
for (servoPos = 120; servoPos >= 30; servoPos -= 1)
{
servo.write(servoPos);
delay(5);
}
}

void sensorRead()
{
senVal1 = digitalRead(sensorPin1);
senVal2 = digitalRead(sensorPin2);
}

void rfid()
{
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}

String content = "";


for (byte i = 0; i < mfrc522.uid.size; i++)
{
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
content.toUpperCase();

if (content.substring(1) == "03 8D F7 11")


{
if (card1Balance >= 500)
{
lcdPrint();
card1Balance = card1Balance - 500;

delay(2000);
lcd.clear();
state = 1;
}
else
{
card = content.substring(1);
LcdPrint();
lcd.setCursor(9, 1);
lcd.print(card1Balance);
lcd.print(" Tk");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Please Recharge");
delay(1000);
lcd.clear();
state = 0;
}
}
else if (content.substring(1) == "13 99 0B 0C")
{
if (card2Balance >= 500)
{
lcdPrint();
card2Balance = card2Balance - 500;

delay(2000);
lcd.clear();
state = 1;
}
else
{
card = content.substring(1);
LcdPrint();
lcd.setCursor(9, 1);
lcd.print(card2Balance);
lcd.print(" Tk");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Please Recharge");
lcd.clear();
delay(1000);
state = 0;
}
}

else {

lcd.setCursor(0, 0);
lcd.print("Unknown Vehicle");
lcd.setCursor(0, 1);
lcd.print("Access denied");
delay(1500);
lcd.clear();

}
}

void KeyPad()
{
byte KState = KP2.Key_State();

if (KState == PRESSED)
{
Key = KP2.Getkey();
if (Key)
{
if (Key == 'A')
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Recharging Mode.");
lcd.setCursor(0, 1);
lcd.print("................");
delay(1500);
lcd.clear();
recharge = 0;
}
}
}
}

void clearData()
{
while (data_count != 0)
{
Data[data_count--] = 0;
}
return;
}

void reCharge()
{

lcd.setCursor(0, 0);
lcd.print ("Enter the amount");
delay(1500);

byte KState = KP2.Key_State();

if (KState == PRESSED)
{
Key = KP2.Getkey();
if (Key)
{
if (Key == 'D')
{
if (card == "03 8D F7 11")
{
num1 = Data;
card1Balance = num1.toInt() + card1Balance;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("");
lcd.setCursor(0, 1);
lcd.print("");
lcd.print(" Tk");
delay(3000);
clearData();
lcd.clear();
recharge = 1;
}
else if (card == "13 99 0B 0C")
{
num2 = Data;
card2Balance = num2.toInt() + card2Balance;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Welcome");
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(9, 1);
lcd.print (card2Balance);
lcd.print(" Tk");
delay(3000);
clearData();
lcd.clear();
recharge = 1;
}
}
else
{
Data[data_count] = Key;
lcd.setCursor(data_count, 1);
lcd.print(Data[data_count]);
data_count++;
}
}
}
}
void lcdPrint()
{

lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Welcome ");
lcd.setCursor(0, 1);
lcd.print(" Comander Vijay ");
delay(1500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Welcome ");
lcd.setCursor(0, 1);
lcd.print(" ");
}

void LcdPrint()
{

lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Welcome");
lcd.setCursor(0, 1);
lcd.print(" ");
delay(1500);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("");
lcd.setCursor(0, 1);
lcd.print("");

You might also like