شحن مجاني للأوردرات فوق
1000 ج
رمضان كريم
Advanced Near Field Communication for Arduino and Embedded Systems
The PN532 NFC RFID Module V3 is a highly integrated transmission module for 13.56MHz contactless communication. Based on NXP’s PN532 chipset, it supports read/write operations with various NFC and RFID tags including Mifare, NTAG, and FeliCa.
Key FeaturesWorks with NFC, Mifare, ISO/IEC 14443 A/B, FeliCa
I2C, SPI, and UART communication options
Supports up to 424kbps data transfer rate
Works with 3.3V or 5V systems including Arduino
| Operating Frequency | 13.56MHz |
|---|---|
| Supported Protocols | NFC, Mifare, ISO/IEC 14443 A/B, FeliCa |
| Communication Range | Up to 5cm (depending on antenna) |
| Interface Options | I2C, SPI, HSU (UART) |
| Operating Voltage | 3.3V – 5V DC |
| Current Consumption | ~100mA during operation |
| Data Transfer Rate | Up to 424kbps |

| Pin | Label | Description | Arduino Connection |
|---|---|---|---|
| 1 | VCC | Power (3.3V or 5V) | 5V |
| 2 | GND | Ground | GND |
| 3 | SDA | I2C Data | A4 |
| 4 | SCL | I2C Clock | A5 |
| 5 | IRQ | Interrupt Request | D2 |
| 6 | RST | Reset | D3 |
// Basic I2C Connections: // VCC → 5V // GND → GND // SDA → A4 (SDA) // SCL → A5 (SCL) // IRQ → D2 (optional) // RST → D3 (optional) // For SPI interface, different connections are required
// PN532 NFC Reader Basic Example (using Adafruit_PN532 library)
#include <Wire.h>
#include <Adafruit_PN532.h>
#define PN532_IRQ (2)
#define PN532_RESET (3)
Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);
void setup() {
Serial.begin(9600);
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.println("PN532 not found");
while (1);
}
Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
nfc.SAMConfig();
Serial.println("Waiting for NFC tag...");
}
void loop() {
uint8_t success;
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
uint8_t uidLength;
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);
if (success) {
Serial.println("Found NFC tag!");
Serial.print("UID Length: "); Serial.print(uidLength, DEC); Serial.println(" bytes");
Serial.print("UID Value: ");
for (uint8_t i=0; i < uidLength; i++) {
Serial.print(" 0x"); Serial.print(uid[i], HEX);
}
Serial.println();
delay(1000);
}
}
// Configure as NFC tag
nfc.setPassiveActivationRetries(0xFF);
nfc.startPassiveTargetIDDetection(PN532_MIFARE_ISO14443A);
// Authenticate with Mifare Classic
uint8_t keya[6] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
success = nfc.mifareclassic_AuthenticateBlock(
uid, uidLength, 4, 0, keya);
// Write NDEF URL to NTAG
uint8_t ndefprefix = NDEF_URIPREFIX_HTTP;
uint8_t url[] = { 'e', 'k', 'o', 's', 't', 'r', 'a', '.', 'c', 'o', 'm' };
success = nfc.ntag2xx_WriteNDEFURI(ndefprefix, url, sizeof(url));
// Initialize NFC P2P
nfc.InitDepTarget();
// Configure as Initiator/Target
nfc.TgInitAsTarget();
No account yet?
Create an Account
Recent Comments