Arduino - EM18 RFID Reader

In this Project, we will see about how to interface EM-18 RFID with Arduino.

Circuit Diagram:

Arduino Code:
rfid_receive_char_code.ino
void setup() {
  Serial.begin(9600);
}

void loop() {
  if (Serial.available() > 0) {
    char inChar = (char) Serial.read();
    Serial.println(inChar);
  }
}

rfid_receive_string_code.ino
boolean stringComplete = false;
String inputString = "";
int n = 0;
#define BUZZ 8

void setup() {
  Serial.begin(9600);
  pinMode(BUZZ, OUTPUT);
  inputString.reserve(200);
}

void loop() {
  if (stringComplete) {
    Serial.println(inputString);
    if (inputString.equals("180001493565")) { //A
      digitalWrite(BUZZ, HIGH);
    }
    if (inputString.equals("1300711F7508")) { //B
      digitalWrite(BUZZ, LOW);
    }

    stringComplete = false;
    inputString = "";
  }
}

void serialEvent() {
  while (Serial.available()) {
    n++;
    char inChar = (char) Serial.read();
    inputString += inChar;
    if (n >= 12) {
      n = 0;
      stringComplete = true;
    }
  }
}

Youtube Video Tutorial:




Download our official Android App in PlayStore. Click Here
You can get the all the required files (like Circuit Diagram, Arduino.ino file, Libraries Used, and others) for the project  in ZIP format and much more...

3 comments:

  1. it cant read my tag.....is there any libraries was included for coding

    ReplyDelete
  2. Please give me details of RFID pin in RFID tag

    ReplyDelete