Hi all,
I'm working on a project using an Arduino Uno, ITEAD PN532 module (datasheet), servomotors and WS2811 LEDs. I'm having issues with the stability on the PN532 boards. I would greatly appreciate any help, as I have no idea how to fix this issue.
The issue is that
- When powered from USB connected to my laptop, the boards are found most of the time. It happens that one is not found but if I restart the board without touching any wiring, it will work
- When powered from USB connected to a power bank, the boards are never found
By "boards are found / not found", I mean that the following code from the Adafruit_PN532 library returns (or does not return ) version data :
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.print("Didn't find PN53x board");
set_error_state();
}
If the Arduino cannot connect to the board, it gets into error mode, which lights the LEDs in red and halts
void set_error_state() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::Red;
}
FastLED.show();
delay(1000);
while(1); // halt
}
This allows me to visually know that no version data was found, which means that the PN532 board was not found.
Do you have any idea of what could generate this behavior ?
More general information :
Example schematics of the wiring of multiple PN532 boards (not the entire schematics, as it misses a couple boards, it's not the exact pins I used and the other components are missing, but the general idea is there)
Here is the minimal code that I could trim down to reproduce the behavior. It's basically only the setup part
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>
#include <FastLED.h>
FASTLED_USING_NAMESPACE
#define DATA_PIN 9
#define LED_TYPE WS2811
#define COLOR_ORDER RGB
#define NUM_LEDS 4
CRGB leds[NUM_LEDS];
#define BRIGHTNESS 96
#define FRAMES_PER_SECOND 120
#define N_BOARDS (4)
Adafruit_PN532 nfc_1(2, 5, 3, 4);
Adafruit_PN532 nfc_2(2, 5, 3, 6);
Adafruit_PN532 nfc_3(2, 5, 3, 7);
Adafruit_PN532 nfc_4(2, 5, 3, 8);
Adafruit_PN532 boards[N_BOARDS] = {nfc_1, nfc_2, nfc_3, nfc_4};
void setup_nfc(Adafruit_PN532 nfc, int i) {
Serial.println((String)"Setting up board #"+i);
delay(5000);
nfc.begin();
uint32_t versiondata = nfc.getFirmwareVersion();
if (!versiondata) {
Serial.print("Didn't find PN53x board");
set_error_state();
}
// 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);
// configure board to read RFID tags
nfc.SAMConfig();
}
void set_error_state() {
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::Red;
}
FastLED.show();
delay(1000);
while(1); // halt
}
void setup(void) {
Serial.begin(115200);
while (!Serial) delay(100);
// Setup LEDs
FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
// Setup NFC boards
for (int i = 0; i < N_BOARDS; i++) {
setup_nfc(boards[i], i);
}
delay(3000); // 3 second delay for recovery
}
void loop(void) {
// do stuff...
}
When not finding the boards, this would print the following and light the LEDs red
-> Setting up board #0
-> Didn't find PN53x boardError
When finding the boards, this would print
-> Setting up board #0
-> Found chip PN532
-> Firmware ver. 1.6
-> Setting up board #1
-> Found chip PN532
-> Firmware ver. 1.6
-> Setting up board #2
-> Found chip PN532
-> Firmware ver. 1.6
-> Setting up board #3
-> Found chip PN532
-> Firmware ver. 1.6
I've tried two different power banks. They both work to turn on the Arduino and then the LEDs are all turned red from the error state. The specs from the power banks are :
- PNY M4H4 / Output : USB 5V 2.1A 5200mAh 24Wh
- Sony CP-V3A / Output : USB 5V 1.5A 1600mAh 8.0Wh
Thank you for reading this far and helping me out ![]()




