Post Page Advertisement [Top]

RFID ACCESS CONTROL WITH LCD

Students are done RFID based Access control technology in today session.

2 comments:

  1. AAKASH HERROLD ---------------------
    #include
    #include
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
    #define ALLOWEDPIN 8
    #define WARNEDPIN 9
    char tag[] ="020017D8C10C"; // Replace with your own Tag ID
    char input[12]; // A variable to store the Tag ID being presented
    int count = 0; // A counter variable to navigate through the input[] character array
    boolean flag = 0; // A variable to store the Tag match status
    void setup()
    {
    Serial.begin(9600); // Initialise Serial Communication with the Serial Monitor
    pinMode(ALLOWEDPIN,OUTPUT); // RELAY OUTPUT
    pinMode(WARNEDPIN,OUTPUT); //WRONG TAG INDICATOR
    }
    void loop()
    {
    if(Serial.available())// Check if there is incoming data in the RFID Reader Serial Buffer.
    {
    count = 0; // Reset the counter to zero
    /* Keep reading Byte by Byte from the Buffer till the RFID Reader Buffer is empty
    or till 12 Bytes (the ID size of our Tag) is read */
    while(Serial.available() && count < 12)
    {
    input[count] = Serial.read(); // Read 1 Byte of data and store it in the input[] variable
    count++; // increment counter
    delay(5);
    }
    /* When the counter reaches 12 (the size of the ID) we stop and compare each value
    of the input[] to the corresponding stored value */
    if(count == 12) //
    {
    count =0; // reset counter varibale to 0
    flag = 1;
    /* Iterate through each value and compare till either the 12 values are
    all matching or till the first mistmatch occurs */
    while(count<12 && flag !=0)
    {
    if(input[count]==tag[count])
    flag = 1; // everytime the values match, we set the flag variable to 1
    else
    flag= 0;
    /* if the ID values don't match, set flag variable to 0 and
    stop comparing by exiting the while loop */
    count++; // increment i
    }
    }
    if(flag == 1) // If flag variable is 1, then it means the tags match
    {
    Serial.println("Access Allowed!");
    Serial.println("WELCOME AAKASH");
    lcd.clear();
    lcd.setCursor(2,0);
    lcd.print("ACCESS ALLOWED");
    lcd.setCursor(0,1);
    lcd.print("WELCOME AAKASH");
    Serial.print(input[count]);
    digitalWrite(ALLOWEDPIN,HIGH);
    delay (1000);
    digitalWrite (ALLOWEDPIN,LOW);
    }
    else
    {
    Serial.println("ACCESS DENIED"); // Incorrect Tag Message
    digitalWrite(WARNEDPIN,HIGH);
    delay(1000);
    lcd.clear();
    lcd.setCursor(1,0);
    lcd.print("!WARNING!");
    lcd.setCursor(1,1);
    lcd.print("ACCESS DENIED");
    digitalWrite(WARNEDPIN,HIGH);
    delay(1000);
    digitalWrite(WARNEDPIN,LOW);
    }
    /* Fill the input variable array with a fixed value 'F' to overwrite
    all values getting it empty for the next read cycle */
    for(count=0; count<12; count++)
    {
    input[count]= 'F';
    }
    count = 0; // Reset counter variable
    }
    }

    ReplyDelete
  2. I learn some new stuff from it too, thanks for sharing your information. rfid label supplier

    ReplyDelete

Bottom Ad [Post Page]