Getting the RFID-RC522 to work! [SOLVED]


Hi @notsgnik,

Most RFID readers only pull in the serial number from the fob. Emulating an RFID card is harder, I remember someone posted a project on that recently here:



@notsgnik, the original library I posted was for a specific member. There are a couple of other examples that show how to read and write to the fob, as well as, how to setup a block on a MIFARE Classic PICC to be in “Value Block” mode. I can port these examples and add them to my repo later today. :smile:

ACTUALLY, have you looked at the MFRC522 library on the web IDE? It has those examples already!


@Dave I found some good one that have doc and lib to fully understand it all. it’s not emulating a card that i want, it’s to be able to read it’s content or even copy it. i’m starting to understand it more thanks to the doc on a repo i founded.

@peekay123 i’ll look it up. i’ll will also be glad to take a look at your repo.
( also i’m new to all this, how can i found the web ide you are talking about? if it’s not too noob to ask)

thanks for answering that quickly :slight_smile:


@notsgnik, I am assuming you have a Spark Core and have logged in to the web IDE at:


Sorry, I ended up on this forum and signed-up cause it looked like,
I would have the best answer here.
I actually have a BuonoR3 from this maker kit :

btw: I took a look a your repository for the rc522, this one have a nice documentation

I took a look at the library from, It looks exactly the same minus some examples.

Thanks for the answer, the web IDE look cool and the fact that the spark core is tiny and wifi enabled is cool too! ( [troll] making the Intel Galileo looking even more useless [/troll] ).
I hope that the fact that I don’t own a Spark core will not exclude me from this community.


@Dave Thinking about it, it will actually be more easy with the device from hack a day ^^.
:smiley: thanks for the link.


@notsgnik, we are a cool bunch in this forum. We often help folks who don’t have a Spark :smile:


I just had a look at plugging this board into the Spark.IO using UART rather than SPI, and what I found was that this is possible using an MFRC522 based circuit, it most likely is not possible on the RFID-RC522.

Basically Pin 1(I2C) is connected directly to GND, and Pin 32 (EA) is connected directly to 3.3V. These are the two pins that select between UART/SPI/I2C mode. As set, they force the device into API mode, and I have not yet found a way to override them. In fact, I am not quite sure why there is an SDA pin on the PCB, since I have not found a way to select I2C mode.

If there was a way change mode, the MISO pin could be used as SCL in I2C mode. MOSI and SCK would be address pins. In UART mode, RX and TX would be SDA and MISO with MOSI and SCK used for handshaking

To summarise, unfortunately, with this PCB, it looks like you are stuck with SPI. Of course there might be an SPI way to change the device into UART or I2C but I could not find it looking at the data sheed.


@vk2tds, from what I could see of the spec sheets, the SPI/I2C/UART configuration is done via hardware pin configuration and unless someone wants to desolder the pins on the smd chip, the board will remain SPI.


hi @peekay123,

for the project ,
it is throwing a error from my C++ compiler, but not Spark Web IDE.

C:\Users**\spark\core-firmware\build/…/src/application.cpp:53: undefined reference to `MFRC522::MFRC522(unsigned char, unsigned char)’


@yuanetking, can I assume you are setup to compile locally with the Core toolchain and repos? The way the IDE compiles libraries, examples require a path like this to include the .h files:


However, this may not be correct for your compile environment. You will need to review the include statements in each file to make sure it the .h files re found by your compiler. :smile:


Thx your reply, @peekay123 , i am using the IDE, netbean.

Dont known why that the CPP file and H file should be combined into H file. If we make a separated files then the error will comes out .

below is the structure according to the Git:

|- build
|- inc – which including h files.
|- linker
|- src – for cpp files


I am not sure what you mean by that. What I was mentioning is the PATH of the .h include files specified in the .cpp and .ino files not being correct. Your compiler needs to find them and this does not seem to be happening. :smile:


@peekay123, I meant, i just merged CPP source code into the H file, then compiler found that.


@yuanetking, it is a “crude” approach but since it works, good job :stuck_out_tongue: Hopefully things are working for you now (?)


@peekay123, Thx your reply , :smile:, As my presentation above, my english,:frowning: … ,
I just copyed CPP source code into the bottom of H file , then it work.


@peekay123 i want to read data from uart and save it on sd card
how can i do this
help me please !


@nooraqqad, I am not sure what you mean by reading from UART. The RC522 uses the SPI bus, not UART. Can you please explain?


@peekay123 oky i wiil explain my project ,
i want to make RFID attendance system , the only step i did was reading RFID tag and print its serial number on serial monitor of arduino ,
now i want to improve it , so i am thinking about making GUI for each teacher and at the begining of the school
the doctor will save a file on arduino which contains the RFID student number who are registered on his class
then when the student enroll his card , the arduino will compare his number with the file who had been saved
, if it is exist then arduino will save it as registered , if not then he will print on lcd not registerd
("i am so sorry for my language vut i am from palestine and my language is arabic , i am not so good in english language , i hope u understand what i wrote ")


Hey Peekay123, your genius astounds me. I’ve been skimming this post for a few minutes and now have a better understanding of what’s going on. Anyway, both for clarification of points you probably have already made, and to enlighten a rookie such as myself, I have a question or two. I’m trying to use an arduino to control three of these rfid readers which will, inturn, control three stepper motors. The stepper motors seem simple enough, but I was under the impression that an arduino could only handle one spi thingy at a time. Could I control three with one arduino? I know that the mega has 4 serial connections, but I’m not using the tx/rx pins now so how does that play together? Thanks for any knowledge you pass along, and I am seriously new to this so please be gentle.