GithubHelp home page GithubHelp logo

rfid's Introduction

MFRC522

image

GitHub Actions

image

Releases

image

Arduino library for MFRC522 and other RFID RC522 based modules.

Read and write different types of Radio-Frequency IDentification (RFID) cards on your Arduino using a RC522 based reader connected via the Serial Peripheral Interface (SPI) interface.

For advanced and further development please use library RFID_MFRC522v2.


The development by owner miguelbalboa has ended.

Feature status: complete freeze; no function or API change.

Code status: partial freeze; just fixes/typos or documentation updates; no extensions for other boards; no new examples.

Maintenance status: sporadically.

Why no further development? This library has a long history and is used in many projects. These projects often do not document what version they use. Committing changes might break those old projects and lead to bad experiences (for beginners) and support requests. For these reasons the library is in freeze mode. You can still commit typo, documentation or bug fixes.

----------Please notice that there are many sellers (ebay, aliexpress, ..) who sell mfrc522 boards. The quality of these boards are extremely different. Some are soldered with wrong/low quality capacitors or fake/defect mfrc522.

Please consider buying several devices from different suppliers. So the chance of getting a working device is higher.

If you got a bad board and you can tell us how to detect those boards (silk, chip description, ..), please share your knowledge.


  • Works
    1. Communication (Crypto1) with MIFARE Classic (1k, 4k, Mini).
    2. Communication (Crypto1) with MIFARE Classic compatible PICCs.
    3. Firmware self check of MFRC522.
    4. Set the UID, write to sector 0, and unbrick Chinese UID changeable MIFARE cards.
    5. Manage the SPI chip select pin (aka SS, SDA)
  • Works partially
    1. Communication with MIFARE Ultralight.
    2. Other PICCs (Ntag216).
    3. More than 2 modules, require a multiplexer #191.
  • Doesn't work
    1. MIFARE DESFire, MIFARE DESFire EV1/EV2, not supported by software.
    2. Communication with 3DES or AES, not supported by software.
    3. Peer-to-peer (ISO/IEC 18092), not supported by hardware.
    4. Communication with smart phone, not supported by hardware.
    5. Card emulation, not supported by hardware.
    6. Use of IRQ pin. But there is a proof-of-concept example.
    7. With Intel Galileo (Gen2) see #310, not supported by software.
    8. Power reduction modes #269, not supported by software.
    9. I2C instead of SPI #240, not supported by software.
    10. UART instead of SPI #281, not supported by software.
  • Need more?
    1. If software: code it and make a pull request.
    2. If hardware: buy a more expensive like PN532 (supports NFC and many more, but costs about $15 and not usable with this library).

--------------This library works with Arduino IDE 1.6, older versions are not supported and will cause compiler errors. The built-in library manager is supported.

If you use your own compiler, you have to enable c++11-support.


!!!Only for advanced users!!!

This library is compatible with the Teensy and ESP8266 if you use the board plugin of the Arduino IDE. Not all examples are available for every board. You also have to change pins. See pin layout.

Some user made some patches/suggestions/ports for other boards:

Note that the main target/support of library is still Arduino.

-------------1. First checkout what works and not and troubleshooting .

  1. It seems to be a hardware issue or you need support to program your project?

    Please ask in the official Arduino forum, where you would get a much faster answer than on Github.

  2. It seems to be a software issue?

    Open an issue on Github.


Please use fixed integers, see stdint.h. Why? This library is compatible with different boards which use different architectures (16bit and 32bit.) Unfixed int variables have different sizes in different environments and may cause unpredictable behaviour.


The following table shows the typical pin layout used:

+-----------+----------+-----------------------------------------------------------------------------------+ | | PCD | Arduino | | +----------+-------------+---------+---------+-----------------+-----------+---------+---------+ | | MFRC522 | Uno / 101 | Mega | Nano v3 Pro Micro | Yun1| Due | +-----------+----------+-------------+---------+---------+-----------------+-----------+---------+---------+ | Signal | Pin | Pin | Pin | Pin | Pin | Pin | Pin | Pin | +===========+==========+=============+=========+=========+=================+===========+=========+=========+ | RST/Reset | RST | 92 | 53 | D9 | RESET / ICSP-5 | RST | Pin9 | 224 | +-----------+----------+-------------+---------+---------+-----------------+-----------+---------+---------+ | SPI SS | SDA5 | 106 | 537 | D10 | 10 | 10 | Pin10 | 238 | +-----------+----------+-------------+---------+---------+-----------------+-----------+---------+---------+ | SPI MOSI | MOSI | 11 / ICSP-4 | 51 | D11 | ICSP-4 | 16 | ICSP4 | SPI-4 | +-----------+----------+-------------+---------+---------+-----------------+-----------+---------+---------+ | SPI MISO | MISO | 12 / ICSP-1 | 50 | D12 | ICSP-1 | 14 | ICSP1 | SPI-1 | +-----------+----------+-------------+---------+---------+-----------------+-----------+---------+---------+ | SPI SCK | SCK | 13 / ICSP-3 | 52 | D13 | ICSP-3 | 15 | ICSP3 | SPI-3 | +-----------+----------+-------------+---------+---------+-----------------+-----------+---------+---------+

+-----------+---------------+--------------------------+-------------+ | | ESP8266 | Teensy | 8F328P-U | | +---------------+--------+--------+--------+-------------+ | | Wemos D1 mini | 2.0 | ++ 2.0 | 3.1 | ALPHA | +-----------+---------------+--------+--------+--------+-------------+ | Signal | Pin | Pin | Pin | Pin | Pin9 | +===========+===============+========+========+========+=============+ | RST/Reset | D3 | 7 | 4 | 9 | D9#10 | +-----------+---------------+--------+--------+--------+-------------+ | SPI SS | D8 | 0 | 20 | 10 | D10#11 | +-----------+---------------+--------+--------+--------+-------------+ | SPI MOSI | D7 | 2 | 22 | 11 | MOSI / D11# | +-----------+---------------+--------+--------+--------+-------------+ | SPI MISO | D6 | 3 | 23 | 12 | MISO / D12# | +-----------+---------------+--------+--------+--------+-------------+ | SPI SCK | D5 | 1 | 21 | 13 | SCK | +-----------+---------------+--------+--------+--------+-------------+

Important: If your micro controller supports multiple SPI interfaces, the library only uses the default (first) SPI of the Arduino framework.


There are three hardware components involved:

  1. Micro Controller:
  • An Arduino or compatible executing the Sketch using this library.
  • Prices vary from USD 7 for clones, to USD 75 for "starter kits" (which might be a good choice if this is your first exposure to Arduino; check if such kit already includes the Arduino, Reader, and some Tags).
  1. Proximity Coupling Device (PCD):
  • The PCD is the actual RFID Reader based on the NXP MFRC522 Contactless Reader Integrated Circuit.
  • Readers can be found on eBay for around USD 5: search for "rc522".
  • You can also find them on several web stores. They are often included in "starter kits", so check your favourite electronics provider as well.
  1. Proximity Integrated Circuit Card (PICC):
  • The PICC is the RFID Card or Tag using the ISO/IEC 14443A interface, for example Mifare or NTAG203.
  • One or two might be included with the Reader or "starter kit" already.

  1. The micro controller and the reader use SPI for communication.
  • The protocol is described in the NXP MFRC522 datasheet.
  • See the Pin Layout section for details on connecting the pins.
  1. The reader and the tags communicate using a 13.56 MHz electromagnetic field.
  • The protocol is defined in ISO/IEC 14443-3:2011 Part 3 Type A.
    • Details are found in chapter 6 "Type A – Initialization and anticollision".
    • See http://wg8.de/wg8n1496_17n3613_Ballot_FCD14443-3.pdf for a free version of the final draft (which might be outdated in some areas).
    • The reader does not support ISO/IEC 14443-3 Type B.

--------* The UID of a card can not be used as an unique identification for security related projects. Some Chinese cards allow to change the UID which means you can easily clone a card. For projects like access control, door opener or payment systems you must implement an additional security mechanism like a password or normal key.

  • This library only supports crypto1-encrypted communication. Crypto1 has been known as broken for a few years, so it does NOT offer ANY security, it is virtually unencrypted communication. Do not use it for any security related applications!
  • This library does not offer 3DES or AES authentication used by cards like the Mifare DESFire, it may be possible to be implemented because the datasheet says there is support. We hope for pull requests :).

  • I don't get input from reader or WARNING: Communication failure, is the MFRC522 properly connected?
    1. Check your physical connection, see Pin Layout .
    2. Check your pin settings/variables in the code, see Pin Layout .
    3. Check your pin header soldering. Maybe you have cold solder joints.
    4. Check your power supply. Maybe add a capacitor between 3.3V and GND to stabilize the power #560, sometimes an additional delay after PCD_Init() can help.
    5. Check voltage. Most breakouts work with 3.3V.
    6. SPI only works with 3.3V, most breakouts seem 5V tolerant, but try a level shifter.
    7. SPI does not like long connections. Try shorter connections.
    8. SPI does not like prototyping boards. Try soldered connections.
    9. According to reports #101, #126 and #131, there may be a problem with the soldering on the MFRC522 breakout. You could fix this on your own.
  • Firmware Version: 0x12 = (unknown) or other random values
    1. The exact reason of this behaviour is unknown.
    2. Some boards need more time after PCD_Init() to be ready. As workaround add a delay(4) directly after PCD_Init() to give the PCD more time.
    3. If this sometimes appears, a bad connection or power source is the reason.
    4. If the firmware version is reported permanent, it is very likely that the hardware is a fake or has a defect. Contact your supplier.
  • Sometimes I get timeouts or sometimes tag/card does not work.
    1. Try the other side of the antenna.
    2. Try to decrease the distance between the MFRC522 and your tag.
    3. Increase the antenna gain per firmware: mfrc522.PCD_SetAntennaGain(mfrc522.RxGain_max);
    4. Use better power supply.
    5. Hardware may be corrupted, most products are from china and sometimes the quality is really poor. Contact your seller.
  • My tag/card doesn't work.
    1. Distance between antenna and token too large (>1cm).
    2. You got the wrong type PICC. Is it really 13.56 MHz? Is it really a Mifare Type A?
    3. NFC tokens are not supported. Some may work.
    4. Animal RFID tags are not supported. They use a different frequency (125 kHz).
    5. Hardware may be corrupted, most products are from china and sometimes the quality is really poor. Contact your seller.
    6. Newer versions of Mifare cards like DESFire/Ultralight maybe not work according to missing authentication, see security or different protocol.
    7. Some boards bought from Chinese manufactures do not use the best components and this can affect the detection of different types of tag/card. In some of these boards, the L1 and L2 inductors do not have a high enough current so the signal generated is not enough to get Ultralight C and NTAG203 tags to work, replacing those with same inductance (2.2uH) but higher operating current inductors should make things work smoothly. Also, in some of those boards the harmonic and matching circuit needs to be tuned, for this replace C4 and C5 with 33pf capacitors and you are all set. (Source: Mikro Elektronika)
  • My mobile phone doesn't recognize the MFRC522 or my MFRC522 can't read data from other MFRC522
    1. Card simulation is not supported.
    2. Communication with mobile phones is not supported.
    3. Peer to peer communication is not supported.
  • I can only read the card UID.
    1. Maybe the AccessBits have been accidentally set and now an unknown password is set. This can not be reverted.
    2. Probably the card is encrypted. Especially official cards like public transport, university or library cards. There is no way to get access with this library.
  • Where do I get more information?
    1. For general support from the community, see Arduino Forum or StackOverflow .
    2. Visit the community mfrc522 wiki .
    3. Read the datasheets!
    4. Your preferred search engine.
  • I need more features.
    1. If software: code it and make a pull request.
    2. If hardware: buy a more expensive chip like the PN532 (supports NFC and many more, but costs about $15)

-------This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to https://unlicense.org/


  • Arduino.h
    • From: Arduino IDE / target specific
    • License: (target: Arduino) GNU Lesser General Public License 2.1
  • SPI.h
    • From: Arduino IDE / target specific
    • License: (target: Arduino) GNU Lesser General Public License 2.1
  • stdint.h
    • From: Arduino IDE / Compiler and target specific
    • License: different

History

The MFRC522 library was first created in Jan 2012 by Miguel Balboa (from http://circuitito.com) based on code by Dr. Leong (from http://B2CQSHOP.com) for "Arduino RFID module Kit 13.56 Mhz with Tags SPI W and R By COOQRobot".

It was translated into English and rewritten/refactored in the fall of 2013 by Søren Thing Andersen (from http://access.thing.dk).

It has been extended with functionality to alter sector 0 on Chinese UID changeable MIFARE card in Oct 2014 by Tom Clement (from http://tomclement.nl).

Maintained by miguelbalboa until 2016. Maintained by Rotzbua from 2016 until 2022.


  1. Source: #111 .

  2. Configurable, typically defined as RST_PIN in sketch/program.

  3. Configurable, typically defined as RST_PIN in sketch/program.

  4. Configurable, typically defined as RST_PIN in sketch/program.

  5. The SDA pin might be labeled SS on some/older MFRC522 boards.

  6. Configurable, typically defined as SS_PIN in sketch/program.

  7. Configurable, typically defined as SS_PIN in sketch/program.

  8. Configurable, typically defined as SS_PIN in sketch/program.

  9. Pin names from the back (empty) side of the board were used as more definitive.

  10. Configurable, typically defined as RST_PIN in sketch/program.

  11. Configurable, typically defined as SS_PIN in sketch/program.

rfid's People

Contributors

aiolos avatar anistor avatar asomov avatar cuthbertnibbles avatar danielcbit avatar denisvm avatar dependabot[bot] avatar gargantuanman avatar gpancot avatar grapheo12 avatar greezybacon avatar heziegl avatar ivankravets avatar mayatforest avatar mdxs avatar miguelbalboa avatar nicolacoppola avatar omersiar avatar randptr avatar ricardojlrufino avatar rotzbua avatar sophiekovalevsky avatar stefanspieker avatar sthing avatar surr avatar tjclement avatar tonycallear avatar tuyethoa08041997 avatar unknown-consortium avatar wa4osh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rfid's Issues

Missing wipe on magic cards

I'm missing the wipe (reset to default) for the magic chinese cards.
I tried to implement it myself (transmitting 0x41 instead of 0x43 in backdoor) but it doesn't seem to work.
Do you have more information on how to properly do it ?
Maybe my cards are different because they don't respond 0x0A to the backdoor, still the write to block 0 works.

RFID RC522 and ISO 14443-4 transmission protocol

Hi!

Thanks a lot for the library!
I would like to know if there is a possibility to add support for 14443-4 (transmission protocol). I would like to exchange data between my phone and my other cards of this type. I see this for the functionality is not added.

Is it possible to add support for this standard and if you have it on your TODO list?
After reading the documentation (look at image) I came to the conclusion that my knowledge on this topic is too low :/

20150301_172645

Thank you in advance!

Best regards
Stefan

Sketch for detecting presence of the card - could you please explain?

Hello!

I bought some RC-522 readers for a device that needs to sense when an RFID card with a specific UID is present on it (turning off as soon as card is removed), so the debug version of sketch would be constantly checking whether card is there or not and sending this data to Serial. I've started with a DumpInfo example, which worked flawlessly, then read through .h and .cpp library files. I've come up with this sketch which works as intended:

boolean card_present = false;

void loop() {
  mfrc522.PICC_ReadCardSerial(); //Always fails
  mfrc522.PICC_IsNewCardPresent(); //Does RequestA 
  if (! mfrc522.PICC_ReadCardSerial()) { //Okay. This does the same PICC_Select as the previous ReadCardSerial(), but this one fails if there is no card on the reader. Funny. 
    //Seems like we need two Select's in a row to detect card's presence.
    card_present = false;
  }
    else {
    card_present = true; //variable for my own purposes
    print_uid(&(mfrc522.uid)); //prints UID in human-readable form for debugging
    uid = mfrc522.uid;
    }
  print_presence(); //prints "Card present" or "Card not present"
  delay(1000);
}

I don't really understand why should there be two Select calls, but without the first one only every second iteration of loop() produces a valid result. The first call seems to always fail (not STATUS_OK). I understand that the first Select must be calling some lower-level function that makes it fail but resets something so it detects the card the next time Select() is called. What would that function be? Or is it that I'm just using it wrong?

Also, once that's clear - would that be any good for an example sketch? I'd gladly make a pull request =)

Write tag to card

Hello

Is this library able to write a tag to a RFID tag?
-- Thomas

RC522 with SD Card reader

Hello
I'm new to arduino and such stuffs
trying to attach rc522 and sd card reader to my arduino uno
what can i do with the shared pins?

tnx in advance

Changing the MFRC522 Receiver Gain

Inspired by the "Extend range for MFRC522 RFID Reader" discussion at http://forum.arduino.cc/index.php?topic=199983.0 I've played around a bit.

Initially, I followed the approach "omersiar" described in that discussion: to alter the PCD_Init() implementation within the .cpp of the library. But somehow it didn't feel right... and the approach didn't seem to respect reserved/future bits either.

So, I reverted the library changes and found that the following works to set the Rx Gain to it's maximum value (which is documented to be some 48 dB; see 9.3.3.6 / table 98):

    mfrc522.PCD_Init();  // NOTE: unmodified initialization...
    // Enhance the MFRC522 Receiver Gain to maximum value of some 48 dB
    mfrc522.PCD_SetRegisterBitMask(mfrc522.RFCfgReg, (0x07<<4));

Note that this is done inside the sketch, within the regular setup. Perhaps one can also change it from within the main loop. Possibly cycling through the options by some button being pressed?

While above code works to maximize the Rx Gain, in order to minimize it... we need:

    mfrc522.PCD_Init();  // NOTE: unmodified initialization...
    // Reduce the MFRC522 Receiver Gain to minimum value of some 18 dB
    mfrc522.PCD_ClearRegisterBitMask(mfrc522.RFCfgReg, (0x07<<4));
    mfrc522.PCD_SetRegisterBitMask(mfrc522.RFCfgReg, (0x00<<4));

Note the bit mask clearing call, which (as the set register call) should avoid altering reserved/future bits. It seemed to be the cleanest way to do this.

Between minimum and maximum settings, you will notice a big difference (in centimetres: cm) in the distance at which the PICC is read. Now beware, newbie at play... and I've NOT tried all the bit patterns, but think this is on the right track and better than what the mentioned discussion described.

Not working on Teensy 3.1

Hi,
I cannot get the library to work with a Teensy 3.1. Seems like other people have this problem as well.
The library works fine on an Arduino Leonardo.

May it be possible, that this has something to do with the fact that Teensy 3.1 runs on 32bit?

Here is a quote from Paul, one of the Teensy-Devs on that matter:

I can tell you there are 3 common issues with 8 bit code porting to 32 bit platforms. The most common is putting 2 bytes from I2C into a 16 bit signed integer (common with motion sensors). A similar issue involves passing data through int pointers, where the pointer is initialized with the address of a 16 bit variable (eg, the variable is int16_t but the function's pointer is "int*").
The third issue involves using structs as data templates, where an array of bytes is access as a struct (usually though a pointer, initialized with the array address). On 8 bit AVR, structs are always packed together. But on 32 bit platforms, often the compiler will align the elements of the struct to 32 bit boundaries, which greatly improves performance, but it leaves small gaps in memory between the items in the struct. The packed attribute tells the compiler to pack the data together, the same as if it were on an 8 bit platform.
This library appears to use that technique, where data is received from the card into a byte array, then a struct pointer is initialized to the address of the array. That's why I suggested trying the packed attribute in reply #14. Please give it a try and let me know if it solves the problem?

Minor inconsistence in pinout in readme.md and .ino examples

Hi,

In the readme.md file it says
Pin layout should be as follows (on Arduino Mega):
MOSI: Pin 51 / ICSP-4
MISO: Pin 50 / ICSP-1
SCK : Pin 52 / ISCP-3
SS : Pin 53 (Configurable)
RST : Pin 5 (Configurable)

but in the examples .ino files:

  • 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 52 MOSI <------readme.md says 51
    • SPI MISO 12 51 MISO <------readme.md says 50
    • SPI SCK 13 50 SCK <------readme.md says 52

The code works if I connect as readme.md file...

Readme.md ok.. works on my MEGA board
Comment text in .ino file ... does not.

Thx for a nice piece of code.

STM32F103 port

The library seems to compile without errors with the Arduino IDE and the STM32F103 core provided by this project: https://github.com/rogerclarkmelbourne/Arduino_STM32

Still, there are some minor problems that prevent this from actually working. After fixing them all examples work well. I'll make a PR with these changes immediately.

Simple Example Using Read And Using Write

hi guys!

i brought an rfid reader which supports this library and some read/write RFID cards, I've looked through your examples and i just can't understand the library, all i want to do is have it so when it reads a certain card number in output another number on the serial line (e.g. 0, 1, 2, etc)

can someone please explain to me how to write a sketch where i can simply put the card number which i want to be written ether in a INT at the top of the sketch or send it to the arduino via serial AND an example/explanation of how to use read the RFID card properly/simply so i can make the sketch i previously mentioned

thanks guys!

RC522

i would like to use the rfid reader rc522 with the Ethernet Shield on Arduino but they share the digital pin 11,12 and 13. It's possible to change the rfid reader pins in your library (maybe changing PCD_TRANSCEIVE and others)????
thank you

Luca Innocenti from Italy

Different types of rfid tags or protocols for them?

I want to scan my collage RFID tag, but i am not able. When i put my tag over the RC522 module nothing happens. Modul reds other tags with no problem.

So I am wondering are there different types of rfid tags or protocols for them and can i modify my modul or code in arduino to make it read this tag?

Issue with Ethernet Shield R3 and RFID-RC522 for UNO v3

Hi,

I have been trying to use the Ethernet Shield R3 and RFID-RC522 together on UNO v3 with the code examples found here (RFID and Ethernet http request).

The RFID and the Ethernet is working fine separate, when not mounted together on the Arduino UNO. But when i connect them both i get none to work.

I've read about other users with similar problem but i have not found a way to solve my problem.

Can i get some input on how to write code and place harness correct to get them to work together?

I have read that there might be some issues with port 10 and that RFID might need to be resigned and that HIGH LOW needs to be addressed in the code?

I am truly grateful for any hints.

Not working with pro micro

I have tested the examples with Arduino Uno. However, with the Adafruit Pro micro nothing works. Everything hangs on the call mfrc522.PICC_ReadCardSerial (). The description says that Pro micro pin RESET must be connected to the RST reader. As in this case, the sketch correctly identify the pins instead of #define RST_PIN 9? Thanks in advance for your reply.

ReadAndWrite: insufficient memory

When trying to compile ReadAndWrite example for Arduino Pro Mini with Atmega328 (8Mhz, 3.3V) the following error appears:
Sketch uses 10,688 bytes (34%) of program storage space. Maximum is 30,720 bytes. Global variables use 2,078 bytes (101%) of dynamic memory, leaving -30 bytes for local variables. Maximum is 2,048 bytes. processing.app.debug.RunnerException: Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint. at processing.app.Sketch.size(Sketch.java:1679) at processing.app.Sketch.build(Sketch.java:1589) at processing.app.Sketch.build(Sketch.java:1508) at processing.app.Editor$DefaultRunHandler.run(Editor.java:1912) at java.lang.Thread.run(Unknown Source) Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
N.B. this only happens on Arduino 1.5.8. On 1.0.6 code compiles but does not work.
N.B.2 Library version from 26 Oct 2014 works, with stability warning from the compiler.

Arduino Leonardo Support?

Is there support for the Arduino Leonardo? I wired it up according to the Pin Layout chart using the ICSP pins but I haven't been able to get it talk over serial. I added a while loop (which is standard for Leonardos) to beginning of the Dump example but I'm not seeing anything printed to the serial monitor, even when I reset the Leonardo.

void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
ShowReaderDetails(); // Show details of PCD - MFRC522 Card Reader details
Serial.println("Scan PICC to see UID, type, and data blocks...");
}

Any suggestions on how to get it the Leonardo to talk to the RFID reader?

Thanks!
-Ben

How to detect communication between Arduino and Card reader

Hi Miguel,

First: Thanks for the library!

Not an issue but just a tip I wanted to share.

Received my reader yesterday and hooked it up to my adruino and loaded your DumpInfo sample.
I tried the card and keyfob that came with the reader and nothing happened. Checked connections etc. but no luck.
To figure out if the problem was in the connection I added a command to read the version of the MFRC522 chip from Page3 Test register "VersionReg".
This gave me a positive result so now I knew the comminication between Arduino and the reader was functioning.
Finaly got hold of some other cards today, tested them and they did work.

So for anyone having doubt about the Arduino to reader connection add these lines to the DumpInfo sample just below the line
mfrc522.PCD_Init(); // Init MFRC522 card

Serial.print("MFRC522 software version = ");
Serial.println(mfrc522.PCD_ReadRegister(mfrc522.VersionReg),HEX);

According to the 2014 edition of the MFRC522 datasheet (page 65 table 132) it should return:
0x91 for version 1
0x92 for version 2

When communication fails you get 0 returned form the lib.

Cheers,

Mario

RC522 v2

Hi

I have three models of RC522, I use your library and work fine, two chips have 0x80 and 0x91 versions, and work properly, but I have others with 0x92 version, and this only work with a 5% of all tag that I have.

Why??? In the datasheet say that 0x91 is version 1 and 0x92 is version 2 and the version 2 are better than version 1, but I can't do to work.

Thanks, best regards

Anti collision + Multiple tag reading

hi
I want to make A RFID reader (mfrc522 +Arduino Uno)
With the ability to multiple tag reading at once time (Simultaneously).
I need a more source code and Anti collision algorithm in Arduino language.
plz help me.
If it's possible for you, please Help me to complete it.

If you do it, I'll be so thankful

Why RFCfgReg Command Register returns compiler error

Hello;

I am trying to increase receiver gain, i can use like this:

(RFCfgReg = 0x26 << 1, // configures the receiver gain)

mfrc522.PCD_WriteRegister(0x26, 0x111); //Configures the MFRC522 Hardware receiver gain to 48db (max).

but not like this:

mfrc522.PCD_WriteRegister(RFCfgReg, 0x111); //Configures the MFRC522 Hardware receiver gain to 48db (max).

compiler returns:

error: 'RFCfgReg' was not declared in this scope

why is that for?

How to pass a function from the RFID-RC522 into a variable then be sent into either serial or ethernet?

I'm using an RC522 RFID reader with an Arduino UNO. There is a function?? (or whatever it's called :)) in Miguel Balboa's new MFRC522.h library which is mfrc522.uid.uidByte[i] that prints the bytes of the unique ID. The repetition of the function results in 8 piece of HEX digits that are from the 2 numbers that each function outputs (2+2+2+2=8). Whenever I use the line of codes that are commented out, the serial monitor outputs them successfully. So for example, 12345678 is the unique id, each array displayed 12, then 34, then, 56, then 78 which is 12345678 in the serial. which is fast and unnoticeable besides that there are no spaces included when on output. The thing is, I want to output all of these into a single variable.(Please help me also on how to concatenate) How can I do this? An attempt was done below (not commented out) but it outputs only the number 16, consistently, which is I think due to a data type problem. The variables are initialized as int. The "function" which I found in the library is initialized as byte (correct me If I'm wrong). But when the variables are initialized as byte, I cannot upload the sketch since there are errors. Please help. :( (The reason I need it to be saved into a single variable is because I am placing it in the GET method of an Ethernet Client. I don't think the bare function can do that. (Or if it can, can you please help with the code? :)) Thanks

A MIFARE PICC responded with NAK.

I tried to use your example ReadAndWrite, I customized data and it worked, but now it says: MIFARE_Write() failed: A MIFARE PICC responded with NAK. It's a different data and card, but the code is the same. If it helps here is the code:

/**
 * ----------------------------------------------------------------------------
 * 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           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("Scan a MIFARE Classic PICC to demonstrate read and write.");
    Serial.print("Using key (for A and B):");
    dump_byte_array(key.keyByte, MFRC522::MF_KEY_SIZE);
    Serial.println();

    Serial.println("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("Card UID:");
    dump_byte_array(mfrc522.uid.uidByte, mfrc522.uid.size);
    Serial.println();
    Serial.print("PICC type: ");
    byte 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("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[]    = {
        0x9B, 0x83, 0x7B, 0xB5, //  1,  2,   3,  4,
        0xC3, 0x5D, 0xF6, 0xC9, //  5,  6,   7,  8,
        0xFE, 0x31, 0x32, 0x30, //  9, 10, 255, 12,
        0x34, 0xFF, 0x00, 0x00  // 13, 14,  15, 16
    };
    byte trailerBlock   = 7;
    byte status;
    byte buffer[18];
    byte size = sizeof(buffer);
    // Authenticate using key A
    Serial.println("Authenticating using key A...");
    status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, trailerBlock, &key, &(mfrc522.uid));
    if (status != MFRC522::STATUS_OK) {
        Serial.print("PCD_Authenticate() failed: ");
        Serial.println(mfrc522.GetStatusCodeName(status));
        return;
    }

    // Show the whole sector as it currently is
    Serial.println("Current data in sector:");
    mfrc522.PICC_DumpMifareClassicSectorToSerial(&(mfrc522.uid), &key, sector);
    Serial.println();

    // Read data from the block
    Serial.print("Reading data from block "); Serial.print(blockAddr);
    Serial.println(" ...");
    status = mfrc522.MIFARE_Read(blockAddr, buffer, &size);
    if (status != MFRC522::STATUS_OK) {
        Serial.print("MIFARE_Read() failed: ");
        Serial.println(mfrc522.GetStatusCodeName(status));
    }
    Serial.print("Data in block "); Serial.print(blockAddr); Serial.println(":");
    dump_byte_array(buffer, 16); Serial.println();
    Serial.println();

    // Authenticate using key B
    Serial.println("Authenticating again using key B...");
    status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_B, trailerBlock, &key, &(mfrc522.uid));
    if (status != MFRC522::STATUS_OK) {
        Serial.print("PCD_Authenticate() failed: ");
        Serial.println(mfrc522.GetStatusCodeName(status));
        return;
    }

    // Write data to the block
    Serial.print("Writing data into block "); Serial.print(blockAddr);
    Serial.println(" ...");
    dump_byte_array(dataBlock, 16); Serial.println();
    status = mfrc522.MIFARE_Write(blockAddr, dataBlock, 16);
    if (status != MFRC522::STATUS_OK) {
        Serial.print("MIFARE_Write() failed: ");
        Serial.println(mfrc522.GetStatusCodeName(status));
    }
    Serial.println();

    // Read data from the block (again, should now be what we have written)
    Serial.print("Reading data from block "); Serial.print(blockAddr);
    Serial.println(" ...");
    status = mfrc522.MIFARE_Read(blockAddr, buffer, &size);
    if (status != MFRC522::STATUS_OK) {
        Serial.print("MIFARE_Read() failed: ");
        Serial.println(mfrc522.GetStatusCodeName(status));
    }
    Serial.print("Data in block "); Serial.print(blockAddr); Serial.println(":");
    dump_byte_array(buffer, 16); Serial.println();

    // Check that data in block is what we have written
    // by counting the number of bytes that are equal
    Serial.println("Checking result...");
    byte count = 0;
    for (byte i = 0; i < 16; i++) {
        // Compare buffer (= what we've read) with dataBlock (= what we've written)
        if (buffer[i] == dataBlock[i])
            count++;
    }
    Serial.print("Number of bytes that match = "); Serial.println(count);
    if (count == 16) {
        Serial.println("Success :-)");
    } else {
        Serial.println("Failure, no match :-(");
        Serial.println("  perhaps the write didn't work properly...");
    }
    Serial.println();

    // Dump the sector data
    Serial.println("Current data in sector:");
    mfrc522.PICC_DumpMifareClassicSectorToSerial(&(mfrc522.uid), &key, sector);
    Serial.println();

    // Halt PICC
    mfrc522.PICC_HaltA();
    // Stop encryption on PCD
    mfrc522.PCD_StopCrypto1();
}

/**
 * Helper routine to dump a byte array as hex values to Serial.
 */
void dump_byte_array(byte *buffer, byte bufferSize) {
    for (byte i = 0; i < bufferSize; i++) {
        Serial.print(buffer[i] < 0x10 ? " 0" : " ");
        Serial.print(buffer[i], HEX);
    }
}

ARDUINO MEGA + Ethernet Shield + RFID-RC522

Good night all.

Well I came a rush job to a factory where you have to make a control system USERS controlled via web, etc etc.

But hey need to start with the part of the RFID and sincerely and booting problems.

I commented.

Use thie code DUMPInfo

Conex Images: https://www.dropbox.com/sh/whjm71iaua9luzt/AABp8Vf3b9Fj9ToyvUwNDn2ra?dl=0

ERRORS:

MFRC522 Software Version: 0x91 = v1.0
Scan PICC to see UID, type, and data blocks...
Card UID: 43 B5 45 DF
PICC type: MIFARE 1KB
Sector Block 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 AccessBits
15 63 MIFARE_Read() failed: The CRC_A does not match.
15 62 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ] Inverted access bits did not match!
61 MIFARE_Read() failed: A MIFARE PICC responded with NAK.
60 MIFARE_Read() failed: The CRC_A does not match.
14 59 PCD_Authenticate() failed: Timeout in communication.
13 55 PCD_Authenticate() failed: Timeout in communication.
12 51 PCD_Authenticate() failed: Timeout in communication.
11 47 PCD_Authenticate() failed: Timeout in communication.
10 43 PCD_Authenticate() failed: Timeout in communication.
9 39 PCD_Authenticate() failed: Timeout in communication.
8 35 PCD_Authenticate() failed: Timeout in communication.
7 31 PCD_Authenticate() failed: Timeout in communication.
6 27 PCD_Authenticate() failed: Timeout in communication.
5 23 PCD_Authenticate() failed: Timeout in communication.
4 19 PCD_Authenticate() failed: Timeout in communication.
3 15 PCD_Authenticate() failed: Timeout in communication.
2 11 PCD_Authenticate() failed: Timeout in communication.
1 7 PCD_Authenticate() failed: Timeout in communication.
0 3 PCD_Authenticate() failed: Timeout in communication.

nothing worked

I am unable to do anything with my RFID-RC522 as it is not able to read the card.I am having doubt that pin 13 of arduino uno is not working properly as when I upload the code led on pin 13 glow very dim is there any way I can use another pin instead of pin 13.
and when I remove the wire connected to pin 13 the message shown in serial monitor is
Scan PICC to see UID, type, and data blocks...
MFRC522 Software Version: 0x0 (unknown)
WARNING: Communication failure, is the MFRC522 properly connected?

I have tried to connect 3.3 volt to 5 volt and removed the ground it worked but
i get the message in serial monitor
Card UID: 77 96 AE D4
PICC type: MIFARE 1KB
Sector Block 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 AccessBits
15 63 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF [ 0 0 1 ]
62 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
61 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 0 0 0 ]
60 MIFARE_Read() failed: Timeout in communication.
14 59 PCD_Authenticate() failed: Timeout in communication.
13 55 PCD_Authenticate() failed: Timeout in communication.
12 51 PCD_Authenticate() failed: Timeout in communication.
11 47 PCD_Authenticate() failed: Timeout in communication.
10 43 PCD_Authenticate() failed: Timeout in communication.
9 39 PCD_Authenticate() failed: Timeout in communication.
8 35 PCD_Authenticate() failed: Timeout in communication.
7 31 PCD_Authenticate() failed: Timeout in communication.
6 27 PCD_Authenticate() failed: Timeout in communication.
5 23 PCD_Authenticate() failed: Timeout in communication.
4 19 PCD_Authenticate() failed: Timeout in communication.
3 15 PCD_Authenticate() failed: Timeout in communication.
2 11 PCD_Authenticate() failed: Timeout in communication.
1 7 PCD_Authenticate() failed: Timeout in communication.
0 3 PCD_Authenticate() failed: Timeout in communication.

Bords with integrated ethernet

Hi, I have already successfully used this great library with unos and megas....
But now I got an arduino Leonardo ETH with integrated W5500 ethernet and I can not get it to work with the RC522 reader which Works fine with the UNO and the Standard-W5100 ethernetshield for example.
I also tried another board (http://tronixlabs.com/arduino/boards/ethernet/dfrobot-arduino-compatible-with-onboard-w5500-ethernet-and-poe-australia/) that seems to be somewhat similar.
Both boards Do Not recognize the RC522 reader during setup.
Even if I deactivate the CS from ethernet and SD, the reader can not be accessed.
There must be something general that Blocks the Icsp or so?
I have used the mosi, miso and sck from the 6 pin icsp header of the board because they do not have them on the GPIO Pins like the UNOs or Megas and also tried different Pins as the CS pin for the reader.
No success on getting the reader to respond.
Is there anything else I can try?
Thanks in advance and kind regards
Gerald

Sample code using auth, read and write?

Hello Miguel,

Sorry for writing in your Issue Tracker but I found no contact info to get to you ... Do you have any code sample using the auth, read and write commands to read/write data in all sectors of the card?

Would be nice to add it to the repo if you have any ... If not, maybe I can help.

Thanks,

Philippe

WARNING: Communication failure, is the MFRC522 properly connected?

I am new to ARDUINO. I have tried for the past two days to get the MFRC-522 to work with my Arduino UNO. I keep getting this message when I use the Dump Code


MFRC522 Software Version: 0x0 (unknown)
WARNING: Communication failure, is the MFRC522 properly connected?


I set everything up just like in the sketch.
Any help is appreciated

Please replace fragment of comment as bellow to write about support Nano v3

For newbies is problem to identify right pins. This can help to undarstand, how connect rfid reader to Arduino Nano v3.

 ----------------------------------------------------------------------------- Nicola Coppola
 * Pin layout should be as follows:
 * Signal     Pin              Pin              Pin
 *            Arduino Uno      Arduino Mega     Arduino Nano     MFRC522 board
 * ----------------------------------------------------------------------------
 * Reset      9                5                D9               RST
 * SPI SS     10               53               D10              SDA
 * SPI MOSI   11               51               D11              MOSI
 * SPI MISO   12               50               D12              MISO
 * SPI SCK    13               52               D13              SCK
 *
 * The reader can be found on eBay for around 5 dollars. Search for "mf-rc522" on ebay.com. 
 */

How mifare protects data?

How mifare protects data blocks from unfamiliar writers/readers?

I think we must assign a password for protecting blocks. How we assign/change the password?

Can you give an example?

Multiple tries to authenticate

Hi there,

I have a bit of a problem with authentication. I want my program to find out if a card has the default authentication key as KeyB (called KeyDefault in my software) or a key I made myself (KeyPrivate). So I want to try both authentications, and if default rewrite the authentication. For this I made this function:

Serial.println("Logging in to RFID tag ...");
byte TagType = mfrc522.PICC_GetType(mfrc522.uid.sak);
if (TagType != MFRC522::PICC_TYPE_MIFARE_1K)
{
Serial.println("Wrong tag type! Use MiFare 1k tags");
Serial.println("");
return false;
}

byte status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, trailerBlock, &KeyDefault, &(mfrc522.uid));
if (status!= MFRC522::STATUS_OK)
{
Serial.println("Tag security key A corrupt, throw away!");
Serial.println("");
return false;
}

status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_B, trailerBlock, &KeyDefault, &(mfrc522.uid));
if (status!= MFRC522::STATUS_OK)
{
mfrc522.PCD_StopCrypto1();
status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_B, trailerBlock, &KeyPrivate, &(mfrc522.uid));
if (status!= MFRC522::STATUS_OK)
{
mfrc522.PCD_StopCrypto1();
Serial.println("Tag security key B corrupt, throw away!");
Serial.println("");
return false;
}
else
{
SetAccess = false;
return true;
}
}
else
{
SetAccess = true;
return true;
}

The problem is: PICC_CMD_MF_AUTH_KEY_B doesn't work if KEYB is equal to KeyPrivate. If I switch both places (KeyDefault & KeyPrivate) then it works. So the first time I try to authenticate KeyB works, but the second time doesn't. How can I try two different keys for KeyB? Am I making a syntax error or forgetting something?

Kind regards,
Davy Van Rossem

Ethernet Shield

Hi,

your library is great and works like charm! But I experienced some issues when connecting an Ethernet shield to my arduino due. After some googling I found out that the Ethernet shield has a flaw. If I put the Ethernet shields chip select to low the shield is still sending an receiving data from the MISO/MOSI ports.

Do you know any fix for that or can you say me if the design flaw of the newer versions of the ethernet shield still exists?

Can I write UID?

Hey,
Can I modify the UID of a card? If so how would I do that? I'm sorry if this is the wrong place to ask, but the library is great :D thank you for creating :)

Regards

Can not wake up PICC

This simple code tries to Wake UP a Halted PICC, but it can not. What is wrong?

include <SPI.h> // RC522 Module uses SPI protocol

include <MFRC522.h> // Library for Mifare RC522 D

define SS_PIN 10

define RST_PIN 9

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

void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // Initialize serial communications with PC
SPI.begin(); // MFRC522 Hardware uses SPI protocol
mfrc522.PCD_Init(); // Initialize MFRC522 Hardware

}

void loop() {
byte bufferATQA[10];
byte bufferSize[10];
// put your main code here, to run repeatedly:
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
Serial.println("There is no PICC");
return;
}

// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
Serial.println("Cannot get UID");
return;
}
Serial.println("GOT UID");
mfrc522.PICC_HaltA();
Serial.println("PICC Halted");
delay(100);
Serial.println("Im trying to Wake Up Halted PICC");
mfrc522.PICC_WakeupA(bufferATQA, bufferSize); //wake up PICC which was previously Halted
delay(100);
mfrc522.PICC_RequestA(bufferATQA, bufferSize);
delay(100);
Serial.println("PICC Should Wake Up");
delay(100);
if ( ! mfrc522.PICC_ReadCardSerial()) {
Serial.println("Tried get UID but no luck");
}
delay(1000);
}

Read write code not working

I uploaded this code on my arduino uno. But it does not seem to work. I am getting a NACK from the PICC. What changes should I do?

RFID interrupt pin IRQ setup problem

How do I set up the IRQ-pin on the board with Arduino? I want the IRQ-pin to change value when a card is scanned on my rc522. Code-examples would be appreciated! Sorry for my English…

rc522 -- reads cards but not fobs

I've tried 2 522 devices 2 cards that came as samples. These worked. But the sample fobs did not read. I also had 5 other fobs (seemingly same kind) -- didn't read. Using miguelbalboa/rfid software.

Also, not working: can't read a vendor card nor the chip in a valuable dog's ear.

Any suggestions?

MifareRead changes buffer size also if not STATUS_OK

byte MFRC522::MIFARE_Read( byte blockAddr, ///< MIFARE Classic: The block (0-0xff) number. MIFARE Ultralight: The first page to return data from.
byte *buffer, ///< The buffer to store the data in
byte *bufferSize ///< Buffer size, at least 18 bytes. Also number of bytes returned if STATUS_OK.

The bufferSize will also be changed, if a CRC error occurs during reading. Then the bufferSize is changed to the number of correctly read bytes.

read card once only

hi,

i am doing a project related to rfid, and am taking help from the library u shared. thanks :)

as i scan and read an authenticated card, it does so and if the card is kept placed at the reader, it reads it only once.

but as i scan an unauthenticated card, it keeps scanning if kept placed at the reader, i need it to scan only once, notify the not authentication part and leave it as thus until a NEW card is with in the proximity.

i am calling the halt and stop cryptol functions as should be called.

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.