Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more.
0

RFID WiFi Reader problems
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

RFID WiFi Reader problems

by ChrisBoBMMS on Tue Jul 30, 2019 11:25 pm

Hello,
I built A WiFi RFID reader using a Huzza Feather and PN532 breakout board. Actually I built a few of them, but one has started to give me trouble and I'm not sure how to troubleshoot the intermittent problem.
All they do is read the rfid serial number, send it via http, then output a text message on an oled display based on the http response.
The problem is that on the one reader it will occasionally simply stop responding - usually after a few minutes of idle time. When reset, the whole system works again. It almost feels like something is going to sleep. Ideas to check? I could replace components one at a time, but it's tough to tell when a replacement is effective. The same Arduino program is loaded in each of the readers i have built.

ChrisBoBMMS
 
Posts: 11
Joined: Wed Aug 31, 2016 1:59 pm

Re: RFID WiFi Reader problems

by adafruit_support_mike on Wed Jul 31, 2019 2:11 pm

Check the Wifi connection state periodically, to make sure it’s still working.

Wireless connections are much more sensitive to noise and interference than wired connections. The question isn’t “will the link drop?” but “when will the link drop?”

Any wireless device that works over the long term needs to check its connection and reconnect when necessary.

adafruit_support_mike
 
Posts: 61014
Joined: Thu Feb 11, 2010 2:51 pm

Re: RFID WiFi Reader problems

by ChrisBoBMMS on Fri Jan 17, 2020 2:36 am

So, update (quite a bit after the fact)

I'm still having the problem periodically. Review, I have used the following to make a wifi rfid reader:

Huzzah ESP8266 Feather
PN532 breakout board
OLED 128x32 FeatherWing
NeoPixel FeatherWing

It is being powered by a LiIon 2500mhA battery which is being charged by a USB LiIon charger (PID: 259)

It works for days on end (12 + hours a day) and is usually plugged in via USB. I replaced the batteries recently, but occasionally stops working - primarily it stops reading the RFID. It tends to be an intermittent problem and I haven't had it happened when connected directly via USB to a computer so that I can monitor the serial output, however, I have been able to monitor the power consumption (using the discontinued Charger Doctor PID:1852) and when it happens, the current draw goes from about 150 mA to maybe 20mA.
The displays remain lit, it's just that the RFID stops reading. If I reset the device (disconnect power power from the esp8266) and reapply) it might scan one RFID tag, but then might freeze again. It seems that when I unplug the the usb from the charging circuit and reset, it behaves a little better. It feels like the charging circuit is experiencing a voltage drop causing the PN 532 to stop working, but it's been difficult to identify.

This is not a WiFi issue, as if it's not connected, the RFID tokens are still read and the display indicates the rfid was read but it wasn't forwarded to the network.
I actually have 3 of these systems and they all occasionally have the problem, but sometimes it gets really annoying.
Any ideas for what the problem might actually be or ways I can test for problems?

ChrisBoBMMS
 
Posts: 11
Joined: Wed Aug 31, 2016 1:59 pm

Re: RFID WiFi Reader problems

by adafruit_support_mike on Fri Jan 17, 2020 3:44 am

Hmm.. that sounds like the PN532 is hanging.

Check the RSTOUT_N pin's voltage the next time you see a hang. That pin goes low when the PN532 is in a reset state.

Also try pulling RSTPD_N low for a second then sending it high again to see if that makes the chip start working again. That pin controls the PN532's power-down reset, which will shut off all the power supplies in the chip until RSTPD_N goes high again.

If the problem never happens when the system is connected to USB power, I suspect it's related to the stability of the power supply. The PN532 has a low-voltage shutdown feature, and a dip in power could trip that.

adafruit_support_mike
 
Posts: 61014
Joined: Thu Feb 11, 2010 2:51 pm

Re: RFID WiFi Reader problems

by ChrisBoBMMS on Thu Jan 23, 2020 4:32 am

I added some debugging code to my sketch. I can replicate the problem by disconnecting the PN532 and reconnecting it and at this point assume that I'm getting a condition where the card resets and I lose communication with it. When the card is disconnected, I don't get version data, but when I reconnect it, I can again query and receive firmware info with (in the main program loop)
Code: Select all | TOGGLE FULL SIZE
  uint32_t versiondata = nfc.getFirmwareVersion();
  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);


So, I define the following before the setup, then in the setup, I have the following code:
Code: Select all | TOGGLE FULL SIZE
// PN543 Definition
#define PN532_SCK  (14)
#define PN532_MOSI (13)
#define PN532_SS   (15)
//#define PN532_SS   (2) for original feather pinout
#define PN532_MISO (12)
Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);

void setup(void) {
...
nfc.begin();
  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  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();
...


So, is there a function that I could use to test if the PN532 is successfully waiting for a read (getFirmwareVersion doesn't seem to work for that purpose)
and if I can determine that it isn't, what all do I actually need to include to restart it?

Chris

adafruit_support_mike wrote:Hmm.. that sounds like the PN532 is hanging.

Check the RSTOUT_N pin's voltage the next time you see a hang. That pin goes low when the PN532 is in a reset state.

Also try pulling RSTPD_N low for a second then sending it high again to see if that makes the chip start working again. That pin controls the PN532's power-down reset, which will shut off all the power supplies in the chip until RSTPD_N goes high again.

If the problem never happens when the system is connected to USB power, I suspect it's related to the stability of the power supply. The PN532 has a low-voltage shutdown feature, and a dip in power could trip that.

ChrisBoBMMS
 
Posts: 11
Joined: Wed Aug 31, 2016 1:59 pm

Re: RFID WiFi Reader problems

by adafruit_support_mike on Thu Jan 23, 2020 4:50 am

We don't have any functions to test for that in the PN532 library. You'd probably have to set a watchdog timer and let it trip if the PN532 doesn't respond.

It does sound like you're having a connection problem. Post a photo showing your hardware and connections and we'll see if those have any clues. 800x600 images usually work best.

adafruit_support_mike
 
Posts: 61014
Joined: Thu Feb 11, 2010 2:51 pm

Re: RFID WiFi Reader problems

by ChrisBoBMMS on Thu Jan 23, 2020 4:53 pm

For now, I decided to give up tracking down the connection problem and concentrate on how to make it work when it reconnects (I think it has to do with running on battery through the charger). I included a timeout on my passive read and send nfc.SAMConfig() after the timeout.

Code: Select all | TOGGLE FULL SIZE
success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLength, 5000);
  if (nfc.SAMConfig()){
     Serial.println("PN532 Receiving Commands");
  }  else {
     Serial.println("PN532 Not Receiving Commands");
  }


Now, when I disconnect the PN532, I get the "Not Receiving Commands" note in my serial log, but when I reconnect it (and wait for "Receiving Commands) it will go back to working.

adafruit_support_mike wrote:We don't have any functions to test for that in the PN532 library. You'd probably have to set a watchdog timer and let it trip if the PN532 doesn't respond.

It does sound like you're having a connection problem. Post a photo showing your hardware and connections and we'll see if those have any clues. 800x600 images usually work best.

ChrisBoBMMS
 
Posts: 11
Joined: Wed Aug 31, 2016 1:59 pm

Re: RFID WiFi Reader problems

by adafruit_support_mike on Fri Jan 24, 2020 3:15 am

If that solution works for your application, it sounds like you're good to go. Happy hacking!

adafruit_support_mike
 
Posts: 61014
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.