Interfacing EM-18 μRFID reader TTL protocol with Arduino Uno
µRFID Reader used to read our RFID cards. Using the module with microcontrollers to read a card’s data is very simple and required just a serial connection. The module should be powered at 3.3 – 5.5 VDC, and it requires a direct connection to the microcontroller’s Serial Rx pin. The card data is transmitted over the serial line when the card is brought near the module.
RFID is Radio Frequency Identification. An RFID reader is used to read RFID tags (which contain certain unique data stored in a chip). An RFID reader and an RFID tag, both have a coil surrounding them. When an RFID tag is shown near an RFID Reader, it collects the unique tag data (a combination of digits and characters) from the RFID tag. Power the μRFID reader; when an RFID tag is shown near the reader, electromagnetic induction will take place between the coils and this powers the chip inside tag. This chip will send data electromagnetically to the reader. The reader will receive this electromagnetically transferred data and outputs it serially. Every RFID reader comes with Serial output pins. We can collect the read data through these serial pins using arduino.
- When a high value is sent to the SEL pin of the reader, TTL Serial communication is enabled.
- The output in this mode is the 10 digit card no (ASCII) + 2 digit XOR result (ASCII)
Communication parameters are-For eg: If the RFID tag number is 500097892E, output of µRFID reader will be 500097892E60 where 60 is 50 xor 00 xor 97 xor 89 xor 2E
Interfacing μRFID reader TTL protocol with Arduino Uno
Arduino Uno is an open source physical computing platform based on ATmega328 microcontroller and provides a development environment for writing software for the board. It can be used for a variety of projects.
A TTL compatible output pin can be connected directly to Arduino. Make sure you connect Ground Pin of RFID reader to Ground Pin of Arduino.
Sample Code to read TTL data via Arduino UNO
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
#include <LiquidCrystal.h> // Header inclusion char j=0,x; char Card_No[13]; char rfid_N0[13]="02000E431D52"; LiquidCrystal lcd(6, 7, 12, 11, 10, 9); void setup() { lcd.begin(16, 2); // Set up the LCD's number of columns and rows: lcd.setCursor(0,0); // Position the LCD cursor lcd.print("RFID Based Login"); // Print a message to the LCD. lcd.setCursor(0,1); // Position the LCD cursor lcd.print(" System "); Serial.begin(9600); // Initialize the serial communications: delay(4000); lcd.clear(); lcd.setCursor(0,0); lcd.print("Use your Tag to "); lcd.setCursor(0,1); lcd.print("Login "); } void loop() { if (Serial.available()>0) { x=Serial.read(); Card_No[j] =x; // Save the read_data to an array j++; if(j==12) // After intake of 12 character { Card_No[j]='\0'; j=0; lcd.setCursor(0,0); lcd.print("Found "); delay(500); lcd.setCursor(0,0); lcd.print("ID: "); lcd.setCursor(3,0); lcd.print(Card_No); delay(3000); if(!strcmp(rfid_N0,Card_No)) { // Matching found in read_dat & card_id lcd.setCursor(0,0); lcd.print("Login Succeeded "); delay(3000); lcd.clear(); lcd.print(" THANK YOU "); delay(3000); } else // No matching found in read_dat & card_id { lcd.setCursor(0,0); lcd.print("Login Failed "); delay(3000); } lcd.clear(); } } else // If not read data go to show the tag again { lcd.setCursor(0,0); lcd.print("Use your Tag to "); lcd.setCursor(0,1); lcd.print("Login "); } } |
Upload the program
Resources
- Software
- Datasheet
- Example Projects
- Interfacing μRFID reader TTL protocol with Arduino Uno
- Interfacing μRFID reader Wiegand26 with Arduino Uno
- Interfacing μRFID reader TTL protocol with AT89S52
- Interfacing μRFID reader Wiegand26 with AT89S52
How to Buy?
- click here to buy µRFID Reader (EM-18 compatible)
- click here to buy Arduino UNO
- click here to buy RFID Access Control Shield with μRFID
Support
Please share your ideas with us, visit our forum for discussion
Frequently Asked Questions(FAQ):
Q. What is the frequency range of μRFID reader?
Ans. The operating frequency range of RFID card is 125kHz.
Q. What are the protocols μRFID reader supported?
Ans. There are two supported protocols namely TTL Serial & Wiegand 26 as per the system design.