The microreader is wired in permanent read mode, which means the built-in serial ports will not be able to accept programming commands from the PC. To combat this, the microreader data is input on Pin 3 of the Arduino using NewSoftSerial.
The LCD shield is from eBay, from eKitsZone in Hong Kong. The shield was £12.50, as was the Duemilanove from the same source.
Here's the breadboarded circuit from the underside:
The code below works fine. The bit that identifies the transponders is crude, due to the limited selection of tags I have. But this is only a proof of concept, so there's no real problem. PCB shield to follow.
TI page on MicroReader: http://www.ti.com/rfid/shtml/prod-readers-RI-STU-MRD1.shtml
Here's the code. Blogger has removed all the indents, but Arduino's auto format function will repair that.
/*
Serial test program 3 - works with TI Series 2000 reader
This version uses the newsoftserial library as the native serial port is disrupted by
the reader's constant output.
*/
#include
#include
int inByte = 0; // incoming serial byte
int iMsgPtr = 0; // position in reader message
boolean bMsgOn = false; // true when message being processed
boolean bNextID = false; // indicates next byte IDs the transponder (utter bodge!)
NewSoftSerial tiReader(3,2); // define pin 3 as RX, 2 as TX
LCD4Bit_mod lcd = LCD4Bit_mod(2); // define LCD, 2 line display
void setup()
{
// start serial port for input from TI reader at 9600 bps:
tiReader.begin(9600);
// start serial port fordebug output to PC serial monitor at 9600 bps:
Serial.begin(9600);
// initialise the display, clear it and put up a message
lcd.init();
lcd.clear();
lcd.printIn("Transponder ID");
}
void loop()
{
if (tiReader.available() > 0)
{
// get incoming byte from serial port:
inByte = tiReader.read();
// if start of message byte detected declare new message
if ((inByte==1) && (bMsgOn == false))
{
bMsgOn = true; // message being processed
iMsgPtr = -1; // initialise message pointer
}
else
// if processing a message...
if (bMsgOn == true)
{
// if this is the message length byte
if (iMsgPtr == -1)
{
iMsgPtr = inByte + 1; // add a byte to accommodate the error check
bNextID = true; // next btye is start of transponder ID
}
else
{
// decrement message pointer, check for end of message
iMsgPtr--;
if (iMsgPtr == 0)
{
// end of message
bMsgOn = false;
}
// This is the bodged bit. All the tags we have use different first bytes, allowing them to
// be ID'd straight away. The code should really build up an 8-byte ID, checking when complete.
if (bNextID = true)
{
bNextID = false;
switch (inByte){
case 0x61: outputData("Keyring 1");
break;
case 0x63: outputData("Trainer tag");
break;
case 0xCD: outputData("Stick");
break;
case 0xE4: outputData("Keyring 2");
break;
case 0xF5: outputData("Disc");
break;
}
}
}
}
}
}
void outputData(char value[])
{
// output data to LCD, copying to the PC serial for debugging
Serial.println(value);
lcd.cursorTo(2, 0); //line=2, x=0
lcd.printIn(" ");
lcd.cursorTo(2, 0); //line=2, x=0
lcd.printIn(value);
}
Hello PeakCentral...I am very interested to learn of you progress with this project...have you done any more on it?
ReplyDeleteI want to use this MRD reader for an application in "animal tracking"...have you tried to "mimic" the TI controller MB6 here?
Any learned experience combining TI 2000 you can share with me would be much appreciated...I just new to Arduino and it seems very impressive.
Kind regards
Ray
ray.l.seidel@gmail.com
Hi Ray,
ReplyDeleteI did use the 2000 reader in a control project that went into South African prisons (!), and it worked really well using keyfob transponders. The demo I did on the blog was simply a proof of concept for use in teaching, so I haven't taken it any further at the moment. The problem you will have with the 2000 and associated transponders is the antenna - generally, it needs to be quite big. Also, you get problems if there is more than one transponder being received. However, this can be overcome such as in the ChampionChip marathon system.
What's your application?
Martin
Hello Martin...sorry for delay
DeleteMy application is in the cattle industry...
here up to 37 cattle run onto a weigh-bridge and as they do we will read their (HDX) RFID tags...
want use a "lot of receivers" to manage data collisions...so thought using either Mini-reader or TI TMS3705 and an Arduino might be cheaper and now better under my control to do various procedures.
Regards
Ray