My PN532 NFC RFID MODULE not working with my arduino uno r4 wifi

Hello everyone, hope you are doing well

I recently got this red PN532 rfid module from a local electronics shop near rolla, uae. I tried programming it on the first day with my arduino, tested different code, different protocols but no luck, atleast it shows up on the I2C bus ad 0x24 but nothing else... I have no idea whatsoever about this and the arduino is working perfectly. Anybody has a cause or solution? Please help me!

Please post your sketch, using code tags when you do

How is the PN532 connected to the Uno R4 ?

using the PN532 SPI interface the following code works on a UNO R4 WiFi

// UNO R4 WiFi SPI PN532 NFC RFID V3 Module

/**************************************************************************/
/*!
    @file     readMifareClassic.pde
    @author   Adafruit Industries
	@license  BSD (see license.txt)

    This example will wait for any ISO14443A card or tag, and
    depending on the size of the UID will attempt to read from it.

    If the card has a 4-byte UID it is probably a Mifare
    Classic card, and the following steps are taken:

    Reads the 4 byte (32 bit) ID of a MiFare Classic card.
    Since the classic cards have only 32 bit identifiers you can stick
	them in a single variable and use that to compare card ID's as a
	number. This doesn't work for ultralight cards that have longer 7
	byte IDs!

    Note that you need the baud rate to be 115200 because we need to
	print out the data and read from the card at the same time!

This is an example sketch for the Adafruit PN532 NFC/RFID breakout boards
This library works with the Adafruit NFC breakout
  ----> https://www.adafruit.com/products/364

Check out the links above for our tutorials and wiring diagrams
These chips use SPI to communicate, 4 required to interface

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
*/
/**************************************************************************/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>

// If using the breakout with SPI, define the pins for SPI communication.
//#define PN532_SCK  (2)
//#define PN532_MOSI (3)
#define PN532_SS   (10)
//#define PN532_MISO (5)

// If using the breakout or shield with I2C, define just the pins connected
// to the IRQ and reset lines.  Use the values below (2, 3) for the shield!
//#define PN532_IRQ   (2)
//#define PN532_RESET (3)  // Not connected by default on the NFC Shield

// Uncomment just _one_ line below depending on how your breakout or shield
// is connected to the Arduino:

// Use this line for a breakout with a SPI connection:
//Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);

// Use this line for a breakout with a hardware SPI connection.  Note that
// the PN532 SCK, MOSI, and MISO pins need to be connected to the Arduino's
// hardware SPI SCK, MOSI, and MISO pins.  On an Arduino Uno these are
// SCK = 13, MOSI = 11, MISO = 12.  The SS line can be any digital IO pin.

// SPI UNO R4 WiFi  SCK = 13, MOSI = 11, MISO = 12. SS=10
Adafruit_PN532 nfc(PN532_SS);   // and SS GPIO5

// Or use this line for a breakout or shield with an I2C connection:
//Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);

void setup(void) {
  Serial.begin(115200);
  while (!Serial) delay(10); // for Leonardo/Micro/Zero

  Serial.println("Hello!");

  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  // Got ok data, print it out!
  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);

  Serial.println("Waiting for an ISO14443A Card ...");
}


void loop(void) {
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
  uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

  // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

  if (success) {
    // Display some basic information about the card
    Serial.println("Found an ISO14443A card");
    Serial.print("  UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
    Serial.print("  UID Value: ");
    nfc.PrintHex(uid, uidLength);

    if (uidLength == 4)
    {
      // We probably have a Mifare Classic card ...
      uint32_t cardid = uid[0];
      cardid <<= 8;
      cardid |= uid[1];
      cardid <<= 8;
      cardid |= uid[2];
      cardid <<= 8;
      cardid |= uid[3];
      Serial.print("Seems to be a Mifare Classic card #");
      Serial.println(cardid);
    }
    Serial.println("");
  }
  delay(2000);
}


test results

Hello!
Found chip PN532
Firmware ver. 1.6
Waiting for an ISO14443A Card ...
Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0x15 0x64 0xFD 0xC2
Seems to be a Mifare Classic card #358940098

Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0x4E 0x06 0x0C 0x04
Seems to be a Mifare Classic card #1309019140

Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0xBF 0xEC 0x0C 0x04
Seems to be a Mifare Classic card #3219917828

Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0xC0 0xFF 0x62 0x1A
Seems to be a Mifare Classic card #3237962266

Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0xC6 0x47 0xD1 0x05
Seems to be a Mifare Classic card #3326595333

photo

Ok

Bt i will try @horace 's answer first, seems reasonable

Nope no luck! I have no idea!

btw the last 2 white and purple wires are not connected

looking at the photo the wiring looks OK
double check PN532 to UNO R4 WiFi

// SPI UNO R4 WiFi  SCK = 13, MOSI = 11, MISO = 12. SS=10

Yup, wiring is 100% correct

check the switch settings are for SPI

will test I2C

Yup, no difference mate, I looked at the table and the switches before I connected

anyone could help?

Wait, i found out that this thing has a i2c address at 0x28!

Does it have to do something about it?

I found that PN532 connected to UNO R4 WiFi I2C requires pullups on SCL and SDA

connected PN532 plus 4.7Kohm pullups and I2C scanner reports a device at 0x24

Wire - Wire scanner
---------- Scanning Wire -------------
Scanning...
I2C device found at address 0x24  !
done

---------- Scanning Wire1 ------------
Scanning...
No I2C devices found

the following code

// UNO R4 WiFi I2C PN532 NFC RFID V3 Module

// NOTE: pullups required on SCL and SDA

// Adafruit_PN532 library 
//  example File>Examples/Adafruit_PN532/readMifareClassic

/**************************************************************************/
/*!
    @file     readMifareClassic.pde
    @author   Adafruit Industries
	@license  BSD (see license.txt)

    This example will wait for any ISO14443A card or tag, and
    depending on the size of the UID will attempt to read from it.

    If the card has a 4-byte UID it is probably a Mifare
    Classic card, and the following steps are taken:

    Reads the 4 byte (32 bit) ID of a MiFare Classic card.
    Since the classic cards have only 32 bit identifiers you can stick
	them in a single variable and use that to compare card ID's as a
	number. This doesn't work for ultralight cards that have longer 7
	byte IDs!

    Note that you need the baud rate to be 115200 because we need to
	print out the data and read from the card at the same time!

This is an example sketch for the Adafruit PN532 NFC/RFID breakout boards
This library works with the Adafruit NFC breakout
  ----> https://www.adafruit.com/products/364

Check out the links above for our tutorials and wiring diagrams
These chips use SPI to communicate, 4 required to interface

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
*/
/**************************************************************************/
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>

// If using the breakout with SPI, define the pins for SPI communication.
#define PN532_SCK  (2)
#define PN532_MOSI (3)
#define PN532_SS   (4)
#define PN532_MISO (5)

// If using the breakout or shield with I2C, define just the pins connected
// to the IRQ and reset lines.  Use the values below (2, 3) for the shield!
#define PN532_IRQ   (2)
#define PN532_RESET (3)  // Not connected by default on the NFC Shield

// Uncomment just _one_ line below depending on how your breakout or shield
// is connected to the Arduino:

// Use this line for a breakout with a SPI connection:
//Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);

// Use this line for a breakout with a hardware SPI connection.  Note that
// the PN532 SCK, MOSI, and MISO pins need to be connected to the Arduino's
// hardware SPI SCK, MOSI, and MISO pins.  On an Arduino Uno these are
// SCK = 13, MOSI = 11, MISO = 12.  The SS line can be any digital IO pin.
//Adafruit_PN532 nfc(PN532_SS);

// Or use this line for a breakout or shield with an I2C connection:
// using UNO R4 WiFi GPIO22 SCL and GPIO21 SDA
Adafruit_PN532 nfc(PN532_IRQ, PN532_RESET);//, &Wire1);

void setup(void) {
  Serial.begin(115200);
  while (!Serial) delay(10); // for Leonardo/Micro/Zero

  Serial.println("Hello I2C!");

  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  // Got ok data, print it out!
  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);

  Serial.println("Waiting for an ISO14443A Card ...");
}


void loop(void) {
  uint8_t success;
  uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
  uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)

  // Wait for an ISO14443A type cards (Mifare, etc.).  When one is found
  // 'uid' will be populated with the UID, and uidLength will indicate
  // if the uid is 4 bytes (Mifare Classic) or 7 bytes (Mifare Ultralight)
  success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength);

  if (success) {
    // Display some basic information about the card
    Serial.println("Found an ISO14443A card");
    Serial.print("  UID Length: ");Serial.print(uidLength, DEC);Serial.println(" bytes");
    Serial.print("  UID Value: ");
    nfc.PrintHex(uid, uidLength);

    if (uidLength == 4)
    {
      // We probably have a Mifare Classic card ...
      uint32_t cardid = uid[0];
      cardid <<= 8;
      cardid |= uid[1];
      cardid <<= 8;
      cardid |= uid[2];
      cardid <<= 8;
      cardid |= uid[3];
      Serial.print("Seems to be a Mifare Classic card #");
      Serial.println(cardid);
    }
    Serial.println("");
  }
  delay(2000);
}


reads RFID tags and serial monitor displays

Hello I2C!
Found chip PN532
Firmware ver. 1.6
Waiting for an ISO14443A Card ...
Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0x4E 0x06 0x0C 0x04
Seems to be a Mifare Classic card #1309019140

Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0xBF 0xEC 0x0C 0x04
Seems to be a Mifare Classic card #3219917828

Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0xC0 0xFF 0x62 0x1A
Seems to be a Mifare Classic card #3237962266

Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0xC6 0x47 0xD1 0x05
Seems to be a Mifare Classic card #3326595333

Found an ISO14443A card
  UID Length: 4 bytes
  UID Value: 0x15 0x64 0xFD 0xC2
Seems to be a Mifare Classic card #358940098

photo


I connected pullup resistors from 3.3V to A4 SDA and A5 SCL

from arduino-uno-r4-wifi-pinout-reference
It is important to know that the UNO R4 WiFi does not include built-in pull-up resistors on the I2C lines by default. However, there are solder pads available on the board if you want to add them yourself.
image

EDIT: using a small soldering iron attempted to link the solder pads and failed - they are too small and too far apart

It is night here, I tried that approach, it didn't work

if you run the I2C scanner is the I2C address still 0x28

the Adafruit_PN532 library defines it as 0x24 (which is the I2C address of my PN532)

#define PN532_I2C_ADDRESS (0x48 >> 1) ///< Default I2C address

you could try editing Adafruit_PN532.h to define it to suit your PN532

#define PN532_I2C_ADDRESS (0x28) ///< Default I2C address

That is when you use a length of tinned wire to bridge the gap. Clip ends of the wire when done.

THX but didn't work, I am working a refund for another new board rn

I may jus do it tmrw, Octomber 02 2026, but will it still be worth it?

BTW It is night 11:32, here in UAE. Have to sleep

See you all tmrw!

due to nearby headers etc access to the pads with wire is all but impossible
I shall not attempt it

u are right horace, bt i do have a hot air gun and capton tape! BTW will not try. How come u are sending messages 24/7?