Security Vault System

This security system will walk through three levels, starting with unique pin code pressed on the touch pad. Next, the user is asked to tap his or her ID card towards the RFID reader. The third level is the voice recognition of the user's unique voice pattern. However, this feature is not implemented for now. After all levels are cleared, the user will have access to his or her classified information.

/media/uploads/markace1246/_scaled_pic1.jpg /media/uploads/markace1246/_scaled_pic2.jpg

<<bold>>Demo code for the Security Vault System<</bold>>

#include <mbed.h>
#include <string>
#include <list>
#include <mpr121.h>
#include "NokiaLCD.h"
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <iostream>
#include "ID12RFID.h"


NokiaLCD lcd(p5, p7, p8, p9, NokiaLCD::LCD6610); // mosi, sclk, cs, rst, type
Serial device(p13, p14);

DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);



int Nums[7] = {0,0,0,0,0,0,0};
int counter = 0;
int count2 = 0;
int IDRCode = 0;

// Create the interrupt receiver object on pin 26
InterruptIn interrupt(p26);

// Setup the Serial to the PC for debugging
Serial pc(USBTX, USBRX);

// Setup the i2c bus on pins 28 and 27
I2C i2c(p28, p27);

// Setup the Mpr121:
// constructor(i2c object, i2c address of the mpr121)
Mpr121 mpr121(&i2c, Mpr121::ADD_VSS);

ID12RFID rfid(p10); // uart rx

void fallInterrupt() {
int key_code=0;
    int i=0;
    int value=mpr121.read(0x00);
    value +=mpr121.read(0x01)<<8;
    // LED demo mod by J. Hamblen
    //pc.printf("MPR value: %x \r\n", value);
    i=0;
    // puts key number out to LEDs for demo
    for (i=0; i<12; i++) 
    {
        if (((value>>i)&0x01)==1) 
        {
            key_code=i;
            //st.append();
            lcd.printf("%d", i);
            if(counter < 7)
            {
                Nums[counter] = i;
                counter++;
            }
        }
    }
    led4=key_code & 0x01;
    led3=(key_code>>1) & 0x01;
    led2=(key_code>>2) & 0x01;
    led1=(key_code>>3) & 0x01;
}


void speak(int num) 
{
    // Send Play Sound command
    device.putc('w');
    // small delay is needed between characters
    wait(.001);
    // Sound table index
    device.putc('A' + num/32);
    wait(.001);
    device.putc('A' + num%32);
    wait(.001);
    // max volume
    device.putc('P');
    // Wait for response of 'o' as playback ends
    while (device.getc()!='o') {}
    wait(.25);
}


void IntruderAlert()
{
   

  while(1)
  {
    lcd.cls();
     wait(1);
    lcd.fill(10, 30, 10, 70, 0xFF0000);
    lcd.fill(110, 30, 10, 70, 0xFF0000);
   lcd.locate(4,7); 
   lcd.printf("Intruder");
   lcd.locate(5,8);
   lcd.printf("Alert");
  
   
    lcd.fill(10, 105, 10, 10, 0xFF0000);
    lcd.fill(110, 105, 10, 10, 0xFF0000);
    speak(0);
    wait(1);
  }
}




void Cleared()
{
   

 
    lcd.cls();
    
    lcd.fill(20, 40, 100, 7, 0x00FF00);
    lcd.fill(20, 80, 100, 7, 0x00FF00);
    lcd.locate(4,7); 
    lcd.printf("Cleared");
    lcd.locate(3,8);
    lcd.printf("for Access");
  
    lcd.fill(110, 40, 10, 40, 0x00FF00);
    lcd.fill(10, 40, 10, 47, 0x00FF00);
    wait(3);

}


void Level1()
{
   

 
    lcd.cls();
    
    lcd.fill(20, 40, 100, 7, 0x0000FF);
    lcd.fill(20, 80, 100, 7, 0x0000FF);
    lcd.locate(4,7); 
    lcd.printf("Level 1");
    lcd.locate(4,8);
    lcd.printf("Cleared");
  
    lcd.fill(110, 40, 10, 40, 0x0000FF);
    lcd.fill(10, 40, 10, 47, 0x0000FF);
    //wait(3);

}

void Level2()
{
   

 
    lcd.cls();
    
    lcd.fill(20, 40, 100, 7, 0xFFFF00);
    lcd.fill(20, 80, 100, 7, 0xFFFF00);
    lcd.locate(4,7); 
    lcd.printf("Level 2");
    lcd.locate(4,8);
    lcd.printf("Cleared");
  
    lcd.fill(110, 40, 10, 40, 0xFFFF00);
    lcd.fill(10, 40, 10, 47, 0xFFFF00);
    //wait(3);

}


void Level3()
{
   

 
    lcd.cls();
    
    lcd.fill(20, 40, 100, 7, 0x00FF00);
    lcd.fill(20, 80, 100, 7, 0x00FF00);
    lcd.locate(4,7); 
    lcd.printf("Level 3");
    lcd.locate(4,8);
    lcd.printf("Cleared");
  
    lcd.fill(110, 40, 10, 40, 0x00FF00);
    lcd.fill(10, 40, 10, 47, 0x00FF00);
    //wait(3);

}


void CardReader()
{
   

 
    lcd.cls();
    
    //lcd.fill(20, 40, 100, 7, 0x00FF00);
    //lcd.fill(20, 80, 100, 7, 0x00FF00);
    lcd.locate(2,7); 
    lcd.printf("Please Tap");
    lcd.locate(2,8);
    lcd.printf("Access Card");
  
    //lcd.fill(110, 40, 10, 40, 0x00FF00);
    //lcd.fill(10, 40, 10, 47, 0x00FF00);
    wait(3);

}

void Clearance()
{
   
    lcd.cls();
    lcd.background(0x0000FF);    
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    wait(.2);
    lcd.printf("AAAAAAAAAAAAAAAA");
    
    wait(2);
    
    lcd.cls();
    wait(1.5);
    
    
    lcd.locate(4,1); 
    lcd.printf("SWISS Bank");
    wait(.5);
    lcd.locate(5,2);
    lcd.printf("Account");
    wait(.5);
    lcd.locate(2,3);
    lcd.printf("$10,000,000");
    wait(.5);
    lcd.locate(0,5);
    lcd.printf("SSN: 258-36-3849");
    wait(.5);
    lcd.locate(4,7);
    lcd.printf("CIA Alias");
    wait(.5);
    lcd.locate(4,8);
    lcd.printf("Mark Slade");
    wait(.5);
    lcd.locate(3,10);
    lcd.printf("TOP SECRET");
    wait(.5);
    lcd.locate(3,11);
    lcd.printf("CLEARANCE");
    wait(.5);
    lcd.locate(2,13);
    lcd.printf("KILL TARGET:");
    wait(.5);
    lcd.locate(1,14);
    lcd.printf("Vinny Jabroni");
    wait(.5);
    
    wait(3);






}




int main() 
{
  bool test1 = true; 
  bool test2 = false;
  interrupt.fall(&fallInterrupt);
  interrupt.mode(PullUp);

  lcd.cls();
  lcd.locate(5,6);
  lcd.printf("Welcome");
  lcd.locate(4,7);
  lcd.printf("to the GT");
  lcd.locate(1,8);  
  lcd.printf("Security Vault");
  //Play welcome sound  
  speak(6);
  wait(.5);
  lcd.cls(); 
  
  lcd.locate(1,6);
  lcd.printf("Enter Code Now");
  lcd.locate(0,9);
  lcd.printf("________________");
  lcd.locate(4,8);
  speak(5);
  
  //Play EnterCode sound
  //wait(5);
  //lcd.cls();
  
  //IntruderAlert();
  //Level1();
  //Level2();
  //Level3();
  //Cleared();
  //CardReader();
  
  //wait(10);
  
  while (1) 
  {
    if(counter == 7 && test1)
    {
       //lcd.locate(0,5);
       if(Nums[0] == 5 && Nums[1] == 5 && Nums[2] == 5 && Nums[3] == 1 && Nums[4] == 2 && Nums[5] == 3 && Nums[6] == 4)
       {
         
        lcd.cls();
        Level1();
        speak(4);
        speak(1);
        wait(2);
       }
       else
       {
        IntruderAlert();
       
       }

       //Level One Cleared sound
       //wait(4);
       
       /* 
        for(int b = 0; b < 7; b++)
        {
            lcd.printf("%d", Nums[b]);
        }
        */
        test1 = false;
        
        //break;
        //break;
    }
        //break;
        if(test1 == false && count2 < 1)
        {
            CardReader();
            count2+=2;
        }
        
        
        if(rfid.readable() && test1 == false)
        {
            IDRCode = rfid.read();
            
            //printf("RFID Tag number : %d\n", rfid.read());
            /*
            lcd.cls();
            lcd.locate(0,3);
            lcd.printf("%d", IDRCode);             
            wait(5);
            */
            test2 = true;
            
        }
        
        if(test2 == true)
        {
            
             if(IDRCode != 70612323)
            {
                IntruderAlert();
            }
            
        Level2();
        speak(4);
        speak(2);
        wait(1);
        break;
        }
        
           
  }

 

   
lcd.cls();
lcd.locate(3,6);
lcd.printf("Please Say");
lcd.locate(4,7);
lcd.printf("Command");
    wait(3);
    
    Level3();
    speak(4);
    speak(3);
    wait(2);
    Cleared();
    
Clearance();    


}

Wiring

Here are the connections for the demo code: mbed Touch Keypad

Gnd => Gnd

p9 => SDA

p10 => SCL

p26 => IRQ

Vout(3.3V) => Vcc

The I2C pullups on SDA and SCL are not provided on the touch keypad board, so add two 4.7K ohm pullups to 3.3V to the circuit. The other breakout board with the MPR121 only, has the pullups on the board.

LCD wiring

/media/uploads/markace1246/_scaled_mobilelcdschematic1.png

RFID wiring

/media/uploads/markace1246/_scaled_rfidschematic.png

Wire connections from EasyVR to mbed

mbed EasyVR wire color

gnd => gnd => black

VU => Vcc => red

RX(14) => ETX => white

TX(13) => ERX => blue


1 comment on Security Vault System:

12 Oct 2011

Please log in to post comments.