Introduction: How to Connect Arduino and RFID

Picture of How to Connect Arduino and RFID

On this instructable I will try to show how to interface a RFID sensor with the Arduino. I am using the RFID sensor from seeedstudio the serial version of it. There are a few parts you will gonna need. I also bought some RFID keys.

UPDATE: Now it works with IDE 021

Step 1: What You Gonna Need?

Picture of What You Gonna Need?

- Arduino Board
- RFID Sensor from seeedstudios
- Wires
- Protoboard
- RFID tags (125kHz) from seeedstudios

Step 2: Plugging All Together

Picture of Plugging All Together

Connect the antenna on the appropriate pins like the first photo.

Plug the RFID sensor to the protoboard like the second photo above.

Only 3 wires are required to interface, 2 wires for supply and another for the serial line(communication)
The wires as connected as the third photo shows.
On RFID sensor: PIN 1 -> Tx
PIN 2 -> Rx (Not Used)
PIN 3 -> NC
PIN 4 -> GND
PIN 5 -> VCC (+5V)

Tx from RFID board goes to Digital PIN 2 on Arduino Board.

That is all you gonna need to wire.

Moving on to next step, the software.

Step 3: The Code

I'm not a software guy, so this code is just for demonstration.

I don't make any kind of checksum at the tags code, but it seems to work fine.

The code is really simple. I used a new library for the serial, using software emulation.

With the two white cards you can deny or allow the access of others keys.

Any doubt, please ask me.

Edit (05/11/12):
code update for new Arduino version

Step 4: Results!

There is no LED, sound or LCD for debug or visualization, just through the serial line.

The video demonstrate how to use the software. I didn't post any kind of explanation as text on the video. I hope that the images spokes more then words, xD

Any doubt or suggestion, feel free to ask, or correct me.

Please, if you like it, rate it,

thank you


epidemicz (author)2009-10-13

Thanks for the instructable man, really appreciate it.  I've been wanting to do something with rfid and this is going to help me out big time.

otaviousp (author)epidemicz2009-10-13

Nice, thank you for the positive feedback. xD

greatescapeprops (author)2017-10-29

Thanks for the tutorial. I have it all working but the cards do not read fast enough or not at all. I have to put the cards directly on the antenna. Any ideas on this? I have all 125Mhz cards with the correct reader and hookup is correct. Thanks.

Gregory Akau (author)2016-11-30

Don't know why I'm having a multiple read for each card I swap

ShoaibH3 (author)2016-09-25

plz send me rfid code at this
i need it urrgent...plz

sweeth (author)2016-09-19

Hi, This is really nice. Can we calculate distance also? if in case we would like to calculate distance as how much far or close the tag is with reader , is that possible?



otaviousp (author)sweeth2016-09-21

I don´t think it is possible to do that with this particular module.

sweeth (author)otaviousp2016-09-21

Hi, Thanks for the kind response,

Can we measure distance via signal strength? Or can you please suggest me any other module? I have MLX 90109 with DVK 90109 and EVB 90109

lef11 (author)2016-08-28

I had the readers and they dont seem to be reading i have them hooked up the way you have it set up but how does your code work? there arent any comments throughout the code and i have been looking to use them for a school project. can you help?

otaviousp (author)lef112016-08-29

send me your code and a pic of your schematic

lef11 (author)otaviousp2016-08-29

Just figured it out now how can i get the id part out of whats being read? I also noticed that sometimes im reading double of the same part of the code?

AroojZ (author)2013-06-25

Hi I have arduino Mega ADK, Here is a preview of it, can you tell me where to connect the TX of RFID in the arduino board? I,m an extreme beginner so if my question is stupid please bear with me. Just tell me the exact pin number on which to attach from the arduino board's picture! Thanks in advance.

F-sidd142 (author)AroojZ2016-08-28

i have the same problem. please tell if someone have sorted out.

otaviousp (author)F-sidd1422016-08-29

Send me your code and a pic or schematic of your conection

MandeepS1 (author)AroojZ2014-07-27

Have your been able to figure it out pl, I have the same question

F-sidd142 (author)2016-08-28

i am able to work with arduino uno but unable to get it working on arduino mega.
i used the code above and connected the rfid pin to arduino mega's digital pin 2.

anagliph (author)2016-08-13


Using your code to decode a keychain fob ID tag. The fob has the number "0001383297" inscribed. The code outputs "3100151B81BE".

Boards are hooked up per your directions, using the same RFID receiver card and the Sparkfun UNO board.

Any ideas on how to decode the output that matched the inscription?

I have used a commercial USB RFID reader (it looks like a thumb drive) and it outputs the number inscribed on the fob.


otaviousp (author)anagliph2016-08-15


Ss you can see in the image below the number 000138297 inscribed is in DEC. Cinverting it to HEX give us this 00151B81. Probably the beginning "31" and the final "BE" should be a verification code.

So the reading is OK, the problem is on the conversion from DEC to HEX.

rcbart (author)2016-06-13

Do you know if using this approach you can connect more than one RFID reader to a single arduino?

otaviousp (author)rcbart2016-06-13

If you use the same port, it could have some interference. But worth the shot. Anyway, you can use different pin for each rfid module.

PedroC101 (author)2016-05-15

Hello, how can i add more tags ?

what i need to change in the code?


JamesM295 (author)2016-01-13

Just a few quick questions: Which arduino board did you use for this project? Also, I see that pin one TX of the RFID sensor is being connected to digital pin two of the arduino board, is this digital pin two a special pin such as RX or is it a normal digital pin? Thank you for a great instructable!

otaviousp (author)JamesM2952016-01-13

The board is a old Arduino Duemilanove.

I use the digital pin with a serial software to connect with the RFID board so the original serial port can communicate with the computer for debug purpose and interacation.

lappiesja (author)2015-12-07

Hi, thanks for this great tutorial. I have this same RFID module from seeedstudio but want to make it work with 134 kHz RFID tags used for animal tagging with ISO 11784 & 11785. Is that possible or not? I've searched the web but couldn't find anything specific to this and SeeedStudio just referred me to their Wiki page. What I was able to find out is that the frequency fot this specific antenna is not a problem.

Thanks in advance.



otaviousp (author)lappiesja2015-12-08

Hello Tinus,

With this especific sensor I dont think that it will work with this animal tag because of the diference between the two frequency.


JamesC169 (author)2015-11-05

Thanks for a really good tutorial it really helped me out, i was wondering if you could help me, my project require reading a static rfid, i.e. when the arduino is turned on it reads the rfid card that currently on the reader. Is that possible or does the card need to move be able to read it

otaviousp (author)JamesC1692015-11-06

That is a good question, never tried this way.
I really don´t have this answer right now.

JakeW4 (author)2015-03-25

please help i dont understand how to program the tags, what does the line in the code mean '" //change this ID with your own card TAG' please help fast!

Lisssy (author)JakeW42015-11-05

I have the same problem. The card has a long number but when I put the number in the program, nothing happens. The serial monitor just shows "Serial Ready" and "RFID Ready". But nothing else. Please tell me in detail, how you solved the problem

otaviousp (author)Lisssy2015-11-05

Can you send me your code and your card ID

otaviousp (author)JakeW42015-03-25

You need replace the code by your own ID form your card

JakeW6 (author)otaviousp2015-03-25

I tried that but the number is very long, it has a space and a comma in it so what do i do with that?

otaviousp (author)JakeW62015-03-25

send me a print of the serial reading when you read a tag

JakeW4 (author)otaviousp2015-03-26

It doesn't read anything, where do you get the tag ID number? on the cards there is a number printed on them, one is '0000946210 014,28706' and the other is '0001361049 020,50329' so are these supposed to be the id number?

zejudoka (author)JakeW42015-04-28

Have you find what is the ID number of the card? I have the exact same problem here!

I have : '0006527268 099,39204'

and : '0006512977 099,24913'

otaviousp (author)JakeW42015-03-27

After uploaded the code, there is any message on the serial monitor?

When you approach the tag to the sensor, appears anything on the serial monitor?

JakeW4 (author)otaviousp2015-03-26

This may have been the obvious answer from the beginning but does this work with arduino uno?

otaviousp (author)JakeW42015-03-27

Have you tried to upload the code without any errors?

JakeW4 (author)otaviousp2015-04-09

Okay i solved it, with arduino you have to switch the wiring round between the RFID module and the Arduino, you have to wire the RX on the RFID module to the TX on the Arduino and the TX to the RX.

jess.delamerced (author)2015-02-10

Hi, just a noob question:

You're using the RFID Cards and Keys here, right? Is it possible to use the RFID stickers(the ones that can be placed on equipments or someting) as a substitute? as long as it's 125Khz?


I think it is possible, but the distance that you can read the sticker may be smaller than the read bycard.

Hi, thanks for the reply. I had used a 125Khz card instead. So I tried the code of brenryan since I just need a simple program that displays the card's id(also modified 1 line of the code "tag=tag.substring(1,13);" replaced 13 with 19 since my card has 18 digit code. Anyway, now I'm facing a different problem, do you have any idea why the output looks like this?

I'm probably way too late, but the reason is because the serial monitor converts the number into a character, try Serial.println(); instead

leva4av (author)2015-09-22

Super instructable man..

otaviousp (author)leva4av2015-09-22

Thank you for the feedback

TanS4 (author)2015-09-20

If I have Arduino Uno, Ethernet Shield and RFID Module ID-20LA. May I know how to connect the circuit?

otaviousp (author)TanS42015-09-21

Never tested this two shields together.
My sugestion is first, make de arduino and the RFID modulo works together.
After this, try the same thing but now with the arduino and the Ethernet Shield together.

After both works, try to make it works together.

LeslieD5 (author)2015-09-08

do you have some tutorials about rfid with magnetic lock? Thanks ?

otaviousp (author)LeslieD52015-09-15

I do not have any. But on Google YouTube can find some example

Amirun Hafiz (author)2015-09-15

About This Instructable




More by otaviousp:CNC G-Code Interpreter using ProcessingHow to connect Arduino and RFIDAngle measurement using gyro, accelerometer and Arduino
Add instructable to: