MiFare RFID Reader RC522 - Broken module or faulty code?


First of all I’m really, really green when it comes to programming. So I apologise in advance for any ‘stupid’ questions I might have.
Concerning my first project though, I’ve decided to buy the MiFare RFID RC522 to use with my new Arduino starter-kit. The thing is: no matter which example code/sketch I use, the output either doesn’t show or is very distorted. I got it to work once, but then somehow it stopped working completely. Now I’m using the following code (unedited by me), which is also the one I got it working with once. But now the reader isn’t recognizing the tag when I hold it in place, except maybe once in 2048 tries, when it shows strange symbols instead of the output written in the code.

* Read a card using a mfrc522 reader on your SPI interface
* Pin layout should be as follows (on Arduino Uno):
* MOSI: Pin 11 / ICSP-4
* MISO: Pin 12 / ICSP-1
* SCK: Pin 13 / ISCP-3
* SS: Pin 10
* RST: Pin 9
* Script is based on the script of Miguel Balboa. 
* New cardnumber is printed when card has changed. Only a dot is printed
* if card is the same.
* @version 0.1
* @author Henri de Jong
* @since 06-01-2013

#include <SPI.h>
#include <RFID.h>

#define SS_PIN 10
#define RST_PIN 9


// Setup variables:
    int serNum0;
    int serNum1;
    int serNum2;
    int serNum3;
    int serNum4;

void setup()

void loop()
    if (rfid.isCard()) {
        if (rfid.readCardSerial()) {
            if (rfid.serNum[0] != serNum0
                && rfid.serNum[1] != serNum1
                && rfid.serNum[2] != serNum2
                && rfid.serNum[3] != serNum3
                && rfid.serNum[4] != serNum4
            ) {
                /* With a new cardnumber, show it. */
                Serial.println(" ");
                Serial.println("Card found");
                serNum0 = rfid.serNum[0];
                serNum1 = rfid.serNum[1];
                serNum2 = rfid.serNum[2];
                serNum3 = rfid.serNum[3];
                serNum4 = rfid.serNum[4];
                delay (10);
                //Serial.println(" ");
                Serial.print("Dec: ");
                Serial.print(", ");
                Serial.print(", ");
                Serial.print(", ");
                Serial.print(", ");
                Serial.println(" ");
                delay (10);
                Serial.print("Hex: ");
                Serial.print(", ");
                Serial.print(", ");
                Serial.print(", ");
                Serial.print(", ");
                Serial.println(" ");
             } else {
               /* If we have the same ID, just write a dot. */
               delay (10);

Thanks for taking the time to read my post, and I appreciate all the input you might have!

Cardnumber: Dec: 0, 0, 0, 0, 0 Hex: 0, 0, 0,CáîCarCáîCardCardCardCardnumber: Dec: 0, 0, 0, 0, 0 Hex: 0, 0, 0, 0, 0 C

This is an example of the 'strange' output I'm getting

Hi, I have starting to work with de RFID-MFRC522 since few day.

Do you have use a 3v3 level shifter on your project ?

I have use a level shifter (CMOS CD4050) to convert the 5v of the arduino to 3v3 of the MFRC522 my shemas :

Arduino CD4050 MFRC522 MISO ----------------------- MISO MOSI ----InputA / OutputA -- MOSI CLK ----InputB / OutputB -- CLK SS(10)----InputC / OutputC -- SDA RESET(9)--InputD / OutputD -- Rst 3v3 ------------------------ 3v3 GND ------------------------ GND

(The Power of CD4050 is 3v3 ad GND)

For my, the code work except a small modification to realy show '.' if it is the same card (for me when i present 2 card, my arduino send '.')

We need to replace && to || in the if condition for exemple :

if (rfid.serNum[0] != serNum0 || rfid.serNum[1] != serNum1 || rfid.serNum[2] != serNum2 || rfid.serNum[3] != serNum3 || rfid.serNum[4] != serNum4 ) because if ONE byte is diferent, then it's not the same card.

Tell me in MP if it isn't working Timiti29

Hi, I got the same problem with you when connect my RC 522 to Arduino , it work once but somehow it stopped working completely even I use the same setting. As I saw you got the same problem before, wondering did you know how to solve it now? Thank for kindly help .