Go Down

Topic: how to check if a module working properly? (Read 2548 times) previous topic - next topic

knox41234

Mar 05, 2017, 05:50 pm Last Edit: Mar 05, 2017, 06:54 pm by knox41234
I just bought an RFID mc522 module for arduino. Downloaded the library from miguelbalboa. loaded the example for readandwrite, hooked up the pins to my arduino uno. upload it, and opened serial monitor.

it did not ready any of the tags that it came along with it. how do i know that the module is in good condition?


thanks

spycatcher2k

OK - It's line 67 of the code (You have not provided), and the red wire is in the wrong pin (looking at the picture if your setup you have not posted) as shown in the picture on the web site where you got the module (That you haven't told us about), and where is the link to the library you downloaded?

See why you can't get any answers yet?
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

knox41234

my question you know is "how to check if my module is working properly". what i ment with this is that how would i know if the product i bought did not contain any defects hardware - wise. i can assure you that i did connect all the pins correctly and i pretty much trust the code that came with it..

im sorry for being new

spycatcher2k

If you know it's connected up properly, and the code is good, and the tag is good, it MUST be faulty. But I doubt that as over 99% of problems reported on the forums I'm a member of tend to be down to wiring, or using incorrect libraries for the board.

Could you post all the information requested, without this I will not respond to any more questions.
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

DrAzzy

How to determine if the module is working correctly depends on the specific breakout board; the manufacturer may provide a test procedure. Often though, you will need to write a sketch to test it - which leads you to the awkward situation of not knowing whether the problem is your wiring, your test sketch, or the module. This is a problem we all face.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

johnwasser

"it did not ready any of the tags that it came along with it."


Assuming you meant to say "It failed to read any of the RFID tags that came with it." then you can be sure that something is wrong with the hardware or software.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

knox41234

As per request.

i have read this

http://playground.arduino.cc/Learning/MFRC522

and gave me the link to the library

https://github.com/miguelbalboa/rfid



For the code i just used the one that came with the library. I cut the code because it exceeds the allowable length

Code: [Select]

/**
 * ----------------------------------------------------------------------------
 * This is a MFRC522 library example; see https://github.com/miguelbalboa/rfid
 * for further details and other examples.
 *
 * NOTE: The library file MFRC522.h has a lot of useful info. Please read it.
 *
 * Released into the public domain.
 * ----------------------------------------------------------------------------
 * This sample shows how to read and write data blocks on a MIFARE Classic PICC
 * (= card/tag).
 *
 * BEWARE: Data will be written to the PICC, in sector #1 (blocks #4 to #7).
 *
 *
 * 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 RST_PIN         9           // Configurable, see typical pin layout above
#define SS_PIN          10          // Configurable, see typical pin layout above

MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.

MFRC522::MIFARE_Key key;

/**
 * Initialize.
 */
void setup() {
    Serial.begin(9600); // Initialize serial communications with the PC
    while (!Serial);    // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
    SPI.begin();        // Init SPI bus
    mfrc522.PCD_Init(); // Init MFRC522 card

    // Prepare the key (used both as key A and as key B)
    // using FFFFFFFFFFFFh which is the default at chip delivery from the factory
    for (byte i = 0; i < 6; i++) {
        key.keyByte[i] = 0xFF;
    }

    Serial.println(F("Scan a MIFARE Classic PICC to demonstrate read and write."));
    Serial.print(F("Using key (for A and B):"));
    dump_byte_array(key.keyByte, MFRC522::MF_KEY_SIZE);
    Serial.println();
    
    Serial.println(F("BEWARE: Data will be written to the PICC, in sector #1"));
}

/**
 * Main loop.
 */
void loop() {
    // Look for new cards
    if ( ! mfrc522.PICC_IsNewCardPresent())
        return;

    // Select one of the cards
    if ( ! mfrc522.PICC_ReadCardSerial())
        return;

    // Show some details of the PICC (that is: the tag/card)
    Serial.print(F("Card UID:"));
    dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
    Serial.println();
    Serial.print(F("PICC type: "));
    MFRC522::PICC_Type piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
    Serial.println(mfrc522.PICC_GetTypeName(piccType));

    // Check for compatibility
    if (    piccType != MFRC522::PICC_TYPE_MIFARE_MINI
        &&  piccType != MFRC522::PICC_TYPE_MIFARE_1K
        &&  piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
        Serial.println(F("This sample only works with MIFARE Classic cards."));
        return;
    }

    // In this sample we use the second sector,
    // that is: sector #1, covering block #4 up to and including block #7
    byte sector         = 1;
    byte blockAddr      = 4;
    byte dataBlock[]    = {
        0x01, 0x02, 0x03, 0x04, //  1,  2,   3,  4,
        0x05, 0x06, 0x07, 0x08, //  5,  6,   7,  8,
        0x08, 0x09, 0xff, 0x0b, //  9, 10, 255, 12,
        0x0c, 0x0d, 0x0e, 0x0f  // 13, 14,  15, 16
    };
    byte trailerBlock   = 7;
    MFRC522::StatusCode status;
    byte buffer[18];
    byte size = sizeof(buffer);

.............




Here is a picture of the wiring and the board.





For the tags that came along when i bought it. i Have tried reading it using my android and it works

here is the tag on top of the module and a snap of the serial monitor.







forgive me.

Omikron777


I apologize for the time between posts, but the solution to this problem, the images by the OP are not loading - so the problem for anyone new encountering it (like myself) is still just that - a problem.

The OP figured out why pins 9 and 10 were asking for redefinition (on an Arduino Uno 3 w/RC522 Module at 3.3v, the setup using power drawn from a USB 2.0 cable connected to a laptop computer, using the libraries as posted from GitHub.com and using the most recent Arduino IDE available currently) - can anyone explain what is happening here causing the board to continually register this problem and how one might fix it (w/o an "expert" on an open forum soliciting money for writing code preferably...)?  I've googled this numerous times - the problem has persisted since 2014...never a clear answer except potentially by the OP in this topic...but w/o the images, I still fail to understand...

The output I receive is exactly the same, and it's a brick wall that really makes no sense.

I'm half tempted to ditch the Uno R3 and use an esp8266 board since there seems to be no pinning v coding problems...perhaps even a Pi 3+...?  But, ~4 yrs. of reading back about this problem up to this post, if the OP isn't reading, perhaps someone else can explain this recurring issue..(?)

Any help would be appreciated.

Go Up