Arduino UNO reads the ID of the RFID card (RFID Tag). The reading results are displayed to the LCD. RFID readout function This tag will be required for RFID based device creation process because we must know the code or ID of each RFID (RFID Tag) card.
Hardware Requirement
- Arduino Uno Board
- RFID Reader RC522 Module
- LCD 16*2
- Power supply +5 Volt
- Jumper
Schematic
Arduino - RFID RC522 Wiring
Arduino - LCD Wiring
Source Code/Sketch
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
#define RST_PIN 9
#define SS_PIN 10
MFRC522 mfrc522(SS_PIN, RST_PIN);
MFRC522::MIFARE_Key key;
byte noID[5];
byte i;
//byte bukaPintu=1;
void setup() {
lcd.begin(16, 2);
SPI.begin();
mfrc522.PCD_Init();
lcd.clear();
lcd.print("Baca RFID Card");
}
void loop() {
if(!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()){
return;
}
for (i=0; i<mfrc522.uid.size; i++) {
noID[i]=mfrc522.uid.uidByte[i];
}
lcd.setCursor(0,1);
lcd.print("ID:");
for (i=0; i<mfrc522.uid.size; i++) {
lcd.print(noID[i],HEX);
}
}
#include <MFRC522.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
#define RST_PIN 9
#define SS_PIN 10
MFRC522 mfrc522(SS_PIN, RST_PIN);
MFRC522::MIFARE_Key key;
byte noID[5];
byte i;
//byte bukaPintu=1;
void setup() {
lcd.begin(16, 2);
SPI.begin();
mfrc522.PCD_Init();
lcd.clear();
lcd.print("Baca RFID Card");
}
void loop() {
if(!mfrc522.PICC_IsNewCardPresent() || !mfrc522.PICC_ReadCardSerial()){
return;
}
for (i=0; i<mfrc522.uid.size; i++) {
noID[i]=mfrc522.uid.uidByte[i];
}
lcd.setCursor(0,1);
lcd.print("ID:");
for (i=0; i<mfrc522.uid.size; i++) {
lcd.print(noID[i],HEX);
}
}
How it Works
1. Connect the Arduino with Peripherals needed
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino
4. LCD on the first line will appear Display: "Read RFID Card".
5. Put RFID Tags on top of the RFID RC522 module, so the LCD will show the ID of the RFID Tag.
Shown on second line.
6. Replace with another RFID Tag, then the ID will be displayed according to its ID.
Video for Project V - 41. Read RFID Data using Arduino
Required File
No comments:
Post a Comment