RFID id-12 tagreader

Here is a simple code for reading tags from the id12 RFID reader. It should be quite easy to modify if you know the dataformat your reader is sending out.

Here is how to hook it up for serial communications, either using a microcontroller like arduino or wiring, or through a serial to usb interface, or wirelessly over bluetooth, using a bluetooth module like bluesmirf:

ID-12 schematics, originally uploaded by hc gilje.

(This schematic has been updated with a 1k resistor between pin 10 and LED after reports by users)

If you are using the breakout board from sparkfun, the pinout is as seen in the image below.
Connect the led+resistor to pin 10, serial connection to pin 9, ground to pins 1 and 7, +5v to pins 2 and 11 (updated june 26th, 2008 )

If you use an arduino or wiring board here is the code to read (from RFID reader) and write (to your computer) the serial port (modified from Tom Igoe´s code):
/* RFID ID12
*/

char val = 0; // variable to store the data from the serial port

void setup() {
Serial.begin(9600); // connect to the serial port
}

void loop () {
// read the serial port

if(Serial.available() > 0) {
val = Serial.read();
Serial.print(val, BYTE);

}
}

Maxmsp code:

copy and paste into maxmsp. You might want to clear the menu before adding your own tags:

#P window setfont “Sans Serif” 18.;
#P number 549 297 35 18 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 206 361 121 196617 filter out the 10 data bits;
#P newex 457 289 49 196617 delay 10;
#P newex 144 417 80 196617 prepend symbol;
#P message 550 178 33 196617 clear;
#P newex 508 432 69 196617 route symbol;
#P newex 508 459 78 196617 prepend append;
#P newex 508 409 41 196617 v temp;
#P newex 457 343 32 196617 sel 0;
#P newex 457 320 27 196617 0;
#P newex 525 261 21 196617 t 1;
#P newex 508 198 40 196617 t s b 0;
#P user ubumenu 550 224 100 196617 0 1 1 0;
#X add 0D003B363E;
#X add 0E002A0E4D;
#X add 0E002A393C;
#X add 0E002A0148;
#X add 0E002A047E;
#X add 0E002A0A2E;
#X prefix_set 0 0 <none> 0;
#P newex 144 391 40 196617 itoa;
#P newex 144 360 57 196617 zl slice 10;
#P newex 103 319 51 196617 zl slice 1;
#P newex 103 293 54 196617 thresh 40;
#P toggle 103 187 15 0;
#P number 145 186 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 103 210 52 196617 metro 20;
#P button 85 215 15 0;
#P newex 103 254 98 196617 serial b 9600 8 1 0;
#P comment 158 321 100 196617 filter out start bit;
#P window linecount 2;
#P comment 520 113 156 196617 checks if tag is already in list \, if not adds it. if yes shows the id;
#P window linecount 1;
#P comment 281 65 80 196617 RFID tag reader;
#P comment 587 177 100 196617 clear taglist;
#P window linecount 2;
#P comment 173 212 100 196617 how often the serial port is checked;
#P connect 9 0 7 0;
#P fasten 6 0 5 0 90 240 108 240;
#P connect 7 0 5 0;
#P connect 5 0 10 0;
#P connect 10 0 11 0;
#P connect 11 1 12 0;
#P connect 12 0 13 0;
#P connect 13 0 23 0;
#P connect 8 0 7 1;
#P connect 15 1 24 0;
#P connect 24 0 17 0;
#P connect 17 0 18 0;
#P connect 15 2 17 1;
#P connect 16 0 17 1;
#P connect 23 0 15 0;
#P connect 15 0 19 0;
#P connect 18 0 19 0;
#P connect 19 0 21 0;
#P connect 21 0 20 0;
#P connect 14 0 16 0;
#P connect 14 0 26 0;
#P connect 15 0 14 0;
#P connect 22 0 14 0;
#P connect 20 0 14 0;
#P window clipboard copycount 27;

64 Responses to “RFID id-12 tagreader”

  1. Conversations with spaces From the lab: ID-12 RFID reader « Says:

    [...] a bluetooth modem. You can find a code example for maxmsp + schematics on how to hook up the reader here. Posted in max, physical computing, lab, tools, software, [...]

  2. David Says:

    Great project! A friend and me been trying to set up a ID-20 and a bluesmirf to connect to a Max/msp patch on my mac today.
    We soldered together the components and managed to connect the smirf to my mac. There is a copy the above patch running and when i set up the correct port, the indicator light in the smirf stopped flashing comes on red. When i move a tag near the reader the led connected to the ID-20 comes on.
    So all seems to work fine, except there is no data coming into the max/msp patch…

    I’ve had hassle with mac and bluetooth before, but we have tried all the tricks i know off. Maybe you have some suggestions?

    Thanks!

  3. hcgilje Says:

    Hi David,
    the only issues I have heard from people trying out the patch, is that it might be necessary to adjust the thresh value to get the right number of values collected, but you are not getting anything? Maybe try to add a print object to see if anything at all comes out of the serial object. Since your ID-20 indicates it registers a tag, and you have a bluetooth connection, the only other problem I could think of is that there is a problem with the connection between the ID module and the bluesmirf, or that your format pin is not set right (to ground on the ID12, I assume the same on the ID20).
    hc

  4. David Says:

    :-) got it to work!

    Thanks!

  5. David Says:

    (I think the setting of the smirf might have been altered for the last project it was involved in, set it back to 9600 BD and fast data mode and it started working (found pdf instructions at sparkfun))

  6. kiwi Says:

    hi.. may i know if this code will work?:
    Private Sub Form1_Load( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load

    For i As Integer = 0 To _
    My.Computer.Ports.SerialPortNames.Count – 1
    cbbCOMPorts.Items.Add( _
    My.Computer.Ports.SerialPortNames(i))
    Next
    btnDisconnect.Enabled = False
    End Sub

  7. hcgilje Says:

    I have no idea if your code would work, sorry, but maybe someone else sees your comment and can help you out.

  8. TJ Says:

    Hi could you give me details on implementanting the above with a PIC microcontroller? I know we have to hook up the output of the ID-12 to the EUART of the microcontroller – however i’m worried about overflow and underflow and detecting the actual RFID serial no. within the PIC.

  9. hcgilje Says:

    sorry,
    I only work with the arduino.
    hc

  10. george powell Says:

    If you have any questions regarding the ID12 then pls feel free to contact me at help@id-innovations.com

    I may be able to help because I designed it.

    Really nice to see all the applications you that you have all put this module to, amazing.

    GP

  11. chock Says:

    Hey,

    was wondering if is there any other way to check if the ID-12 Reader is working. I was thinking if i “may” have fried it somehow. I seriously need a simple way to even know if it’s working. Thanks in advance

    chock

  12. kim Says:

    Hi there,

    I actually have the same question as chock. I just got my ID-12 yesterday, and I’ve set up the circuit exactly as it is here (using an Arduino Diecimila). I haven’t been able to get any response from either the LED or the serial port. Is there a quick and dirty way to test if the board is dead?

    I was curious about one other thing: can you have the serial coming in pin RX (on the Arduino) while monitoring the data over the USB connection? I was under the impression this didn’t work.

    Thanks!

  13. george powell Says:

    Dear Constructors

    RE: ID12

    The circuit diagram for the ID12 has an error. It will blow up the ID12 because the diode is driven directly without a 1k series resistor!!!

    Please check out the ID series data sheet at http://www.ID-innovations.com
    or Email help@id-innovations.com

  14. hcgilje Says:

    For some reason I didnt see this last comment before today, and I am sorry if this has caused problems for people, I have not had this problem at all and have used my ID12s for a while. Anyway, I have uploaded a new image to reflect the 1k resistor between pin 10 and the LED.

  15. george powell Says:

    Thank you Hcgilje for posting new cct!

  16. Ali Says:

    Would anyone please tell me what is the specification or the brand name of the tags that can communicate with the 12 core RFID you used cause I need to buy some tags and I am not sure if compatibility would only depend on the frequency of the reader and the tag.

  17. hcgilje Says:

    hi ali,
    the id-12 uses passive 125KHz tags

  18. Ali Says:

    Hi ,
    I have a question please. I am trying to connect the blueSmirf to the RFID 12 core reader and I am wondering which pins from the RFID should be linked to the bluetooth device.

  19. hcgilje Says:

    the pin that goes to the microcontroller in the schematic above (the dot), which is the serial out.

  20. david Says:

    Have tried it out and it work perfectly.

  21. diana Says:

    Have connected as shown, and I’m getting response in Arduino’s serial monitor, but it’s only junk data. Specifically, I get “ÿÿÿÿÿÿÿÿÿÿÿÿÿ” for any tag scanned. Anyone have thoughts as to why this might be? Thanks so much in advance!

  22. sky Says:

    Hi, I got a problem with my RFID reader. It seems that it is only able to read a bunch of question marks when I run the code given above. The LED blinks when I place a card near it but the serial monitor just shows me 13 ? symbols. Is there a problem with my RFID reader? I am using the white RFID cards ( 125 kHz tag).

  23. Thomas Says:

    I’m having the same trouble as diana. Outputting the data as hex says it’s just a bunch of FF bytes.

  24. Thomas Says:

    Sorry for the double-post, but I had a look at the ID12 datasheet which mentions a 4K7 pull-up resistor to be put on the clock and data pins. Unfortunately I have no idea of how to do this and cannot test it. Can anyone else shed some light?

  25. Thomas Says:

    And again, a triple-post. But this time with the solution to the “ÿÿÿÿÿ”/FFFFFF problem; connect a 4K7 resistor between V+ (+5V on the schematic) and pin 9.

  26. Maha Says:

    I have a problem with the ID-12.
    i connect pin 9 through the Max232 to the computer serial port to see the readed Tag code on the hyperterminal.
    when power on the led goes red even there is no tag to read.
    and the hypertermial didn’t receive anything (if the tag exist).
    can anyone explain this to me?did the ID-12 IC blow up.

  27. zach Says:

    i am having the same ffffff problem, i tried a pullup resistor but it doesnt work any suggestions?

  28. Alex Says:

    I have the same ffff problem….

    The thing is that the ID12 isn’t responding to changes in format pin… in other words the output is always in Wiegand26 format. (I have a logic analyzer).

    I don’t know what I’m doing wrong (I’m using pull ups resistor and connect the format pin to GND!

    HEEELP!

  29. Alex Says:

    To solve the ffff’s problems you have to use pull up resistors.

    There’s another problem with this IC.

    You MUST disconnect the power supply pin of the IC and connect it to GND. After this step the IC takes the new configuration of the format selector pin (7). (5v – Wiegand26 ; 0V – Ascii; PIN 10 – Magnet Emulation). This is because the reset pin doesn’t work as expected.

    You don’t need to use pull-up resistor in Ascii Mode.

  30. Alex Says:

    To zach:

    If you’re using pull up resistors and still getting FF’s, your problem is that you’re in Wiegand26 format output. Change the output to Ascii mode as I described in my last post.

  31. Daxesh Says:

    hello,
    i m working on rfid project. i do no know how i connect pic16 to id-20. please sent me schemetice daigrame and programe.

  32. hcgilje Says:

    Please check out the ID series data sheet at http://www.ID-innovations.com
    or Email help@id-innovations.com

  33. Edo Says:

    Yes, it works! (without any pull up resistors) =)

    And: It is possible to upload software to the arduino without cutting the RX -> Pin 9 wire. Just put a diode between the RX pin from the arduino and the pin 9 from the ID12 module. It works great!

    Best, Edo

  34. scatalogic Says:

    Hello HC,

    This is great, thanks a lot for sharing. I’ve got everything working via arduino into max and am now trying to use a bluesmirf. I’ve got the bluesmirf going in max, at least the light goes green anyway. And the ID12 LED is still lighting when I scan, but I’m not getting anything into max. Am I connecting serial from ID12 to the RX on the bluesmirf, doesn’t seem to work?

  35. hcgilje Says:

    Hi,
    I would first get the bluesmirf working properly. The light should be red when it is connected to another bluetooth device.

  36. Abdullah Says:

    this is so great
    but I didn’t understand the id connection how to connect to AVR(ATmega32)

  37. Geoff Says:

    My apologies if this is off-topic, but I’ve recently purchased 125 KHz RFID readers from China and I get different results depending on which reader I use. One reader provides the number that is printed on the tag and the other produces a longer number that appears to be a fixed offset from the first. ie the same card data is interpreted differently by each of the two readers.

    Some of the cards that I purchased had two numbers on them – and these turn out to be the numbers that I’m seeing from each of the readers.

    I’d be grateful for any advice here. I’ve tried to work out the relationship between the two values returned but have so far been unsuccessful.

  38. Dhanush.A Says:

    hello friends

    Kindly include a full circuit to connect the ID-12 to computer RS232 port, does it needs a level shifter. Which pin is used as RS232 out 8 or 9?

  39. abdullah Says:

    I use 9 and it work

  40. Sib Says:

    Hi,
    1/4 W is enough for 1KOhm resistor?

  41. abdullah Says:

    how can i interface id-12 with atmega 8

  42. neel Says:

    hi im a student, i really dint understand wat r the serial.write etc structures .. from wher do i get them

  43. neel Says:

    actually i am working on a project from the instructables website : RFID based door lock . The references to reading and writing to the reader is taken from here but it has not been building the hex file properly . It shows the following error: C:\Users\sharanya\one/one.c:190: undefined reference to `serialavailable’
    This is using AVR studio 4 and atmega168 microcontroller could u please help ..

  44. Andrew Says:

    neel – I have posted an instructable called “RFID Car immobiliser with PIC12629″ It’s much simpler than the AVR type and i could write code to make it into a normal access module if you like. At the moment it just latches a relay on reading a tag and successful match with one in EEPROM. I could change it to be momentary output (5 seconds or something like that) suitable for an electronic lock. Post me a message on instructables if you’re interested.

  45. Sajiv Says:

    Will this module gives serial output data?

  46. kay Says:

    Hi,
    How could I interface ID-12 with 8051 micro-controller. Currently I’m using AT89S52 and connect directly pin 14 (T0) & 15 (T1) to pin 9(DATA0) & 8(DATA1) of ID12 respectively. I followed the ID12 circuit exactly from the datasheet but still not working to detect any card present. Do I need MAX232 in between or any external antenna?
    Please someone help me..

  47. Interaction Lab - RFID tags Says:

    [...] scanning the page i got a lead to a diagram and a paragraph describing the correct connections. the diagram goes like this. and the description read “If you are using the breakout board [...]

  48. Netduino RFID « I am War Bear! Says:

    [...] we use to go to work (those HID badges are really different!). I wired it up using the guide from this site though it was meant for and Arduino board (which I tried it on first). Below is a short video [...]

  49. Interaction Lab - communicating between distant Arduinos Says:

    [...] account starting spamming everyone. included are two projects: the Arduino code is based heavily on this code, from the wonderful Arduino playground. it not only passes the RFID tag ID to the computer but also [...]

  50. felipe Says:

    Hi, I have the same problem as alex. When reading any card FFFFFF throws me, I know the end is the solution, please help.

  51. M salman Says:

    I have aproject this year,and my project contains of Skye RFID mini,who can I connect it to the computer to read the tag???

  52. zEtA Says:

    Hi, I’m working with ID-12 in my arduino proyect. I have the same ÿÿÿÿÿÿ trouble and i have read all coments. I tried the above solutions, but I still have the same problem. Who can tell me how to solve this problem? Excuse me for my English.
    Thank’s.

  53. carlos negron Says:

    hi im working with the id-12 for a door lock. Im using a rfid usb board to communicate with my computer. But i’d like to change its output dataformat. is there anyway to so?
    this is what im getting now: 45/00/52/EA/FF/02 HEX
    this is how i’d like it to be: 69/0/82/234/255 DEC

  54. Mario Says:

    Question: Can you measure the time it takes to get a response back? I want to use an active rfid tag and use the arduino to figure out how far away the tag is.

    Many Thanks!

  55. How to build a ‪Mobile RFID-Reader: ID-12 + XBee + Arduino‬ | kavasmlikon Says:

    [...] The wiring of the ID20 is based on hcgilje’s description: http://hcgilje.wordpress.com/resources/rfid_id12_tagreader/ LD_AddCustomAttr("AdOpt", "1"); LD_AddCustomAttr("Origin", "other"); LD_AddCustomAttr("LangId", [...]

  56. jonny Says:

    hiii…
    I have arduino uno, window xp, ID-12, sparkfun breakout board, 125khz cards…..and i did each and every thing you did but there is no output on serial monitor not even like other guy’s have fffff…..mine serial monitor is totally blank…..I have two ID-12 & i tried with both but nothing comes out

  57. Dzordzs Says:

    Hi Jonny,

    The problem is SoftwareSerial that comes with IDE v.1.0.2
    Easiest workaround is to update code with check before rfid.read()

    rfid.listen();
    if(rfid.available() > 0)
    {
    ….
    }

    There are two places to be updated
    form https://github.com/freetronics/RFIDLockShield/issues/1

  58. Controlling servo motors with a mobile phone | Arduino collector blog Says:

    [...] ID-12 RFID reader + Arduino Image by hc gilje More info at hcgilje.wordpress.com/resources/rfid_id12_tagreader/ [...]

  59. Nice Arduino Bluetooth Serial photos | Arduino collector blog Says:

    [...] ID-12 RFID reader to usb Image by hc gilje More info at hcgilje.wordpress.com/resources/rfid_id12_tagreader/ [...]

  60. Maria Thampan Says:

    THE CODE IS NOT WORKING


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 176 other followers

%d bloggers like this: