Serial Data Logging of RFID Tags

Parallax and Grand Idea created a very easy to use RFID passive tag reader that outputs tags as serial data.

The serial output of the reader can be feed directly into the ioBridge IO-204 with Serial Smart Board. The output can be parsed using theĀ Serial API.

In this project, we will use an Arduino board to control the RFID reader, to read the RFID tags, and to send the tags to the IO-204 to be logged into an external database. Use this project to gather the unique RFID codes ran near the reader.

Project Components

  • ioBridge IO-204
  • Serial Smart Board
  • Arduino
  • Parallax RFID Reader
  • Jumper Wires

Data Logging Setup

ioBridge.com features the ability to setup one data logging database that can be used with or without the ioBridge IO-204.

  • Click Add Data Log on Modules Tab
  • Select Data Log from External Source

An 18 digit long API Key will be generated that you can use with this project or your own projects that require a database. This projects uses the Serial Web Services API to pass data to a database using serial strings received by the serial smart board on the IO-204.

ioBridge IO-204 Setup

The IO-204 requires very little setup to capture the streaming serial data from the Arduino. The SoftwareSerial output of the Arduino will be at a Baud Rate of 2400 with a True Signal Mode.

Here are the settings for the IO-204:

  • Connect Serial Smart Board to an open channel
  • Change Channel Mode to Serial
  • Change Baud Rate to 2400
  • Change Pacing to 0
  • Change Signal Mode to True

Arduino Setup and Code

The Arduino will handle the reading of the RFID tags and sending the data log command to the IO-204.

Notes

  • The RFID tags will output a unique 10 digit code
  • The RFID reader must be enabled (pin low) to read tags
  • If you leave the time stamp field of the data logging command empty, the database will use the current time and date stamp

Physical Setup

  • Connect RFID Reader /Enable pin to Arduino Pin 2
  • Connect RFID Reader SOUT to Arduino Pin 3
  • Connect RFID VCC and GND to Arduino 5V and GND pins
  • Connect Arduino pin 4 to IO-204 Serial Smart Board Receiver
  • Connect Arduino GND pin to IO-204 Serial Smart Board Ground

Arduino Sketch

  • Insert ioBridge Data Log API Key in to Arduino RFID Sketch
  • Upload code to the Arduino microcontroller
//
// ioBridge.com Serial Data Logging of RFID tags
//

#include <SoftwareSerial.h>

int  val = 0;
char code[10];
int bytesread = 0; 

#define rxPin 3 // Connect to SOUT pin
#define txPin 4 // Connect to ioBridge Serial RX

SoftwareSerial RFID = SoftwareSerial(rxPin,txPin); 

void setup()
{
  pinMode(2,OUTPUT);       // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin
  digitalWrite(2, LOW);    // Activate the RFID reader 

  RFID.begin(2400);        // Start SoftwareSerial
}

void loop()
{
  if((val = RFID.read()) == 10) {

    bytesread = 0;
    while(bytesread<10)
    {                                // read 10 digit code from RFID Reader using SoftwareSerial
    val = RFID.read();
      if((val == 10)||(val == 13))
      {
        break;                       // stop reading
      }
      code[bytesread] = val;         // add the digit to the string
      bytesread++;                   // ready to read next digit
    } 

    if(bytesread == 10) {

      char tagIn[32] = "";

      for (int j=0; j<10; j++) {
        tagIn[j] = code[j];
      }

      RFID.print("[[[data_log|___Data Log API Key___||"); // ioBridge Serial Data Log Command
      RFID.print(tagIn);                                  // RFID Tag to log
      RFID.print("]]]");
    }
    bytesread = 0;
    delay(1500);                                          // wait before reading another tag
  }
}

Resources

click to chat