Codey OnlineArduino- & ESP32-componentenbibliotheek › PN532 RFID NFC Module
PN532 RFID NFC Module
Sensoren

PN532 RFID NFC Module

Met de PN532 RFID/NFC-module kan een Arduino/ESP32 communiceren met NFC-tags en contactloze kaarten. Hij ondersteunt meestal meerdere digitale interfaces, vaak SPI (met SS, MOSI, MISO, SCK) en I2C (met SCL, SDA), plus voeding (VCC/GND) en besturings-/interruptsignalen (RSTO/IRQ).

Breedte: 46.2 mm

Pinout — PN532 RFID NFC Module

Pin Signaal Beschrijving
RSTO reset PN532 reset line for resetting the NFC controller.
IRQ interrupt Interrupt request output from the PN532 to signal events to the host.
GND ground Ground reference for the PN532 module and host interface.
VCC power Main power input for the PN532 module.
SS chip-select SPI slave-select input for enabling PN532 SPI communication.
MOSI MOSI SPI data input from the host MCU to the PN532.
MISO MISO SPI data output from the PN532 to the host MCU.
SCK SCK SPI clock input from the host MCU for PN532 SPI mode.
SCL SCL I2C clock line for PN532 communication.
SDA SDA I2C data line for PN532 communication.
VCC.1 power Power input for the I2C-side header of the PN532 module.
GND.1 ground Ground reference for the I2C-side header.

Voorbeeld-aansluitschema — PN532 RFID NFC Module

Van Naar Draad
board:5V x1:VCC.1 red
board:GND x1:GND.1 black
board:A4 x1:SDA green
board:A5 x1:SCL blue
board:D2 x1:IRQ yellow
board:D3 x1:RSTO purple

Voorbeeld-Arduinocode — PN532 RFID NFC Module

Dit voorbeeld is geschreven en compile-gecheckt voor de arduino-uno. Codey Online past het voor je aan naar elk ander ondersteund board.

#include <Wire.h>
#include <Adafruit_PN532.h>

// Arduino Uno pins used by this example:
// IRQ  -> D2
// RSTO -> D3
Adafruit_PN532 nfc(2, 3);

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ;
  }

  Serial.println("PN532 NFC reader starting...");

  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (!versiondata) {
    Serial.println("Didn't find PN532 board");
    while (1) {
      delay(10);
    }
  }

  Serial.print("Found PN532 chip, firmware version: ");
  Serial.print((versiondata >> 24) & 0xFF, HEX);
  Serial.print('.');
  Serial.println((versiondata >> 16) & 0xFF, HEX);

  nfc.SAMConfig();
  Serial.println("Waiting for an ISO14443A card/tag...");
}

void loop() {
  uint8_t uid[7];
  uint8_t uidLength;

  bool success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength, 1000);
  if (success) {
    Serial.print("Found tag UID: ");
    for (uint8_t i = 0; i < uidLength; i++) {
      if (uid[i] < 0x10) Serial.print('0');
      Serial.print(uid[i], HEX);
      if (i < uidLength - 1) Serial.print(':');
    }
    Serial.println();
    delay(1000);
  }
}

Vergelijkbare componenten

18650 Battery Shield with USB-C Charger and 5V Boost Converter

18650 Battery Shield with USB-C Charger and 5V Boost Converter

2.4 inch OLED Display I2C 3.3V

2.4 inch OLED Display I2C 3.3V

3.5 inch TFT LCD Shield

3.5 inch TFT LCD Shield

50kg Load Cell Weight Sensor

50kg Load Cell Weight Sensor

Bouw je Arduino- of ESP32-project met AI

Beschrijf wat je wilt bouwen. Codey Online schrijft de code, tekent het aansluitschema, compileert het en flasht je board rechtstreeks vanuit de browser.

Gratis starten