RFID,NFC Module(PN532): 두 판 사이의 차이
(Created page with "{{#seo:|title=아두위키 : 아두이노 RFID, NFC 모듈(PN532) 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, RFID, NFC 모듈(PN532), 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 RFID, NFC 모듈(PN532)을 제어하는 방법(기본정보, 회로, 예제 코드)을 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}} File:PN532.jpg|center|class=co...") |
(차이 없음)
|
2024년 3월 24일 (일) 12:27 판

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
