RFID Readers with Netduino

Up until now, all I had done with the Netduino was blink the built-in LED, but after seeing a question on the Netduino forum regarding two RFID readers I had laying around, I got inspired and did a few tests.

The question on the forum was about reading distance, so that will be the focus of this post.

The two readers in quetion are:

I got the Parallax reader from the Maker Shed Store and the ID-20 from Sparkfun, but they are both available from other sources too.

I started out with some code by ATXcoder in the Netduino forum but did a few modifications, since I was getting double reads. Using a logic analyzer I found that the Parallax module actually sends out two reads in some cases, so the extra code is just to ignore that.

The same code was also slightly modified to work with the ID-20 module. The major changes was setting the baud rate to 9600 instead of 2400 and changing the buffer size to 16 bytes, since the ID-20 has different, and more, control characters in addition to a checksum.

After trying the two readers with the same tags (both the credit card style and a keychain tag) I must say, that they perform pretty much the same. Both have some variation over time. You can have a read at 3 inches and right after it won’t read the same tag until it get to about 2 inches away.

Here is the Visual Studio 2010 solution, with two Netduino projects, one for each reader. Ideally these would be wrapped up in nice little classes, but I haven’t gotten to that yet. Feel free to use.

Demo video
I have made a little video showing both readers using both of the two tag types. Both tags are EM4100 family passive tags that I got from the Maker Shed Store. The distance indications on the paper is inches.

12 thoughts on “RFID Readers with Netduino”

  1. Eduardo says:

    Hello, I do not understand electronics and I’m starting with the development for netduino, I would like to know if you could tell me how to connect the RFID ID-12 on the netduino with breadboard (http://toscos.com/products/Bread-board-connector.html).

  2. On the mechanical side, you will need to apply the same trick as I did in this post: http://www.hackmeister.dk/2011/01/converting-between-2mm-and-100mil-pin-spacing/ It’s because the pin spacing on the ID-12 and ID-20 is 2mm and not the 2.54mm (0.1 inch) that is used for normal breadboards.

    I used the datasheet at http://www.sparkfun.com/datasheets/Sensors/ID-12-Datasheet.pdf as a reference and powered the device from the netduino to reader pin 11 with 5V and GND to reader pin 1. Pin 9 (TTL Data) was connected to pin 1 on the netduino and to get the right format, I connected pin 7 on the ID-12/20 to GND. Lastly, I tied pin 2 on the ID-12/20 to 5V as told in the datasheet.

    The code used on the netduino is available for download above.

    Sorry I don’t have a connection drawing, but I hope the above helps.

  3. Eduardo says:

    Thank you for your help thomas, I’ll try to follow your statement.

  4. Eduardo Teixeira says:

    Hello Thomas, I just recently got tested and everything worked perfectly (just had to put the pin 9 to pin 0, perhaps because I used the ID-12), thank you for your help!

  5. Eric Moore says:

    Hi Thomas. I’m currently playing with your code and seem to be having a little problem. The read seems a little flaky. I’m using an ID-20 and the readcnt sometimes wll ring true at 16 other times it seems to try to run the if statement before it’s finisherd counting and runs as many cycles as it needs to hit 16. I.e. 2 loops of 8, loop readcnt = 2, readcnt =4, readcnt = 10… It’s quite odd. To me anyway, but I’m just starting out. I have a spare ID-20 and have tried swapping it out, and I’m using the sparkfun RFID cards, and an RFID button from their site as well. It’s really cool when it works, I just want it to work everytime :) The only other thing I haven’t tried is not using a breadboard inbetween and connecting directly to my NetduinoPlus. My breadboard works for everything else though which is why I haven’t gone direct. Any thoughts? Thanks

  6. Hi Eric,

    It’s been awhile since I worked with this combo, but I don’t remember problems as you describe, but I can’t rule out the possibility of bugs in my code, it was written pretty quickly and hasn’t been tested extensively, just used for trying out the different readers.

    I know it’s not much help.


  7. Manuel says:

    Hey thomas great stuff!

    I have to do the following project: I need to have a netduino board with a GPRS QUADBAND MODULE (but I read a comment of your saying since this is for arduino might need a modification) and an ultrasonic sensor (http://www.sparkfun.com/products/8501) that perform some measuraments and then sends info when an object is at a certain distance.
    is it doable?

    Furthermore I’d like to ask you if you think there could be a way of having this system powered up autonomously with some batteries that could last a long time (outdoor application) or solar panel (last resort).
    Please let me know something.. :)

  8. Hi Manuel,

    Generally for Arduino shields used on Netduino, you need to check a few things, most importantly the voltage levels, since the Netduino has 3.3v I/O. I have only been playing with GSM modules on the Arduino, but there I found out that during startup, the modules needs a lot of power, and you board needs to supply that. If not, the module won’t turn on correctly and you will run into trouble.

    Regarding the distance sensor, if you are planning on using the serial interface, be sure to convert to the correct logic levels as this uses RS232 and not TTL. If you are using a Netduino Mini there is actually an RS232 port on the board that uses the right logic levels.

    I’m not sure I understand you correctly when you say “powered up autonomously”, but if you are talking about going into sleep mode and then waking up once in awhile, that’s definitely a good idea for battery powered circuits, but the exact implementation depends on the use case. Also, the definition of “a long time” is extremely relative to the use scenario: are we talking days, weeks, months and how small does it need to be? Connecting a cell-phone to a fully charged car battery will keep it going for quite a while.

    Hope it helps,


  9. David says:

    Hi Thomas,
    thank you very much for your article and for sharing your experiences :) !!
    I would like to connect more that one antenna to a netduino board, but I really don’t understand the difference between UART, RS232, TTL.. :( ..
    Caould you please confirm me that the Netduino Plus 2 board can be connected to 4 RFID Readers…? The Netduino Plus 2 specs say ‘4 UART ports’ but Parallax specs are ‘TTL-level serial interface’, are they the same…?
    Do you know if there are some expansion board to connect more that 4 RFID reader to a Netduino (I would like to add 10s :) ?

    Thank very much you for your support.

  10. Hi David,

    Simple serial communication with an RX and a TX line comes in a few different variations, and the primary difference is the logic levels. For TTL, it’s logic levels between 0 and 5V (or 3.3V depending on the hardware), where RS323 is between -12V and +12V. There are little chips (e.g. MAX232) that translates between the two, if you need it.

    All the RFID readers I have looked at uses TTL level serial communication, but if you find one that is nicely packed up in a case with a D-SUB 9 connector on it, there is a good chance it’s RS232. Back when computers had a serial port, it was also RS232.

    In most cases, the serial ports on micro controllers are TTL level UARTs, and the logic levels follows the standard for the micro controller.

    As I read the data sheet for the Netduino Plus 2, it should be possible to connect 4 RFID readers, one on each serial port.

    If you need a lot of RFID readers looking to see if you can get a model that communicated via I2C or similar might be a better option, since you can then put them on a bus, have way less wires and probably also simplify your code, but unfortunately I don’t have a model to point you at.

    I hope it helps you and feel free to ask again if I miss something or you have other questions.


  11. David says:

    Hi Thomas,
    thank You very much for your support !!


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>