Menu Close

Arduino – RFID EM18 Reader

Robo India presents tutorial on, retrieves the information from RFID card displays it on 16X2 LCD.

1. Introduction 

RFID is used to make track of every physical object by electromagnetic fields in the radion frequency range. The frequency range of this module is 125 KHz. EM-18 RFID Reader Module is the one the most commonly used module for Radio Frequency Identification Projects. It features Low Cost, Small Size, Low Power Consumption and Easy to use.

RFID module having two main components:

1. RFID Reader: RFID Reader contains the integrated type of circuit

2. RFID Tag: EM18 type of tag, radiates frequency signals through its coils.

RFID Tag contains 10 digits number, followed by 8 digits.

1.1 RFID Tag Pin Description 

2. Hardware required

S.No.ItemQuantity
1.Arduino 1
2.Breadboard 1
3.I2C LCD Backpack 1
4.RFID Kit 1
5.Male to Female Jumper Wires 8
6.Male to Male Jumper Wires 2

3. RFID EM 18 Reader board with Serial interfacing specifications: 

1) Can directly interface with FTDI Basic Programmer.

2) EM18 Module is detachable.

3) Speedy reading of tags/cards.

4) Sounds Beep after successful reads.

4. Connection

Before uploading the code make sure to remove Rx and Tx connection pins from Arduino. After uploading connect them again.

5. Programming

You may download this Arduino Sketch from here.


#include <Wire.h>  
#include <LiquidCrystal_I2C.h>
#include <stdio.h>
#include <ctype.h>

LiquidCrystal_I2C lcd(0x3F,20, 4);  // SET I2C Address
int count = 0; 
char c; 
String id;
void setup() 
{
  lcd.init();
  lcd.backlight(); // makes Backligh ON. 
  lcd.clear();     // Clears LCD
  lcd.home();      // Sets cursor at Column 0 and Line 0
  lcd.print("ROBO INDIA");  
  Serial.begin(9600);
}


void loop()  
{
 if(id == 0)
  {
   lcd.clear();                          
   lcd.setCursor(1,0);
   lcd.print("Swipe the Card");
   lcd.setCursor(0,1);
   lcd.print("                ");
  }
while(Serial.available()>0)
  {
   lcd.clear();        
   lcd.setCursor(4,0);
   lcd.print("RFID ID:");
   lcd.setCursor(2,1);
   lcd.print("                ");
 
   c = Serial.read();
   count++;
   id += c;
   if(count == 12)  
    {
      lcd.clear();
      lcd.setCursor(4,0);
      lcd.print("RFID ID:");  
      lcd.setCursor(2,1);
      lcd.print(id);
      Serial.print("RFID ID:");
      Serial.println(id);
      break; 
    }
  }
id="";
delay(1000);
}


6.Output

When a RFID Tag is bring in to the field of EM-18 RFID Reader, it will read its tag number and give output via TX terminal. This tag number will display on the connected LCD.

The LCD connected, will display the Hex Code of the tag written on the RFID Reader.

7.Output Description:

The decimal number printed on RFID tag 0005154230 , is display as HEX Value Output 1104EA5B64.

In this output, 4EA5B6 is the hex value of 5154230. and last number 4 is the XOR value of checksum (11+00+4E+A5+B6=4, Here symbol + presents XOR function). And the leading 11 start byte of the number varies according to card manufactures.

From the output, the decimal value of 4E and A5B6 is 078, 42422 respectively which is last 8 digits of RFID Tag.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

Leave a Reply