esp8266 and pn532

Hi guys
I have been bashing my head out for the last few days trying to get the pn532 hooked up to an esp8266 as a adafruit huzzah but have not got the thing working.
It should be possible with i2c am I right?
But i am not sure if I have the wiring correct.
The jumpers on my pn532 are set properly.
I have the SDA hooked to #2 and the SCL hooked to #0.
My code is the following:

#include <Wire.h>
#include <PN532_I2C.h>
#include <PN532.h>

PN532_I2C pn532i2c(Wire);
PN532 nfc(pn532i2c);
void setup(void) {

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Scanner board not online");
    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);
  // Set the max number of retry attempts to read from a card
  // This prevents us from waiting forever for a card, which is
  // the default behaviour of the PN532.
  // configure board to read RFID tags
  Serial.println("Waiting for an ISO14443A card");

void loop(void) {
  boolean 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[0], &uidLength);
  if (success) {
    Serial.println("Found a card!");
    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); 
  // Wait 1 second before continuing
    // PN532 probably timed out waiting for a card
    Serial.println("Timed out waiting for a card");

But the code doesn’t even get past ‘nfc.getFirmwareVersion()’
It doesn’t find the pn532 and then resets the esp8266

Can anyone please help with this?

Thanx a lot

What is that sketch suppose to do?

Is that sketch provided by Adafruit? If so, have you contacted them?


@ieee488 the sketch should just print out the pn532 board version number and wait for a tag and read the tags id and print it out.
is not from adafruit. I used the example that is provided for I2C when downloading the pn532 library from GitHub (

Unless you have code that changes the default pins, the default I2C/TWI SCL is #5 and SDA is #4 for the Adafruit Huzzah ESP8266.

Hmmmm i have tried the connection suggested but I also get the same error. And then the huzzah is reset.
Is my code somehow not working properly?
I have tested the two components separately and they both work when hooking then up to an arduino uno.
But when connecting the pn532 to the huzzah the huzzah the error occurres.
Very frustrating.
I think I must be doing something wrong though.