RFID,NFC Module(PN532): 두 판 사이의 차이

아두위키 : Arduwiki
잔글편집 요약 없음
잔글편집 요약 없음
 
(같은 사용자의 중간 판 하나는 보이지 않습니다)
45번째 줄: 45번째 줄:
* PN532
* PN532
* NfcAdapter
* NfcAdapter


=== [https://blog.naver.com/gongzipsa/222946983743 Library Download] ===
=== [https://blog.naver.com/gongzipsa/222946983743 Library Download] ===


=== [[Arduino Libraries|Installation Method]] ===
=== [[Arduino Libraries|Installation Method]] ===

2025년 3월 21일 (금) 16:48 기준 최신판

This is an NFC module that allows communication mode selection among UART, I2C, and SPI through two built-in switches.

In this document, we proceed with the I2C method. For those interested in other methods, please refer to the PN532 guide.


Specifications

  • Operating Voltage: 5V
  • Interface: UART, I2C, SPI
  • Operating Distance: up to 5cm ~ 7cm


Hardware

  • Arduino
  • PN532
  • Jumper cables


Connection

Arudino UNO PN532
5V VCC
GND GND
A4 SDA
A5 SCL

Libraries

  • Wire
  • PN532_I2C
  • PN532
  • NfcAdapter

Library Download

Installation Method

Example Code

// for I2C Communication (SDA(A4), SCL(A5))
#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>
#include <NfcAdapter.h>

PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);
String tagId = "None";
byte nuidPICC[4];

void setup(void) {
  Serial.begin(9600);
  Serial.println("Serial start");
  nfc.begin();
}

void loop() {
  readNFC();
}

void readNFC() {
  if (nfc.tagPresent()) {
    Serial.println("============================================");
    NfcTag tag = nfc.read();
    tag.print();
    tagId = tag.getUidString();
  }
  delay(1000);
}


Execution Result