Arduino Uno to RFID-RC522 problems reading tag

Greetings,

I’m new to Arduino (my sincere apologies if i’m making any posting protocol faux pas) and am working on my first project, connecting an RFID (RFID-RC522) scanner to an Arduino Uno.

I’m running OS X Yosemite version 10. 10. 5. I have checked, double checked and triple checked the wiring, and soldered the RFID to the pin.

I am using the suggested Miguel Balboa library GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522. When using any of the examples, specifically, infodump or read/write. I’m successfully able to upload the sketches with no error messages.

When I open the serial monitor and try to scan, nothing happens.

The tags I’m using are the cards that came with the RFID scanner. Thinking that maybe the cards became corrupted I bought some stickers that are the standard 13.56MHz. Nothing.

I am attaching a few images of my wiring.

Any help you could offer would be really really appreciated.

Thanks so much

It may be an OS problem. If you put a greeting message into setup(), e.g. Serial.println("Start scanner");, can you read that message in the Serial Monitor?

Thanks so much for your response. I'll try that as soon as I get home.

Yes! I am able to read the message. Any ideas?

If you also want to see the currently detected RFID, you have to add Serial.println() statements to your code, just when an RFID is recognized. If no such output is shown, this means that the reader has not detected any RFID tag, or your code is wrong, or your wiring.

I am attaching a few images of my wiring.

Well they both show the same thing, which is not very helpful as all it is are a load of wires stuck into one end with no idea of where they go and no idea about what sort of logic level conversion you have.

That reader is a 3V3 system so all the signals going into it have to be no higher than 3V3. If you are connecting it to an Arduino which is running on 3V3 then fine. However if you are running it off a 5V Arduino then you need to put each of the output signals through a potential divider, I used 510R and 1K. I found that without this the reader got fried, well mine did anyway.

Are you powering it from the 3V3 output of the Arduino?

I had some problems uploading the photos, they were too big, I had to upload them a few times and didn't realize they were the same one. I'll fix that now. The other picture will show that it is wired to the 3v3 spot.

Here is the code that I got from here: GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522

/*


  • Example sketch/program showing how to read new NUID from a PICC to serial.

  • This is a MFRC522 library example; for further details and other examples see: GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522
  • Example sketch/program showing how to the read data from a PICC (that is: a RFID Tag or Card) using a MFRC522 based RFID
  • Reader on the Arduino SPI interface.
  • When the Arduino and the MFRC522 module are connected (see the pin layout below), load this sketch into Arduino IDE
  • then verify/compile and upload it. To see the output: use Tools, Serial Monitor of the IDE (hit Ctrl+Shft+M). When
  • you present a PICC (that is: a RFID Tag or Card) at reading distance of the MFRC522 Reader/PCD, the serial output
  • will show the type, and the NUID if a new card has been detected. Note: you may see “Timeout in communication” messages
  • when removing the PICC from reading distance too early.
  • @license Released into the public domain.
  • Typical pin layout used:

  • MFRC522 Arduino Arduino Arduino Arduino Arduino
  • Reader/PCD Uno/101 Mega Nano v3 Leonardo/Micro Pro Micro
  • Signal Pin Pin Pin Pin Pin Pin

  • RST/Reset RST 9 5 D9 RESET/ICSP-5 RST
  • SPI SS SDA(SS) 10 53 D10 10 10
  • SPI MOSI MOSI 11 / ICSP-4 51 D11 ICSP-4 16
  • SPI MISO MISO 12 / ICSP-1 50 D12 ICSP-1 14
  • SPI SCK SCK 13 / ICSP-3 52 D13 ICSP-3 15
    */

#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9

MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class

MFRC522::MIFARE_Key key;

// Init array that will store new NUID
byte nuidPICC[4];

void setup() {
Serial.begin(9600);
SPI.begin(); // Init SPI bus
rfid.PCD_Init(); // Init MFRC522
Serial.println(“something else”);

for (byte i = 0; i < 6; i++) {
key.keyByte = 0xFF;

  • }*
  • Serial.println(F(“This code scan the MIFARE Classsic NUID.”));*
  • Serial.print(F(“Using the following key:”));*
  • printHex(key.keyByte, MFRC522::MF_KEY_SIZE);*
    }

void loop() {

  • // Look for new cards*
  • if ( ! rfid.PICC_IsNewCardPresent())*
  • return;*
  • // Verify if the NUID has been readed*
  • if ( ! rfid.PICC_ReadCardSerial())*
  • return;*
  • Serial.print(F("PICC type: "));*
  • MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);*
  • Serial.println(rfid.PICC_GetTypeName(piccType));*
  • // Check is the PICC of Classic MIFARE type*
  • if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI && *
  • piccType != MFRC522::PICC_TYPE_MIFARE_1K &&*
  • piccType != MFRC522::PICC_TYPE_MIFARE_4K) {*
  • Serial.println(F(“Your tag is not of type MIFARE Classic.”));*
  • return;*
  • }*
  • if (rfid.uid.uidByte[0] != nuidPICC[0] ||*
  • rfid.uid.uidByte[1] != nuidPICC[1] ||*
  • rfid.uid.uidByte[2] != nuidPICC[2] ||*
  • rfid.uid.uidByte[3] != nuidPICC[3] ) {*
  • Serial.println(F(“A new card has been detected.”));*
  • // Store NUID into nuidPICC array*
  • for (byte i = 0; i < 4; i++) {*
    nuidPICC = rfid.uid.uidByte*;*
    * }*

* Serial.println(F(“The NUID tag is:”));*
* Serial.print(F("In hex: "));*
* printHex(rfid.uid.uidByte, rfid.uid.size);*
* Serial.println();*
* Serial.print(F("In dec: "));*
* printDec(rfid.uid.uidByte, rfid.uid.size);*
* Serial.println();*
* }*
* else Serial.println(F(“Card read previously.”));*
* // Halt PICC*
* rfid.PICC_HaltA();
_ // Stop encryption on PCD*
* rfid.PCD_StopCrypto1();*
}
/
* Helper routine to dump a byte array as hex values to Serial.
/
void printHex(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer < 0x10 ? " 0" : " ");
Serial.print(buffer, HEX);
}
}*

/

* Helper routine to dump a byte array as dec values to Serial.
/
void printDec(byte *buffer, byte bufferSize) {
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer < 0x10 ? " 0" : " ");
Serial.print(buffer, DEC);
}
}*_

Woop! It was a bad soldering job! fixed it! thanks so much for your help.

Best of luck with not frying it, you have no logic level converters. It might die any time.