PN532 NFC Shield with ESP32 Thing

ThrowAway
Posts: 1
Joined: Thu Jan 26, 2017 3:34 am

PN532 NFC Shield with ESP32 Thing

Postby ThrowAway » Thu Jan 26, 2017 4:37 am

Hello,

I've been primarily a lurker on these forums, trying to learn and apply some material on the ESP32 Thing from Sparkfun and Adafruit's PN532 NFC Shield. However, I've not had much luck lately.

Ultimately, I have a few quick questions:

(1) Is the Adafruit PN532 even compatible with Sparkfun's ESP32 Thing?
(2) If it is compatible, then could somebody explain if there certain pins on the ESP32 that need to be connected?

As of right now, I've connected analog pins 4 and 5, VCC, and ground from an Arduino Uno to the same pins on the NFC shield and it'll work fine displaying the current firmware. However, when I try to connect analog pins 4 and 5, VCC, and ground from the shield to an ESP32, I'll get a message on the serial monitor saying "Didn't find PNxx board".

(3) If I'm connecting everything correctly, then is there something I'm missing on my code? All the libraries should be the ones that come from recommended ones from Adafruit.

Code: Select all

/*
 *  N F C    R E A D E R 
 * 
 */
#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>   // The following files are included in the libraries Installed
#include <NfcAdapter.h>

PN532_I2C pn532_i2c(Wire);
NfcAdapter nfc = NfcAdapter(pn532_i2c);  // Indicates the Shield you are using

void setup(void) {
  Serial.begin(115200);
  Serial.println("NFC TAG READER"); // Header used when using the serial monitor
  nfc.begin();
}

 
void loop(void) {
  Serial.println("\nLooking for NFC tag\n");  // Command so that you and others will know what to do 

  if (nfc.tagPresent())
  {
    NfcTag tag = nfc.read();
    Serial.println(tag.getTagType());
    Serial.print("UID: ");Serial.println(tag.getUidString()); // Retrieves the Unique Identification from your tag

    if (tag.hasNdefMessage()) // If your tag has a message
    {

      NdefMessage message = tag.getNdefMessage();
      Serial.print("\nThis Message in this Tag is ");
      Serial.print(message.getRecordCount());
      Serial.print(" NFC Tag Record");
      if (message.getRecordCount() != 1) { 
        Serial.print("s");
      }
      Serial.println(".");

      // If you have more than 1 Message then it wil cycle through them
      int recordCount = message.getRecordCount();
      for (int i = 0; i < recordCount; i++)
      {
        Serial.print("\nNDEF Record ");Serial.println(i+1);
        NdefRecord record = message.getRecord(i);

        int payloadLength = record.getPayloadLength();
        byte payload[payloadLength];
        record.getPayload(payload);


        String payloadAsString = ""; // Processes the message as a string vs as a HEX value
        for (int c = 0; c < payloadLength; c++) {
          payloadAsString += (char)payload[c];
        }
        Serial.print("  Information (as String): ");
        Serial.println(payloadAsString);


        String uid = record.getId();
        if (uid != "") {
          Serial.print("  ID: ");Serial.println(uid); // Prints the Unique Identification of the NFC Tag
        }
      }
    }
  }
  delay(1000);
}

Well, I hope I could explain my question clearly. But if anybody needs me to clarify anything or has any constructive criticism please let me know! Thanks for your time!

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: PN532 NFC Shield with ESP32 Thing

Postby WiFive » Thu Jan 26, 2017 6:17 am

Please post arduino questions in the arduino forum

https://learn.sparkfun.com/tutorials/es ... uino-addon

phuongpreo
Posts: 2
Joined: Thu Jun 28, 2018 12:59 am

Re: PN532 NFC Shield with ESP32 Thing

Postby phuongpreo » Tue Sep 25, 2018 12:49 pm

hey Bro,

Did you fix your problem?

Currently I am like you, do not know how to repair?

((:

Marco_Parada
Posts: 1
Joined: Mon Nov 19, 2018 2:35 am

Re: PN532 NFC Shield with ESP32 Thing

Postby Marco_Parada » Mon Nov 19, 2018 2:57 am

Buenas . He comprado un módulo PN 532 para elaborar un control de acceso y apertura de una puerta corrediza , con un sistema multifuncional con la placa ESP32 y un motorreductor DC ,,algunos Tags ,unos llaveros RFID , unos módulos RF de 315 MHz , e incluso usar el NFC del celular y la network ,; puede sonar un proyecto muy ambicioso máximo cuando tengo muy poca experiencia en programación y menos aún en esta nueva y funcional placa.
Por eso le hago la consulta. ? Ha avanzado en su proyecto? ,Me podría orientar así fuese un poco? . Saludos. Desde Cúcuta Colombia

Who is online

Users browsing this forum: Google [Bot] and 54 guests