Monday, January 30, 2012

RFID based Secured access system using 8051 microcontroller (AT89C51)

Posted by Anonymous at 9:40 PM 0 Comments
This is a very useful application of RFID (Radio-frequency identification) and is very commonly used in institutes, offices, homes and so on. An RFID system consists of a reader device and a transponder. A transponder or tag has a unique serial number which is identified by the reader. Here RFID has been interfaced with AT89C51 to provide secured access. The relevant messages are also displayed on a 16x2 LCD. The free source code for the program is available in C.
RFID based Secured access system using 8051 microcontroller (AT89C51)
DESCRIBTION(click here)
  • Low frequency RFID works on the principle of radio waves and at the frequency of 125 KHz. There is a coil inside the RFID tag and when it is influenced by magnetic field, it sends an identity code to a device for further processing. (For more details, refer interfacing RFID with AT89C51).

    The RFID tag is used as an identity for a particular user. If the identity (serial number of the tag) of the user is matched with the one already stored in this system, he gets immediate access through it. This RFID based secured access system also has many additional features. For example, a new user can register himself with the system. A registered user can also withdraw his entry from the system. These features can be accessed by pressing a tactile switch connected to the microcontroller.

    In beginning, the user is prompted to scan his tag or ID. The serial code of the tag is identified by the reader module and is sent to AT89C51 for checking. If the ID is matched by the microcontroller, the user gets the access. On the contrary, if the tag is not identified, a message (‘Wrong ID’) is displayed on LCD screen.

    A new user needs to press the switch to register after which his identity is verified twice with RFID tag. The new record is stored by the microcontroller to grant future access. The system also shows ‘Error’ if the tags do not match during verification. An existing user can delete his record by pressing the same switch. Again the verification is carried out and the user is deleted if the IDs match. If a different tag is scanned through the reader, LCD displays ‘you have shown different ID’.

    When an RFID tag comes in this range, the reader detects it and sends a unique code of the tag serially. This serial code, consisting of 12 bytes, is received by the microcontroller. This code is treated as an ID for the user and is stored as an array in the microcontroller. If the ID is matched with this code, the user is granted access though the system. For more details on working and connections of the circuit, refer RFID interfacing through serial interrupt.

CODE(click here)
  • 
    //Program for RFID based Secured access system using 8051 microcontroller (AT89C51)
    
    #include<reg51.h>
    
    sfr lcd_data_pin=0xA0; //P2 port
    
    sbit rs=P1^0; 
    
    sbit rw=P1^1; 
    
    sbit en=P1^2; 
    
    sbit new_user=P1^3;
    
    unsigned char card_id[12],index=0,key1=0,flag0=0,flag1=0,flag2=0,flag3=0;
    
    unsigned char card_mem[6][12];   //={/*'2','6','0','0','9','3','6','C','B','2','6','B',*/'2','6','0','0','9','1','1','D','D','B','7','1','2','6','0','0','9','3','6','F','7','2','A','8','0','F','0','0','2','D','D','7','D','0','2','5'};
    
    unsigned char current_byte = 0;
    
    void display();
    
    void memory();
    
    
    
    void delay(unsigned int count) //Function to provide time delay
    
    {
    
      int i,j;
    
      for(i=0;i<count;i++)
    
      for(j=0;j<1275;j++);
    
    }
    
    
    
    void lcd_command(unsigned char comm)   //Lcd command funtion
    
    {
    
      lcd_data_pin=comm;
    
      en=1;
    
      rs=0;
    
      rw=0;
    
      delay(1);
    
      en=0;
    
    }
    
    
    
    void lcd_data(unsigned char disp)  //Lcd data function 
    
    {
    
      lcd_data_pin=disp;
    
      en=1;
    
      rs=1;
    
      rw=0;
    
      delay(1);
    
      en=0;
    
    }
    
    
    
    lcd_string(unsigned char *disp)  //Lcd string function 
    
    {
    
      int x;
    
      for(x=0;disp[x]!=0;x++)
    
     {
    
       lcd_data(disp[x]);
    
     }
    
    }
    
    
    
    void lcd_ini()      //Function to initialize the LCD
    
    {
    
     lcd_command(0x38);    
    
     delay(5);
    
     lcd_command(0x0F);        
    
     delay(5);
    
     lcd_command(0x80);
    
     delay(5);
    
    }
    
      
    
    void display()  // Function to display the unique ID
    
    {
    
     unsigned char count,i,key,flag=0,val;
    
     lcd_command(0x01);
    
     lcd_command(0x80);  //Place cursor to second position of second line
    
     val=index;
    
     for(i=0;i<index;i++)
    
     { 
    
      key=0;
    
      for(count=0;count<12;count++)
    
      { 
    
       if(card_id[count]==card_mem[i][count])
    
       {
    
        key++;
    
       }
    
      }
    
      if(key==12)
    
      {
    
       flag=1;
    
       lcd_command(0x80);
    
       lcd_string("Access granted");
    
       lcd_command(0xC4);
    
       lcd_string("USER ");
    
       lcd_command(0xC9);
    
       lcd_data(49+i);
    
       delay(100);
    
       break;
    
      }
    
     }
    
     if(flag==0)
    
     {
    
      lcd_command(0x84);
    
      lcd_string("Wrong ID");
    
      delay(200);
    
     }
    
     lcd_command(0x01);
    
     lcd_command(0x80);
    
     lcd_string("Pls scan your ID");
    
     current_byte=0;
    
    }
    
    
    
    void recieve() interrupt 4  //Function to recieve data serialy from RS232 
    
    {  
    
     card_id[current_byte]=SBUF;
    
       RI=0;    // Reset the serial interrupt after recieving the byte
    
     current_byte++; 
    
    }
    
    
    
    void memory()
    
    {
    
     unsigned char i,key=0,count,try=0,head=0,select=0,mod=0,size;
    
     unsigned int in,j;
    
     lcd_command(0x01);
    
     lcd_string("scan your ID");
    
     current_byte=0;
    
     while(current_byte!=12);
    
     current_byte=0;
    
     for(i=0;i<6;i++)
    
     { 
    
      key=0;
    
      for(count=0;count<12;count++)
    
      { 
    
         if(card_id[count]==card_mem[i][count])
    
       {
    
        key++;
    
       }
    
      }
    
      if(key==12)
    
      {
    
       size=i;
    
       lcd_command(0x01);
    
       lcd_string("Like to delete");
    
       lcd_command(0xC0);
    
       lcd_string("If yes scan ID");
    
       for(in=0;in<500;in++)
    
       {
    
        for(j=0;j<1275;j++)
    
        {
    
         if(current_byte==12)
    
         {
    
         break;
    
         }
    
        }
    
        if(current_byte==12)
    
        {
    
         break;
    
        }
    
       }
    
       if(current_byte==12)
    
       {
    
        for(in=0;in<12;in++)
    
        {
    
         if(card_id[in]==card_mem[size][in])
    
         {
    
          mod++;
    
         } 
    
        }
    
        if(mod==12)
    
        {
    
         for(in=0;in<12;in++)
    
         {
    
          card_mem[size][in]=5;
    
         }
    
         lcd_command(0x01);
    
         lcd_string("congratulation!");
    
         lcd_command(0xC0);
    
         lcd_string("You are deleted");
    
         delay(200);
    
         lcd_command(0x01);
    
         lcd_string("Pls scan your ID");
    
         key=0;
    
         try=1;
    
         break;
    
        }
    
        if(mod!=12)
    
        {
    
         lcd_command(0x01);
    
         lcd_string("You have shown");
    
         lcd_command(0xC0);
    
         lcd_string("different ID");
    
         delay(200);
    
         lcd_command(0x01);
    
         lcd_string("Pls scan your ID");
    
         key=0;
    
         try=1;
    
         break;
    
        }
    
       }
    
       if(current_byte!=12)
    
       {
    
        lcd_command(0x01);
    
        lcd_string("Sorry ! You are");
    
        lcd_command(0xC0);
    
        lcd_string("already an user"); 
    
        delay(200);
    
        lcd_command(0x01);
    
        lcd_string("Pls scan your ID");
    
        key=0;
    
        try=1;
    
        break;
    
       }
    
      }
    
     }
    
     current_byte=0;
    
     if(key<12 && try==0)
    
     {
    
     key=0;  
    
     for(i=0;i<12;i++)
    
     {
    
      card_mem[index][i]=card_id[i];
    
     }
    
     current_byte=0;
    
     lcd_command(0x01);
    
     lcd_string("Pls scan again");
    
        while(current_byte!=12);
    
     for(i=0;i<12;i++)
    
     {
    
      if(card_mem[index][i]==card_id[i])
    
      {
    
       key++;
    
      }
    
     }
    
        current_byte=0;
    
     if(key==12)
    
        {
    
      lcd_command(0x01);
    
      lcd_string("Pls varify again ");
    
      while(current_byte!=12);
    
      key=0;
    
      for(i=0;i<12;i++)
    
      { 
    
       if(card_mem[index][i]==card_id[i])
    
       {
    
        key++;
    
       }
    
      }
    
      current_byte=0;
    
     }
    
     else 
    
        {
    
      lcd_command(0x01);
    
      lcd_string("ERROR");
    
      delay(200);
    
      for(i=0;i<12;i++)
    
      {
    
       card_mem[index][i]=0;
    
      }
    
      lcd_command(0x01);
    
      lcd_string("Pls scan your ID");
    
     }
    
     if(key==12)
    
     {
    
      lcd_command(0x01);
    
      lcd_string("Congratulation !");
    
      lcd_command(0xC0);
    
      lcd_string("You are User");
    
      lcd_command(0xCC);
    
      lcd_data(index+49);
    
      delay(250);
    
      lcd_command(0x01);
    
      lcd_string("Pls scan your ID");
    
     }
    
     else 
    
        {
    
      lcd_command(0x01);
    
      lcd_string("ERROR");
    
      delay(200);
    
      for(i=0;i<12;i++)
    
      {
    
       card_mem[index][i]=0;
    
      }
    
      lcd_command(0x01);
    
      lcd_string("Pls scan your ID");
    
     }
    
     if(key==12)
    
     index++;
    
       }
    
     }
    
     
    
    void main()
    
    {
    
        new_user=1;
    
     TMOD=0x20;       //Enable Timer 1
    
     TH1=0XFD;
    
     SCON=0x50;
    
     TR1=1;
    
     IE=0x94;
    
     new_user=0;        // Trigger Timer 1
    
     lcd_ini();
    
     lcd_command(0x80);     //Place cursor to second position of first line 
    
     lcd_string("Pls scan your ID");
    
     delay(200);
    
     while(1)
    
     {
    
      if(new_user==1)
    
      {
    
       memory();
    
      }
    
      if(current_byte==12)
    
      { 
    
       display();
    
      }
    
     } 
    
    }
    
    
    
    
COMPONENTS(click here)
  • AT89C51 Microcontroller
  • MAX232 
  • LCD
Tags:

Share This Post

Get Updates

Subscribe to our Mailing List. We'll never share your Email address.

0 comments:

THANKS FOR UR COMMENT ....

Categories

Labels

AERONAUTICAL AEROSPACE AGRICULTURE ANDROID Android project titles Animation projects Artificial Intelligence AUTOMOBILE BANK JOBS BANK RECRUITMENTS BIG DATA PROJECT TITLES Bio instrumentation Project titles BIO signal Project titles BIO-TECHNOLOGY BIOINFORMATICS BIOMEDICAL Biometrics projects CAREER CAT 2014 Questions CHEMICAL CIVIL Civil projects cloud computing COMP- PROJ-DOWN COMPUTER SCIENCE PROJECT DOWNLOADS COMPUTER(CSE) CONFERENCE Data mining Projects Data protection. Design projects DIGITAL SIGNAL PROCESSING IEEE Project titles Dot net projects EBOOKS ELECTRICAL MINI PROJECTS ELECTRICAL PROJECTS DOWNLOADS ELECTRONICS MINI PROJECTS ELECTRONICS PROJECT DOWNLOADS EMG PROJECTS employment Engineering projects Exams Facts final year projects FOOD TECHNOLOGY FREE IEEE 2014 project Free IEEE Paper FREE IEEE PROJECTS GATE GAte scorecard GOVT JOBS Green projects GSM BASED Guest authors HIGHWAY IEEE 2014 projects ieee 2015 projects IEEE computer science projects IEEE Paper IEEE PAPER 2015 ieee project titles IEEE projects IEEE Transactions INDUSTRIAL INNOVATIVE PROJECTS INTERFACING IT IT LIST Java projects labview projects LATEST TECHNOLOGY list of project centers Low cost projects m.com MARINE Matlab codes MATLAB PROJECT TITLES MATLAB PROJECTS MBA MBA 2015 projects MCA MECHANICAL MECHANICAL PROJECTS DOWNLOAD MINI PROJECTS modelling projects MP3 MP3 cutter Mp4 Networking topics ns2 projects online jobs PETROCHEMICAL PHYSIOLOGICAL MODELLING projects physiotheraphy Projects Power electronics power system projects PRODUCTION project centers project downloads Prosthesis projects RAILWAY RECRUITMENT 2012 Recent RECENT TECHNOLOGY RECENT TECHNOLOGY LIST RECRUITMENT Rehabilitation projects renewable power respiration projects RESUME FORMAT. Ring Tone Cutter Robotics projects. Robots in medical social network jobs Solar projects Songs Cutter Speech-music separation-Abstract structural engineering TECHNOLOGY technology management TELE COMMUNICATION TEXTILE TOP ENGINEERING COLLEGES Training VLSI

Disclaimer

This blogs is an effort to club the scattered information about engineering and project titles and ideas available in the web. While every effort is made to ensure the accuracy of the information on this site, no liability is accepted for any consequences of using it. Most of the material and information are taken from other blogs and site with the help of search engines. If any posts here are hitting the copyrights of any publishers, kindly mail the details to educations360@gmail.com It will be removed immediately.

Alexa Rank

back to top