issue with card reader mc522

im having issues with getting the reader to read any cards.

this is the code im using…

/*

  • MFRC522 - Library to use ARDUINO RFID MODULE KIT 13.56 MHZ WITH TAGS SPI W AND R BY COOQROBOT.
  • The library file MFRC522.h has a wealth of useful info. Please read it.
  • The functions are documented in MFRC522.cpp.
  • Based on code Dr.Leong ( WWW.B2CQSHOP.COM )
  • Created by Miguel Balboa (circuitito.com), Jan, 2012.
  • Rewritten by Søren Thing Andersen (access.thing.dk), fall of 2013 (Translation to English, refactored, comments, anti collision, cascade levels.)
  • Released into the public domain.
  • Sample program showing how to read data from a PICC using a MFRC522 reader on the Arduino SPI interface.
    *----------------------------------------------------------------------------- empty_skull
  • Aggiunti pin per arduino Mega
  • add pin configuration for arduino mega
  • http://mac86project.altervista.org/
    ----------------------------------------------------------------------------- Nicola Coppola
  • Pin layout should be as follows:
  • Signal Pin Pin Pin
  • Arduino Uno Arduino Mega MFRC522 board

  • Reset 9 5 RST
  • SPI SS 10 53 SDA
  • SPI MOSI 11 51 MOSI
  • SPI MISO 12 50 MISO
  • SPI SCK 13 52 SCK
  • The reader can be found on eBay for around 5 dollars. Search for “mf-rc522” on ebay.com.
    */
    #include <SPI.h>
    #include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.

void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
Serial.println(“Scan PICC to see UID and type…”);

}

void loop() {
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;//go to start of loop if no card present

}

// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;//if ReadCardSerial returns 1, the “uid” struct (see MFRC522.h lines 236-45 contains the ID of the read card.

}

// Dump debug info about the card. PICC_HaltA() is automatically called.
mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
}

when i look at serial monitor it never shows any reading of card or fob. am i missing something in the code? ive tried a few different sources of the code but im sure its about the same. the led on the board is lit and i have checked the wiring many times.

im new at this so any help would be appreciated.

Please

  1. use code tags ==> # button above smiley’s
  2. use CTRL-T in the IDE to improve readability

Second add more print statements so you can see where the code fails.
In fact after every statement would be good.

Third you’re not telling what board you are using, that might help to diagnose.
is it a 5V board or a 3.3V board?

Which version of the IDE are you using?
Is the library compatible with that version? (There was a big break when 1.x. came

Do the SD cards work with other libraries?

can you post a drawing of your wiring (drawing can be sufficient).
Redoing all wires sometimes help, just checking them might not be enough.

Do you have a DMM?

How do you power the devices?

Have you looked into the code of the library to see what it is doing?
I’m not familiar with the lib, but it seems enough people have worked on it (so I expect it works)

Does
mfrc522.PCD_Init(); // Init MFRC522 card

return a value, if so what?

enough questions I guess …

the code seems to be fine. it up loads without a issue. im not sure where to read if the code is failing since it looks like everything is ok. the board is a funduino 5v board which is a clone of it but it is a uno. as for the wiring, it should be correct since ive seen on many pages of how its done and today i even swapped the reader board out with another and im still having the issue. im using the newest version 1.0.6 so im unsure if theres a lib issue with it but when i compile it doesnt say anything is wrong. but there could be and its not telling me. im unsure the sd card your referring to and also what a dmm is. its powered by the pc usb port.

Does
mfrc522.PCD_Init(); // Init MFRC522 card

do u want me to upload that code or what do u want me to do with it?

metallica21156:
Does
mfrc522.PCD_Init(); // Init MFRC522 card

do u want me to upload that code or what do u want me to do with it?

No, he wants you to go look in the header file and see if that function is supposed to return a value. If so, go look in the .cpp file and see what it is supposed to return.

i looked in the header file, where abouts could/would it be?

I don't have the library.

That function has to be declared in there somewhere. What does it say it returns?

i looked in the header file, where abouts could/would it be?

If you can't tell, perhaps you should let someone else look, by posting a link to the library.