A recommended modification of the inter locking of cockpit door locking systems by implementing a modified digital logic system using microcontroller board. After the twin tower crash known as the 9/11 in the year 2001, the safety of the civil aircrafts were put into great consideration. This led to the development of a sophisticated cockpit door lock system ,later this year on March 24th the co-pilot Andreas Lubitz of the German wings flight deliberately locked the flight captain out of the cockpit and crashed into the French Alps Mountain .here, main focus is on the modification of the cockpit door locking logic in such way that we can avoid the above mentioned accidence
It is achieved by Keeping the current working principle intact and an additional operation mode which is activated under conditions where "RULE OF TWO" is not been followed is used. Also biometric finger print locking and lockdown mechanisms and matrix key pad are being used taking security of main concern.
It is achieved by Keeping the current working principle intact and an additional operation mode which is activated under conditions where "RULE OF TWO" is not been followed is used. Also biometric finger print locking and lockdown mechanisms and matrix key pad are being used taking security of main concern.
Circuit Diagram
Code
// felix m philip
// Jawaharlal College Of Engineering And Technology.
#include "Adafruit_Fingerprint_Due.h"
#include <Keypad.h>
#include<LiquidCrystal.h>
#include <Password.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
Adafruit_Fingerprint_Due finger = Adafruit_Fingerprint_Due();
#define adminpass 1234
char* pp1 = "1001";
char* pp2 = "1002";
char* cpp1 = "1003";
char* cpp2 = "1004";
char* cp = "1005";
Password password = Password(pp1);
Password password2 = Password(cpp1);
Password password3 = Password(cp);
Password password4 = Password(pp2);
Password password5 = Password(cpp2);
int getFingerprintIDez()
{ a:
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK)
return -1;
p = finger.image2Tz();
if (p != FINGERPRINT_OK)
return -1;
p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK)
return -1;
return finger.fingerID;
}
int pcheck = 0, pcheck2 = 0, pcheck3 = 0, pcheck4 = 0, pcheck5 = 0, servostate = 0, lockstate = 0, unlockstate = 0;
unsigned int passac = 0, fhrs = 0, fmins = 0, fsecs = 0;
long int flightms, flhrcheck, tnow, tcheck, ttnow,timep,times;
char accs;
const int swunlock = 30, swnorm = 31, swlock = 32, servo1 = 33, sbuzzer = 27;
int secondarystate = 0;
const int sstate = 26, hfors = 23;
const byte ROWS = 4;
const byte COLS = 4;
char hexaKeys[ROWS] [COLS] = {
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {A0, A1, A2, A3};
byte colPins[COLS] = {A4, A5, 13, 10};
Keypad keypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
void setup()
{
pinMode(hfors, OUTPUT);
pinMode(sstate, INPUT);
pinMode(swunlock, INPUT);
pinMode(swlock, INPUT);
pinMode(swnorm, OUTPUT);
pinMode(servo1, OUTPUT);
pinMode(sbuzzer, OUTPUT);
keypad.addEventListener(keypadEvent);
lcd.begin(16, 2);
lcd.clear();
Serial.begin(9600);
Serial.println("fingertest");
finger.begin(57600);
if (finger.verifyPassword())
{
Serial.println("Found fingerprint sensor!");
}
else
{
Serial.println("Did not find fingerprint sensor :(");
while (1);
}
Serial.println("Waiting for Admin...");
a:
getFingerprintIDez();
if (getFingerprintIDez() == 55)
{
Serial.println("Admin Finger scan successful \n Enter admin password :");
b: passac = 0;
while (true)
{
while (!Serial.available());
accs = Serial.read();
if (!isdigit(accs))
break;
passac *= 10;
passac += accs - '0';
}
if (passac == adminpass)
{
Serial.println("Finger scan and password matched, admin access granted...");
otherdatacrew();
lcd.clear();
lcd.print("Pilot scan");
delay(2000);
c: getFingerprintIDez();
if (getFingerprintIDez() == 65)
{
lcd.clear();
lcd.print("ENTER CODE");
delay(2000);
d: lcd.clear();
for (int i = 0; i < 5; i++)
{
keypad.waitForKey();
keypad.getKey();
}
if (pcheck == 1)
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("Passkey Accepted");
delay(2000);
lcd.clear();
lcd.print("Copilot scan");
delay(2000);
e: lcd.clear();
getFingerprintIDez();
if (getFingerprintIDez() == 66)
{
lcd.clear();
lcd.print("ENTER CODE");
delay(2000);
f: lcd.clear();
for (int i = 0; i < 5; i++)
{
keypad.waitForKey();
keypad.getKey();
}
if (pcheck2 == 1)
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("Passkey Accepted");
delay(2000);
lcd.clear();
lcd.print("Crew scan");
delay(2000);
g: lcd.clear();
getFingerprintIDez();
if (getFingerprintIDez() == 67)
{
lcd.clear();
lcd.print("ENTER CODE");
delay(2000);
h: lcd.clear();
password = Password(cp);
for (int i = 0; i < 5; i++)
{
keypad.waitForKey();
keypad.getKey();
}
if (pcheck3 == 1)
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("Passkey Accepted");
delay(2000);
flhrcheck = millis();
digitalWrite(servo1, LOW);
delay(10000);
digitalWrite(servo1, HIGH);
} else {
goto h;
}
} else goto g;
} else {
goto f;
}
} else goto e;
} else {
goto d;
}
} else goto c;
} else goto b;
} else goto a;
}
void loop()
{ digitalWrite(swnorm, HIGH);
unlockstate = digitalRead(swunlock);
lockstate = digitalRead(swlock);
if (unlockstate == HIGH)
{
lcd.clear();
lcd.print("open");
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
}
else if (lockstate == HIGH)
{ lcd.clear();
lcd.print("LOCKED");
int f = 0;
times = millis();
timep = millis();
do
{
unlockstate = digitalRead(swunlock);
if (unlockstate == HIGH)
{
lcd.clear();
lcd.print("open lock overide");
f = 1;
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
} if (f == 1) break; timep = millis();
} while ((timep - times) < 60000);
}
lcd.clear();
lcd.print("NORM");
getFingerprintIDez();
if (getFingerprintIDez() == 67)
{ lcd.clear(); lcd.print("CREW SCAN"); delay(2000);
g: lcd.clear();
lcd.print("ENTER CODE");
delay(2000);
for (int i = 0; i < 5; i++)
{ keypad.waitForKey();
keypad.getKey();
}
if (pcheck3 == 1)
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("Passkey Accepted");
delay(2000);
tnow = millis();
tcheck = tnow;
do
{
if (digitalRead(swunlock) == HIGH)
{
digitalWrite(servo1, LOW);
delay(10000);
digitalWrite(servo1, HIGH);
lcd.clear();
lcd.print("open");
break;
}
else if (digitalRead(swlock) == HIGH)
{
lcd.clear();
lcd.print("LOCKED");
delay(30000);
break;
} else
tcheck = millis();
} while ((tcheck - tnow) < 31000);
if ((tcheck - tnow) >= 31000)
{
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
}
} else goto g;
}
int k, i, secflag = 0;
digitalWrite(hfors, HIGH);
secondarystate = digitalRead(sstate);
if (secondarystate == HIGH)
{
lcd.clear();
lcd.print("open Sssss");
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
lcd.clear();
lcd.print("Sec Mode");
delay(2000);
do
{ digitalWrite(swnorm, HIGH);
unlockstate = digitalRead(swunlock);
lockstate = digitalRead(swlock);
if (unlockstate == HIGH)
{
lcd.clear();
lcd.print("open");
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
}
else if (lockstate == HIGH)
{ lcd.clear();
lcd.print("LOCKED");
int f = 0, times = millis();
int timep = millis();
do
{
unlockstate = digitalRead(swunlock);
if (unlockstate == HIGH)
{
lcd.clear();
lcd.print("open lock overide");
f = 1;
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
} if (f == 1) break;
l:
getFingerprintIDez();
if ((getFingerprintIDez() == 65) || (getFingerprintIDez() == 66))
{ lcd.clear(); lcd.print("P or C SCAN"); delay(2000);
lcd.clear();
lcd.print("ENTER CODE");
delay(2000);
for (int i = 0; i < 5; i++)
{ keypad.waitForKey();
keypad.getKey();
}
if ((pcheck == 1) || (pcheck2 == 1))
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("Passkey Accepted");
delay(2000);
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
secflag++;
return;
}
else if ((pcheck4 == 1) || (pcheck5 == 1))
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("LOCKDOWN S");
do
{
ttnow = millis();
} while ((ttnow - flhrcheck) == flightms);
} timep = millis();
} else if ((timep - times) < 60000) goto l;
timep = millis();
} while ((timep - times) < 60000);
}
lcd.clear();
lcd.print("NORM S");
getFingerprintIDez();
if (getFingerprintIDez() == 67)
{ lcd.clear(); lcd.print("CREW SCAN"); delay(2000);
n: lcd.clear();
lcd.print("ENTER CODE");
delay(2000);
for (int i = 0; i < 5; i++)
{ keypad.waitForKey();
keypad.getKey();
}
if (pcheck3 == 1)
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("Passkey Accepted");
delay(2000);
tnow = millis();
tcheck = tnow;
do
{
if (digitalRead(swunlock) == HIGH)
{
digitalWrite(servo1, LOW);
delay(10000);
digitalWrite(servo1, HIGH);
lcd.clear();
lcd.print("open");
break;
}
else if (digitalRead(swlock) == HIGH)
{
lcd.clear();
lcd.print("LOCKED");
delay(30000);
break;
} else
tcheck = millis();
} while ((tcheck - tnow) < 31000);
if ((tcheck - tnow) >= 31000)
{
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
}
} else goto n;
}
else if ((getFingerprintIDez() == 65) || (getFingerprintIDez() == 66))
{ lcd.clear(); lcd.print("P or C SCAN"); delay(2000);
lcd.clear();
lcd.print("ENTER CODE");
delay(2000);
for (int i = 0; i < 5; i++)
{ keypad.waitForKey();
keypad.getKey();
}
if ((pcheck == 1) || (pcheck2 == 1))
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("Passkey Accepted");
delay(2000);
digitalWrite(servo1, LOW);
delay(5000);
digitalWrite(servo1, HIGH);
secflag++;
return;
}
else if ((pcheck4 == 1) || (pcheck5 == 1))
{
pcheck = 0;
pcheck2 = 0;
pcheck3 = 0;
pcheck4 = 0;
pcheck5 = 0;
lcd.clear();
lcd.print("LOCKDOWN S");
do
{
ttnow = millis();
} while ((ttnow - flhrcheck) == flightms);
} timep = millis();
}
} while (secflag == 0);
}
}
void otherdatacrew()
{
int id, j, flag = 0;
Serial.println("Waiting for Pilot...");
b:
getFingerprintIDez();
if (getFingerprintIDez() == 65)
{
flag++;
Serial.println("pilot access code : ");
Serial.println(pp1);
Serial.println("pilot emergency code : ");
Serial.println(pp2);
delay(5000);
Serial.println("Waiting for CoPilot...");
g:
getFingerprintIDez();
if (getFingerprintIDez() == 66)
{
flag++;
Serial.println("Copilot access code : ");
Serial.println(cpp1);
Serial.println("Copilot emergency code : ");
Serial.println(cpp2);
delay(5000);
Serial.println("Waiting for Crew...");
f:
getFingerprintIDez();
if (getFingerprintIDez() == 67)
{
flag++;
Serial.println("crew access code :");
Serial.println(cp);
}
else goto f;
} else goto g;
Serial.println("Flight duration data");
Serial.println("Hours :");
fhrs = timetaker();
Serial.println("Minutes :");
fmins = timetaker();
Serial.println("Seconds :");
fsecs = timetaker();
Serial.println(fhrs);
Serial.println(fmins);
Serial.println(fsecs);
flightms = (fhrs * 3600000) + (fmins * 60000) + (fsecs * 1000);
Serial.println("Time in ms :");
Serial.println(flightms);
flightms += 3600000;
}
else
{
goto b;
}
}
unsigned int timetaker()
{
unsigned int fltime = 0;
char tch;
while (true)
{
while (!Serial.available());
tch = Serial.read();
if (!isdigit(tch))
break;
fltime *= 10;
fltime += tch - '0';
}
return fltime;
}
void keypadEvent(KeypadEvent eKey)
{
switch (keypad.getState())
{
case PRESSED:
lcd.print(eKey);
switch (eKey)
{
case '#':
guessPassword();
guessPassword2();
guessPassword3();
guessPassword4();
guessPassword5();
break;
default:
password.append(eKey);
password2.append(eKey);
password3.append(eKey);
password4.append(eKey);
password5.append(eKey);
}
}
}
void guessPassword() {
if (password.evaluate())
{
pcheck = 1;
password.reset();
}
else password.reset();
}
void guessPassword2() {
if (password2.evaluate())
{
pcheck2 = 1;
password2.reset();
}
else password2.reset();
}
void guessPassword3() {
if (password3.evaluate())
{
pcheck3 = 1;
password3.reset();
}
else password3.reset();
}
void guessPassword4() {
if (password4.evaluate())
{
pcheck4 = 1;
password4.reset();
}
else password4.reset();
}
void guessPassword5() {
if (password5.evaluate())
{
pcheck5 = 1;
password5.reset();
}
else password5.reset();
}
No comments:
Post a Comment