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
Remove these adsRemove these ads by Signing Up

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

1-40 of 137Next »
epidemicz5 years ago
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)  epidemicz5 years ago
Nice, thank you for the positive feedback. xD
JakeW46 days ago

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!

otaviousp (author)  JakeW46 days ago

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

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)  JakeW66 days ago

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

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?

otaviousp (author)  JakeW44 days ago

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?

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

otaviousp (author)  JakeW44 days ago

Have you tried to upload the code without any errors?

FaiquahL17 days ago

sir kindly again post the vedio in which mention software type and how to add /delete users of tags.

which code is best one between the two of them.please help me sir...........

tell me either arduino uno will remain best for finger print scanner and rfid or other type??? and also tell me which rfid is available with data base /software...? and

edugr1 month ago

Hi, thanks for the tutorial, it worked perfectly on my Arduino Mega 2560 (just changed the RX to digital 50).

Do you know if I can read the Sticker version of RFID with this componente or do I need some other type? can you recommend me one? Thank you very much!

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?


otaviousp (author)  jess.delamerced1 month ago
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?


Hello! I'm quite confuse on my connection to arduino uno to rfid rc522 don't know where should I connect the pins from rfid rc 522 to arduino uno.. Pls do show some pics for their connections or guides... Need help also for a sample module to test my rfid rc522 if its working or not using my arduino uno... I really appreciate your great help..

LeoA52 months ago

can you help im having issues compiling code on the link it one. Not sure if I have the right library.

sketch_jan28a.ino: In function 'void loop()':
sketch_jan28a.ino:30:40: error: 'add' was not declared in this scope
sketch_jan28a.ino:31:45: error: 'del' was not declared in this scope
sketch_jan28a.ino:32:37: error: 'verifica' was not declared in this scope
Error compiling.

RiaanBod5 months ago

What happens if your arduino restarts or lost power. Do you have to re-program the TAGs again?

otaviousp (author)  RiaanBod4 months ago

On this code you have to reprogram

SimonT2 made it!4 months ago


VishalG16 months ago

Hi, Mandeep for ES-125R Rfid reader you can get complete support by writting mail over this Email,, or you can call them directly +91-7533036999.

me happy to help

abramo.lieo7 months ago

great. good. amazing.

kamra8 months ago

I have one ES 125 R, please tell me how to connect it to arduino.
RFID pins of ES 125R as such
A0 , A1 , O/P , GND , +5V , R , TX

MandeepS1 kamra8 months ago

I have the same ES125R, have you been able to figure out as to how to use it, if so would your share it, thanks

otaviousp (author)  MandeepS18 months ago

A simple search at google returns this schematics

Just connect your TX pin from ES 125R to your RX pin at your Arduino board.

Power UP your ES 125R module, make a program to continues read the serial port at 9600 baud rate, open the serial monitor, approach the rfid tag to the board and see if something has been send through the serial port.

If it work or doesnt works, please tell me.

otaviousp (author)  otaviousp8 months ago

Forget to upload the image of the schematic

AroojZ1 year ago
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.
MandeepS1 AroojZ8 months ago

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

Congratulations otaviousp! Do you know how far could we connect the rfid module to the arduino board?

otaviousp (author)  Ivar Michelena Viti10 months ago
Hi Ivar,

The communication between the arduino and the RFID module is done by a serial cable. So the max distance depends on the velocity of transmission (baud rate), and the quality of the cable.

Usually the module stay near the Arduino(slave), then the arduino send the information to another arduino(master) for long distance.

Lower the baud rate, bigger the cable you can use.
factory9091 year ago

Very nice brotha! Have you did any other interfacing with this since your project? I'm thinking door locks...

otaviousp (author)  factory90911 months ago

I did not interface it with other devices, but it is quite simple to do.

With you need any help, please tell me.
brenryan12 months ago

Nice ible. Well done, I learnt much more about this RFID module here than on it's wiki...

I'm just trying to make a simple reader that just spits out the read tags ID number then moves onto a new line. I've taken bits of your code to get started, I don't see why it's not working the same way as it does in yours :/

Maybe you can help? I would really appreciate any assistance...

#include <SoftwareSerial.h>

SoftwareSerial RFID(10, 11);

String msg;

void setup()



Serial.println("Serial Ready");


Serial.println("RFID Ready");


char c;

void loop(){


msg += c;

Serial.print("Tag ID: ");

Serial.println(msg); //Uncomment to view your tag ID






otaviousp (author)  brenryan11 months ago
Try this code and send me the result.

#include <SoftwareSerial.h>

SoftwareSerial RFID(10, 11);

String msg;

void setup()



Serial.println("Serial Ready");


Serial.println("RFID Ready");


char c;

void loop(){



msg += c;

Serial.print("Tag ID: ");

Serial.println(msg); //Uncomment to view your tag ID

Serial.print("Msg Length: ");





brenryan otaviousp11 months ago
Hi, thanks for getting back to me!

That code has some of the same unpredictable results I was experiencing sort of a "stacking" phenomenon, If you hold the tag for just the right amount of time it's ok... But that's not going to happen too often.

Serial Ready
RFID Ready

Tag ID:
Msg Length: 1
Tag ID: 0
Msg Length: 2
Tag ID: 00
Msg Length: 3
Tag ID: 003
Msg Length: 4
Tag ID: 003C
Msg Length: 5
Tag ID: 003C3
Msg Length: 6
Tag ID: 003C34
Msg Length: 7
Tag ID: 003C34E
Msg Length: 8
Tag ID: 003C34EB
Msg Length: 9
Tag ID: 003C34EB1
Msg Length: 10
Tag ID: 003C34EB15
Msg Length: 11
Tag ID: 003C34EB15F
Msg Length: 12
Tag ID: 003C34EB15F6
Msg Length: 13

Tag ID: 003C34EB15F6
Msg Length: 14

Tag ID: 003C34EB15F6
Msg Length: 15
Tag ID: 003C34EB15F60
Msg Length: 16
Tag ID: 003C34EB15F600
Msg Length: 17
Tag ID: 003C34EB15F6003
Msg Length: 18
Tag ID: 003C34EB15F6003C
Msg Length: 19
Tag ID: 003C34EB15F6003C3
Msg Length: 20
Tag ID: 003C34EB15F6003C34
Msg Length: 21
Tag ID: 003C34EB15F6003C34E

It goes on, and on but you get the picture.

With some strategically placed delays I found a (sloppy, I'm a newb, so whatever works right?) code that works for me.

Sometimes it double reads, but that's not so bad. Still mostly taken from your code;

#include <SoftwareSerial.h>
SoftwareSerial RFID(10, 11);

String tag;

void setup()
  //pinMode(8, OUTPUT);
  //pinMode(9, OUTPUT);
  //digitalWrite(8, LOW);
  //digitalWrite(9, HIGH);
  Serial.println("Serial Ready");

  Serial.println("125khz RFID Ready");
  Serial.println("Waiting for a Tag...");

char c;

void loop(){
    tag += c;
Serial.println("Tag Detected"); Serial.print("ID: "); Serial.println(tag);
Serial.println("Waiting for a Tag...");

 Works fine for my needs. Sorry I didn't update the comment after I found a solution, I posted and then saw it was over 2 years and though "Oh Crap".

Thanks again for getting back to me and for the help and inspiration!

Take care, Bren
aaafred1 year ago

Hi Otavio,

I was wondering, you didn't build in an option to deactivate a 'tag' when the tag has been compromised. So when the 'tag'is lost there's no way do deactivate it.

Maybe it's an option to make a 'deactivate all tags' option with a third 'card'?

otaviousp (author)  aaafred1 year ago

Very nice suggestion.

With a little code modification it is possible to implement this option.

Wow, that was a fast reply! I just ordered a new RFID reader (one that hopefully works with your solution) and i just like the idea of adding and deleting tags 'on the fly' rather than hardcoding them. Since I'm an Arduino newbee, I have really no idea how to create such a modification. Could you help me out please?

otaviousp (author)  aaafred12 months ago

A sent you the code by private message but I did not test it.

If it does not work tell me.

1-40 of 137Next »