Monday, February 8, 2016

RFID With Arduino

    Hello visitors..... Its been a hard time working with my home automation system..And this week I was working with access control system. The end goal was to allow only the authorised user to use my home automation system as well as my system can keep track of the users in and out activity. It now knows exactly i am inside or not or one of my friend is inside. For that i have used RFID Reader as well as Mobile App access token......

    Today with this post i will share how to Interface EM18 RFID reader with Arduino. EM18 is really simple to Interface.

**I have used softwareSerial Lib of Arduino to use GPIO 2 as UART Rx Pin


Schematic:
     
Code: 
   
#include <SoftwareSerial.h>

SoftwareSerial mySerial(9, 10);
char dataBuffer[12];
int dataCounter=0;
void setup() 
{
  Serial.begin(57600);
  Serial.println("Scan RFID Tag!");

  // set the data rate for the NewSoftSerial port
  mySerial.begin(9600);
}

void loop()                     // run over and over again
{

  while (mySerial.available()) {
    dataBuffer[dataCounter]=(char)mySerial.read();
    dataCounter++;
  }
 if(dataCounter==12){
    String data(dataBuffer);
      Serial.println(data);
      dataCounter=0;
 }
      Serial.println("Again");
      delay(2000);
}

No comments:

Post a Comment