Tutorial Pembacaan RFID Card dan Tag Input RFID-RC522 Menggunakan Arduino Uno R3
Kali ini saya akan berbagi Tutorial Pembacaan RFID Card dan Tag Input RFID-RC522 Menggunakan Arduino Uno R3. Jika tag terdeteksi dan dikenali oleh Arduino, maka Arduino akan menampilkan output sesuai kondisi yang didapat pada Serial Monitor Arduino IDE. Anda bisa download dahulu Library Arduino nya di link berikut ini : DOWNLOAD LIBRARY.
1. Arduino Uno R3 >>> BELI DISINI
2. RFID-RC522 >>> BELI DISINI
3. Kabel Jumper >>> BELI DISINI
Berikut ini adalah gambar rangkaiannya :
1. Arduino Uno R3 >>> BELI DISINI
2. RFID-RC522 >>> BELI DISINI
3. Kabel Jumper >>> BELI DISINI
Berikut ini adalah gambar rangkaiannya :
Koneksi antar PIN seperti berikut ini :
Berikut ini adalah Code Programnya :
/***************************
Tutorial Pembacaan RFID Card dan Tag Input RFID-RC522 Menggunakan Arduino Uno R3
Oleh : Arduino Indonesia
Website : www.arduinoindonesia.id
Toko Online : www.workshopelectronics3in1.com
Blog : www.edukasielektronika.com
Copyright @2019
****************************/#include <SPI.h>
#include <MFRC522.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class
MFRC522::MIFARE_Key key;
// Init array that will store new NUID
byte nuidPICC[3];
void setup() {
Serial.begin(9600);
SPI.begin(); // Init SPI bus
rfid.PCD_Init(); // Init MFRC522
for (byte i = 0; i < 6; i++) {
key.keyByte[i] = 0xFF;
}
Serial.println(F("This code scan the MIFARE Classsic NUID."));
Serial.print(F("Using the following key:"));
printHex(key.keyByte, MFRC522::MF_KEY_SIZE);
}
void loop() {
// Look for new cards
if ( ! rfid.PICC_IsNewCardPresent())
return;
// Verify if the NUID has been readed
if ( ! rfid.PICC_ReadCardSerial())
return;
Serial.print(F("PICC type: "));
MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
Serial.println(rfid.PICC_GetTypeName(piccType));
// Check is the PICC of Classic MIFARE type
if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
Serial.println(F("Your tag is not of type MIFARE Classic."));
return;
}
if (rfid.uid.uidByte[0] != nuidPICC[0] ||
rfid.uid.uidByte[1] != nuidPICC[1] ||
rfid.uid.uidByte[2] != nuidPICC[2] ||
rfid.uid.uidByte[3] != nuidPICC[3] ) {
Serial.println(F("A new card has been detected."));
// Store NUID into nuidPICC array
for (byte i = 0; i < 4; i++) {
nuidPICC[i] = rfid.uid.uidByte[i];
}
Serial.println(F("The NUID tag is:"));
Serial.print(F("In hex: "));
printHex(rfid.uid.uidByte, rfid.uid.size);
Serial.println();
Serial.print(F("In dec: "));
printDec(rfid.uid.uidByte, rfid.uid.size);
Serial.println();
}
else Serial.println(F("Card read previously."));
// Halt PICC
rfid.PICC_HaltA();
// Stop encryption on PCD
rfid.PCD_StopCrypto1();
}
/**
* Helper routine to dump a byte array as hex values to Serial.
*/
void printHex(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.print(buffer[i], HEX);
}
}
/**
* Helper routine to dump a byte array as dec values to Serial.
*/
void printDec(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.print(buffer[i], DEC);
}
}
Upload Code Program di atas ke Board Arduino. Lalu Klik >> Serial Monitor. Lalu dekatkan RFID Card anda di RFID Reader RC522. Nilai Tag dari RFID Card akan terlihat pada tampilan Serial Monitor Tersebut.
Tag :
toko arduino, arduino online, jasa arduino, toko elektronik, arduino, arduino adalah, arduino download, arduino ide, arduino projects, toko elektronik malang, toko elektronik bandung, toko elektronik surabaya, belajar arduino, harga sensor, jual arduino glodok, arduino serial, arduino tutorial, jual komponen elektronika grosir dan eceran, arduino pdf, modul arduino, arduino uno projects, jual komponen elektronika glodok, simulator arduino, arduino indonesia, arduino programming, arduino servo, arduino android, proyek arduino untuk pemula, arduino pwm, ldr arduino, toko robot, ebook arduino, motor dc arduino, software arduino, arduino eeprom, arduino led, pwm arduino, toko komponen elektronik terlengkap, arduino timer, program arduino, arduino nano datasheet, arduino uno schematic, jual komponen elektronika, toko komponen elektronik online terpercaya, arduino nano pinout, arduino software, tutorial arduino, harga arduino uno asli, proyek arduino, toko komponen elektronik online, arduino simulator, arduino code, toko komponen elektronik, lm35 arduino, arduino controller, arduino library, arduino atmega328, toko electronic, arduino bluetooth, toko elektronik di bali, projek arduino uno, toko elektronik di surabaya, toko elektronik online, mikrokontroler arduino, toko elektronik tangerang, toko elektronik di denpasar
toko arduino, arduino online, jasa arduino, toko elektronik, arduino, arduino adalah, arduino download, arduino ide, arduino projects, toko elektronik malang, toko elektronik bandung, toko elektronik surabaya, belajar arduino, harga sensor, jual arduino glodok, arduino serial, arduino tutorial, jual komponen elektronika grosir dan eceran, arduino pdf, modul arduino, arduino uno projects, jual komponen elektronika glodok, simulator arduino, arduino indonesia, arduino programming, arduino servo, arduino android, proyek arduino untuk pemula, arduino pwm, ldr arduino, toko robot, ebook arduino, motor dc arduino, software arduino, arduino eeprom, arduino led, pwm arduino, toko komponen elektronik terlengkap, arduino timer, program arduino, arduino nano datasheet, arduino uno schematic, jual komponen elektronika, toko komponen elektronik online terpercaya, arduino nano pinout, arduino software, tutorial arduino, harga arduino uno asli, proyek arduino, toko komponen elektronik online, arduino simulator, arduino code, toko komponen elektronik, lm35 arduino, arduino controller, arduino library, arduino atmega328, toko electronic, arduino bluetooth, toko elektronik di bali, projek arduino uno, toko elektronik di surabaya, toko elektronik online, mikrokontroler arduino, toko elektronik tangerang, toko elektronik di denpasar
Komentar
Posting Komentar