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

아두위키 : Arduwiki
(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...")
 
잔글편집 요약 없음
1번째 줄: 1번째 줄:
{{#seo:|title=아두위키 : 아두이노 RFID, NFC 모듈(PN532) 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, RFID, NFC 모듈(PN532), 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 RFID, NFC 모듈(PN532)을 제어하는 방법(기본정보, 회로, 예제 코드)을 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}}
{{#seo:|title=ArduWiki: Arduino RFID, NFC Module (PN532) Guide|title_mode=append|keywords=Arduino, Information Science, Maker Learning, Performance Evaluation, RFID, NFC Module (PN532), Arduino Projects, Capstone Projects, Arduino Example Code|description=Introduces how to control the RFID, NFC Module (PN532) with Arduino (basic information, circuit, example code). Can be used in Information Science and Maker classes.}}
[[File:PN532.jpg|center|class=coders100]]
[[File:PN532.jpg|center|class=coders100]]
This is an NFC module that allows communication mode selection among UART, I2C, and SPI through two built-in switches.
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 [https://how2electronics.com/interfacing-pn532-nfc-rfid-module-with-arduino/ PN532 guide].
In this document, we proceed with the I2C method. For those interested in other methods, please refer to the [https://how2electronics.com/interfacing-pn532-nfc-rfid-module-with-arduino/ PN532 guide].


== '''Specifications''' ==
== '''Specifications''' ==
10번째 줄: 11번째 줄:
* Interface: UART, I2C, SPI
* Interface: UART, I2C, SPI
* Operating Distance: up to 5cm ~ 7cm
* Operating Distance: up to 5cm ~ 7cm


== '''Hardware''' ==
== '''Hardware''' ==
16번째 줄: 18번째 줄:
* PN532
* PN532
* Jumper cables
* Jumper cables


== '''Connection''' ==
== '''Connection''' ==
42번째 줄: 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]] ===


== '''Example Code''' ==
== '''Example Code''' ==
81번째 줄: 87번째 줄:


</syntaxhighlight>
</syntaxhighlight>


=== Execution Result ===
=== Execution Result ===
[[File:PN532 실행결과.png|center|class=coders100]]
[[File:PN532 실행결과.png|center|class=coders100]]

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