1

I have an RFID-RC522 module based on the MFRC522 chip. This chip is described in the datasheet as supporting "ISO/IEC 14443 A/MIFARE and NTAG" protocols. I have wired it up to an Arduino Uno using the recommended wiring in the documentation for the MFRC522 library I'm using. I have a sketch that (among other things) polls for presence of a new card:

void setup() {
    lcd.setup ();       // initialise LCD display
    SPI.begin();        // Init SPI bus
    mfrc522.PCD_Init(); // Init MFRC522 card
}

void loop() {
    // Look for new cards
    if ( ! mfrc522.PICC_IsNewCardPresent()) {
        return;
    }
    lcd.println ("Found new card");
    ...
}

This sketch correctly detects the presence of the card that was supplied with the module (I believe this is a Mifare Classic card) but does not detect my NTAG216 implant. Does anyone have any idea why it might be failing to find the implanted chip?

  • please provide more of your code, from what you've provided all I can see is that your LCD will constantly print "Found new card" over and over again... plus, you've got a return in the main loop??? – Madivad Jul 11 '16 at 2:11
  • @Madivad that code would be enough to print "Found new card" when any compatible card is brought close to the reader - perhaps the card itself is faulty? – Jaromanda X Jul 11 '16 at 12:19
  • Hi @JaromandaX the problem is that the print statement is outside the if conditional but within the main runtime loop which will just continually print Found new card. Found new card. Found new card. ad infinitum – Madivad Jul 12 '16 at 1:14
  • @Madivad you'd be correct if the conditional return was absent, however, it is not absent, and therefore you are incorrect – Jaromanda X Jul 12 '16 at 2:19
  • @JaromandaX I get your point, and I stand corrected. The return is executed if there is no new card and execution stopped, but for as long as a card is present, the println will just keep repeating. Which the OP is not getting to. I get that now. I hadn't considered a return in the main loop before, nor did I understand the implications of it. Until I just did some experiments :) – Madivad Jul 12 '16 at 6:00
1

I got my RFID kit (RF522) just this week, but I haven't had a chance to play with it yet - nor do I have an NTAG216 implant. But I remember when I was researching them seeing a couple of posts that had to do with "Authentication errors". The problem for you (maybe) is that they were in Python rather than C:

https://github.com/mxgxw/MFRC522-python/issues/24

and Cotix's link

https://github.com/mj3052/MFRC522-Pi

Give them a lookover and see what they can tell you.

The problem with the PICC_IsNewCardPresent() function is that it gives a Yes/No answer, not a "Yes, but there's an error". In that case it would also return false. But the other code may give you a clue - you'll have to delve into the library...

  • Hmm. AIUI I should be able to read the UID of the chip without authenticating (otherwise how would you know which passcode to use to authenticate with in a system with multiple cards?), but as you suggest I'll have a look through the library and see if there's a way of finding out about errors while detecting cards. It's a shame that this seems to be the only available arduino library for this chip and AFAICT almost entirely lacks documentation :( – Jules Jul 12 '16 at 7:56
  • Having investigated this further, this doesn't sound like the right answer. Authentication requires the chip to be in 'active' state before you can begin the authentication process, and the PICC_IsNewCardPresent method is supposed to find cards that are in the 'idle' state and put one of them into 'active', so must be able to handle locating the card without authenticating first. – Jules Jul 12 '16 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.