RFID Reader Code Question

Hi there,
I have the book from Tom Igoe “RFID For Beginners” and am having trouble trying to get the code to read my RFID tag. When I pass the tag over the reader, I get some strange symbols rather than the code. The symbols are different depending on what tag I use, so I think it’s reading the tags but maybe not displaying them correctly. Attached is a screenshot of what my serial monitor looks like when I pass two different RFID tags over the reader–as you can see I get different kinds of jumbled signals. I have an Arduino Uno, Arduino 1.0.1, an ID-12 RFID reader, and the RFID breakout board from Sparkfun.

In terms of wiring it up I have followed his instructions from the book.

  • The 5V (pin 11) and RST (pin 2) pins are connected to power.
  • The GND (pin 1) and FS (pin 7) pins to the ground line.
  • And finally D0 (pin 9) is connected to Pin 6 on the Arduino since it’s defined as the Rx pin.

Here’s the code that I have. Originally in the book the startByte and endByte were 0x0A and 0x0D (for the Parallax reader), but in the book Programming for Interactivity, it says that the code for Parallax and ID-12 readers are similar except that ID-12 readers have start and stop values of 0x02 and 0x03, respectively. So I changed them.

 RFID Reader

#include <SoftwareSerial.h> // Bring in the software serial library 
const int tagLength = 10;    // each tag ID contains 10 bytes 
const int startByte = 0x02;  // Indicates start of a tag
const int endByte   = 0x03;  // Indicates end of a tag

char tagID[tagLength + 1];   // array to hold the tag you read 

const int rxpin = 6; // Pin for receiving data from the RFID reader
const int txpin = 7; // Transmit pin; not used
SoftwareSerial rfidPort(rxpin, txpin); // create a Software Serial port 
void setup() {
  // begin serial communication with the computer

  // begin serial communication with the RFID module

void loop() {
  // read in and parse serial data:
  if (rfidPort.available() > 0) {  
    if (readTag()) {  
  Serial.println("read tag!");

 This method reads the tag, and puts its
 ID in the tagID
boolean readTag() {
  char thisChar = rfidPort.read(); 
  if (thisChar == startByte) {   
    if (rfidPort.readBytesUntil(endByte, tagID, tagLength)) {      
      return true;
  return false;

Thanks in advance for any help you can give!

  • Cilla


My RFID reader operates at 9600 baud. Are you sure yours is 2400?

Try some different speeds.

Good catch! I changed it from 2400 → 9600 and it seemed to work! Thanks!