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;
May 8, 2007 at 22:27
[…] 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, […]
May 22, 2007 at 21:39
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!
May 22, 2007 at 22:09
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
May 23, 2007 at 0:12
🙂 got it to work!
Thanks!
May 23, 2007 at 0:16
(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))
June 11, 2007 at 4:07
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
June 11, 2007 at 20:43
I have no idea if your code would work, sorry, but maybe someone else sees your comment and can help you out.
September 21, 2007 at 5:01
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.
October 1, 2007 at 16:09
sorry,
I only work with the arduino.
hc
October 4, 2007 at 18:59
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
October 12, 2007 at 7:40
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
October 23, 2007 at 4:31
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!
October 23, 2007 at 9:06
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
November 12, 2007 at 18:58
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.
January 11, 2008 at 18:24
Thank you Hcgilje for posting new cct!
July 29, 2008 at 20:18
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.
August 7, 2008 at 10:50
hi ali,
the id-12 uses passive 125KHz tags
August 7, 2008 at 21:59
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.
August 8, 2008 at 9:46
the pin that goes to the microcontroller in the schematic above (the dot), which is the serial out.
September 17, 2008 at 14:17
Have tried it out and it work perfectly.
October 15, 2008 at 7:37
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!
October 16, 2008 at 6:42
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).
October 28, 2008 at 13:27
I’m having the same trouble as diana. Outputting the data as hex says it’s just a bunch of FF bytes.
October 28, 2008 at 17:15
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?
October 29, 2008 at 17:50
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.
December 22, 2008 at 10:47
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.
December 25, 2008 at 10:23
i am having the same ffffff problem, i tried a pullup resistor but it doesnt work any suggestions?
January 30, 2009 at 22:02
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!
January 31, 2009 at 0:34
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.
January 31, 2009 at 0:37
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.
May 23, 2009 at 0:14
[…] https://hcgilje.wordpress.com/resources/rfid_id12_tagreader/ […]
July 30, 2009 at 7:47
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.
July 30, 2009 at 10:23
Please check out the ID series data sheet at http://www.ID-innovations.com
or Email help@id-innovations.com
August 28, 2009 at 22:07
[…] BARRAGAN <http://people.interaction-ivrea.it/h.barragan>; // and code from HC Gilje – https://hcgilje.wordpress.com/resources/rfid_id12_tagreader/ // Modified for Arudino by djmatic // Modified for ID-12 and checksum by Martijn The – […]
September 30, 2009 at 0:40
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
February 26, 2010 at 12:46
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?
February 26, 2010 at 17:25
Hi,
I would first get the bluesmirf working properly. The light should be red when it is connected to another bluetooth device.
March 13, 2010 at 19:28
this is so great
but I didn’t understand the id connection how to connect to AVR(ATmega32)
March 31, 2010 at 3:05
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.
April 4, 2010 at 8:18
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?
April 9, 2010 at 19:28
I use 9 and it work
April 19, 2010 at 12:14
Hi,
1/4 W is enough for 1KOhm resistor?
April 20, 2010 at 16:15
yes
May 9, 2010 at 21:54
how can i interface id-12 with atmega 8
May 16, 2010 at 7:48
hi im a student, i really dint understand wat r the serial.write etc structures .. from wher do i get them
May 16, 2010 at 7:59
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 ..
May 27, 2010 at 6:56
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.
July 2, 2010 at 4:28
Will this module gives serial output data?
July 5, 2010 at 21:16
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..
November 1, 2010 at 20:52
[…] https://hcgilje.wordpress.com/resources/rfid_id12_tagreader/ […]
November 7, 2010 at 14:05
[…] 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 […]
November 16, 2010 at 5:16
[…] 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 […]
December 19, 2010 at 14:01
[…] 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 […]
February 21, 2011 at 0:27
Hi, I have the same problem as alex. When reading any card FFFFFF throws me, I know the end is the solution, please help.
March 19, 2011 at 17:33
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???
April 22, 2011 at 23:52
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.
August 8, 2011 at 2:20
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
November 1, 2011 at 19:07
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!
January 4, 2012 at 7:30
[…] The wiring of the ID20 is based on hcgilje’s description: https://hcgilje.wordpress.com/resources/rfid_id12_tagreader/ LD_AddCustomAttr("AdOpt", "1"); LD_AddCustomAttr("Origin", "other"); LD_AddCustomAttr("LangId", […]
December 6, 2012 at 12:51
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
December 27, 2012 at 19:43
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
March 7, 2013 at 23:43
[…] ID-12 RFID reader + Arduino Image by hc gilje More info at hcgilje.wordpress.com/resources/rfid_id12_tagreader/ […]
April 24, 2013 at 11:40
[…] ID-12 RFID reader to usb Image by hc gilje More info at hcgilje.wordpress.com/resources/rfid_id12_tagreader/ […]
July 9, 2014 at 3:47
THE CODE IS NOT WORKING
November 1, 2014 at 12:26
Serial.print(val, BYTE); is wrong, substitute with Serial.write(val);
November 1, 2014 at 13:56
thanks for the update. The original post is from 2007 so there has been several changes in the syntax of the arduino code since then.
December 25, 2014 at 4:02
Is there a way to add LCD screen to it? I’ve been lookin but I couldn’t find any codes . any help would be appreciated .
April 13, 2016 at 17:10
in the sub patcher there is a comment that you can ‘loadbang for last saved one’ – how to I loadbang the last saved port?
April 13, 2016 at 18:06
I am not sure which subpatcher you are talking about? It´s at least not mentioned in the code I posted.
April 14, 2016 at 14:07
Ok. I am having strange issues where the rfid string does not get accepted by select or route objects. But if I write out the rfid string manually as a message is gets accepted. Any idea about this? I have been struggling with the same issue for days trying different workarounds but it never works. Thanks btw for responding to this even though it is an old post – really appreciate it 🙂
April 14, 2016 at 14:09
Btw… I am using a SparkFun RFID USB Reader (https://www.sparkfun.com/products/9963) with a ID-12la
June 4, 2016 at 3:55
Hi I’m using the reader for an access system control…
I’m using the code from Practical Arduino https://github.com/practicalarduino/RFIDAccessControlSingle/blob/master/RFIDAccessControlSingle.pde
But I can’t read anything
I only get FFFFFF and ÿÿÿÿÿÿ
Please help!!