banner image
Sedang Dalam Perbaikan

Tutorial Pemrograman dan Pembacaan Tag Input RFID-RC522 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 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 :


Koneksi antar PIN seperti berikut ini :


Berikut ini adalah Code Programnya :

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

Tutorial Pemrograman dan Pembacaan 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 <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.

Berikut ini Video Uji Cobanya :





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
Tutorial Pemrograman dan Pembacaan Tag Input RFID-RC522 Menggunakan Arduino Uno R3 Tutorial Pemrograman dan Pembacaan Tag Input RFID-RC522 Menggunakan Arduino Uno R3 Reviewed by MCH on February 26, 2019 Rating: 5

No comments:

Powered by Blogger.