Innovations ID-2/ID-12/ID-20 RFID reader

Hello all!

I was searching for a library for Innovations RFID reader and I was unable to find a library ready to use, so I decide to grab all informations and code examples that I could find and I made my first library.
Mainly its based on “Can You ID This? ID-20 RFID Reader + Arduino” example and Code for the Innovations ID-12 RFID tag reader

You can find this library on github:

The example output should look like:

readTag: 0B002CB350C4
Checksum: C4 - C4 -- passed.
cardPresent: 1 & validRead: 1
0B002CB350: blue tag

or something like:

bytesRead.len: 1
cardPresent: 0 & validRead: 0
no tag present

If you want to test with your tags, you should change the definition of tag1 and/or tag2 from the beginning of the example.

 char tag1[11] = "6A008FB104";
 char tag2[11] = "0B002CB350";

I did not make it public yet, because I need a second opinion about the implementation. So please give me all your inputs about what I did wrong and what can I improve.

I hope it will help some other people to, but for me it was a good exercise on how to make a particle library.

1 Like

ok, so after one week there is no feedback.
maybe this type of sensor does not meet the public interest.

Before I make this library public available, I have one question and I need your advice:
Should I let debug info enabled in library, or should I disable all serial.print() used for debug?

The code looks like that:


    Serial.println("bytesRead.len: " + String(strlen(bytesRead) < 12));

I’m thinking to comment the “#define DEBUG_MODE_RFID” in order to eliminate the unnecessary communication through serial port and to minimize code execution time.

thank you in advance.

@botosu, I would suggest disabling debugging by default but add a comment about its use. The fact that you have debugging in your code is excellent. :smile:

good point about documenting the use of debug.

… but this just raised another question:
Speaking from the WebDEV point of view, the code from library can not be modified (comment/uncomment code) if you just include the library in your project. You have to copy/paste the code, so this implies that you know what you are doing => you know how to use a debug info. Correct? :smile:

Anyway I will add a short piece of text about enabling debug info.
Thank you for suggestion.

@botosu, yup, that web IDE issue is a problem. Defining the DEBUG flag in the demo app will only be good within that scope (and the #include files). One approach is to define the class constructor in the .h file and set a private class variable (debug_on?) in the constructor based on the DEBUG compiler flag. Perhaps @bko knows of a different approach?

hmm it’s a long time since I was writing C code, but in my good days the code between #ifdef and #endif will be ignored by compiler so the code will be a little bit smaller and faster with my approach.

with a private variable, we have some extra if decisions to execute… and this does not sound very good for me when we speak about a small CPU (I was some kind of ASM freak before the web era :blush: )

@botosu, I fully agree. My suggestions had to do with the issues imposed by the web IDE (not being able to edit the library code). :smile: