Tutorial RFID-RC522 Pemrograman dan Pembacaan Tag Input Menggunakan Arduino Uno R3

Kali ini saya akan berbagi Tutorial Pemrograman dan Pembacaan Tag Input RFID-RC522 Menggunakan Arduino Uno R3. Jika tag terdeteksi dan diken...

Kali ini saya akan berbagi Tutorial Pemrograman dan Pembacaan 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
2. RFID-RC522 
3. Kabel Jumper 

Berikut ini adalah gambar rangkaiannya :


Koneksi antar PIN seperti berikut ini :


Berikut ini adalah Code Programnya :

 /***************************

Tutorial Pemrograman dan Pembacaan Tag Input RFID-RC522 Menggunakan Arduino Uno R3

Oleh : Robotikawan
Website : www.robotikawan.blogspot.com

Copyright @2019

****************************/

#include <AddicoreRFID.h>
#include <SPI.h>

#define  uchar unsigned char
#define uint  unsigned int

uchar fifobytes;
uchar fifoValue;

AddicoreRFID myRFID; // create AddicoreRFID object to control the RFID module

/////////////////////////////////////////////////////////////////////
//set the pins
/////////////////////////////////////////////////////////////////////
const int chipSelectPin = 10;
const int NRSTPD = 5;

//Maximum length of the array
#define MAX_LEN 16

void setup() {               
   Serial.begin(9600);                        // RFID reader SOUT pin connected to Serial RX pin at 9600bps

  // start the SPI library:
  SPI.begin();
 
  pinMode(chipSelectPin,OUTPUT);              // Set digital pin 10 as OUTPUT to connect it to the RFID /ENABLE pin
    digitalWrite(chipSelectPin, LOW);         // Activate the RFID reader
  pinMode(NRSTPD,OUTPUT);                     // Set digital pin 10 , Not Reset and Power-down
    digitalWrite(NRSTPD, HIGH);

  myRFID.AddicoreRFID_Init(); 
}

void loop()
{
    uchar i, tmp, checksum1;
  uchar status;
        uchar str[MAX_LEN];
        uchar RC_size;
        uchar blockAddr;  //Selection operation block address 0 to 63
        String mynum = "";

        str[1] = 0x4400;
  //Find tags, return tag type
  status = myRFID.AddicoreRFID_Request(PICC_REQIDL, str);
  if (status == MI_OK)
  {
          Serial.println("RFID tag detected");
          Serial.print("Tag Type:\t\t");
          uint tagType = str[0] << 8;
          tagType = tagType + str[1];
          switch (tagType) {
            case 0x4400:
              Serial.println("Mifare UltraLight");
              break;
            case 0x400:
              Serial.println("Mifare One (S50)");
              break;
            case 0x200:
              Serial.println("Mifare One (S70)");
              break;
            case 0x800:
              Serial.println("Mifare Pro (X)");
              break;
            case 0x4403:
              Serial.println("Mifare DESFire");
              break;
            default:
              Serial.println("Unknown");
              break;
          }
  }

  //Anti-collision, return tag serial number 4 bytes
  status = myRFID.AddicoreRFID_Anticoll(str);
  if (status == MI_OK)
  {
          checksum1 = str[0] ^ str[1] ^ str[2] ^ str[3];
          Serial.print("The tag's number is:\t");
          Serial.print(str[0]);
            Serial.print(" , ");
          Serial.print(str[1]);
            Serial.print(" , ");
          Serial.print(str[2]);
            Serial.print(" , ");
          Serial.println(str[3]);

          Serial.print("Read Checksum:\t\t");
            Serial.println(str[4]);
          Serial.print("Calculated Checksum:\t");
            Serial.println(checksum1);
           
            // Should really check all pairs, but for now we'll just use the first
            if(str[0] == 197)                      //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
            {
                Serial.println("\nHello Craig!\n");
            } else if(str[0] == 244) {             //You can change this to the first byte of your tag by finding the card's ID through the Serial Monitor
                Serial.println("\nHello Erin!\n");
            }
            Serial.println();
            delay(1000);
  }
   
        myRFID.AddicoreRFID_Halt();      //Command tag into hibernation             
}

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.


COMMENTS

BLOGGER
acsaczxc
acascascascsa
Nama

7 Segment,2,Ardublock,2,Arduino,47,ATMega16,4,AVR Microcontroller,2,Counter,1,COVID-19,1,Elektronika,7,ESP32,3,ESP8266,1,Finger Print,1,Grafik,1,I2C,2,IoT,7,Jam Digital,1,Jam Waktu Sholat,1,Kalender Digital,1,Keypad,2,LCD,6,LDR,1,LED,5,Micro SD Card,1,Microsoft,1,Mikrokontroller,2,Motor,2,Motor Servo,2,NodeMCU,1,P10,1,Raspberry Pi,2,Relay,2,Resistor,2,RFID,1,Sensor Asap,1,Sensor Cahaya,1,Sensor Gas,2,Sensor Hujan,1,Sensor Kelembaban,6,Sensor Suhu,11,Sensor Ultrasonik,4,Solar Panel,1,STM32,5,Traffic Light,3,Transistor,1,USBasp,1,
ltr
item
Belajar Arduino dan Robotika: Tutorial RFID-RC522 Pemrograman dan Pembacaan Tag Input Menggunakan Arduino Uno R3
Tutorial RFID-RC522 Pemrograman dan Pembacaan Tag Input Menggunakan Arduino Uno R3
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP5blX4OsQQY-yMVRZTA2jTxGj-4dbPA00sNf7A6iGu2RCCHqBniJANAzAYmzphR1tWpomX6QSYmJ_wv6krPIi1qCvE5FrNXnfv7ISn6d4s9xwXpe3s9Jq6dVHg28r6OdNCA-ZY2UfAP8/s640/RFID+Reader+Schematic.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgP5blX4OsQQY-yMVRZTA2jTxGj-4dbPA00sNf7A6iGu2RCCHqBniJANAzAYmzphR1tWpomX6QSYmJ_wv6krPIi1qCvE5FrNXnfv7ISn6d4s9xwXpe3s9Jq6dVHg28r6OdNCA-ZY2UfAP8/s72-c/RFID+Reader+Schematic.png
Belajar Arduino dan Robotika
https://robotikawan.blogspot.com/2020/08/tutorial-rfid-rc522-pemrograman-dan.html
https://robotikawan.blogspot.com/
https://robotikawan.blogspot.com/
https://robotikawan.blogspot.com/2020/08/tutorial-rfid-rc522-pemrograman-dan.html
true
3524113465990287612
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy