Post on 16-Jan-2016
COMPANY CONFIDENTIAL
RFID You Know You Need It Jim Peternel October 29, 2008
Slide 2 COMPANY CONFIDENTIAL
Intro
Learn what you need to know to be able to develop RFID applications.
What Intermec Developer Library tools are available, what languages can you use
What you need to write fixed location (as opposed to mobile) RFID applications.
Slide 3 COMPANY CONFIDENTIAL
Agenda
Quick review of tags.Building an RFID Application.ALE Store and Forward ApplicationRFID SnippetsRFID samples and demo applications you can
download.
Slide 4 COMPANY CONFIDENTIAL
EPCC1G2 Memory Map
Bank 0 Kill Password 4 Bytes Access Password 4 Bytes
Bank 1 Header info Bytes 0-3 EPC Code Bytes 4-15
Bank 2 TID 4+ Bytes (not necessarily unique)
Bank 3 UID Optional ? Bytes
Slide 5 COMPANY CONFIDENTIAL
Let’s Develop an Application
Pick your reader (moved to end)Pick your tags (moved to end)Pick your interfacePick your languageGet Started
Slide 6 COMPANY CONFIDENTIAL
Pick Your Interface
Intermec Developer Libraries (IDL)Let Intermec handle the physical layerEase of code reuseEase of platform switching
PPC2003WM 5.0 and WM 6.0Win32
RFID and Bar Code scanningSeparate IDL’sDownload from Http://www.intermec.com
Slide 7 COMPANY CONFIDENTIAL
Pick Your Interface
Basic Reader Interface (BRI)Simple ASCII interface.No driver dependence.You must handle the physical layer.
Slide 8 COMPANY CONFIDENTIAL
Pick Your Language
Support languagesC#VB .NETJavaVisual Studio 2005 or newer
IF61Linux based readerSupports only Java and C#Uses Windows Mono 2.0 drivers for C#
Slide 9 COMPANY CONFIDENTIAL
Getting Started
Sample code will be in C#.Uses IDLJava will be very similar.Will show critical code samples for both fixed and
mobile readers.Includes bar code examples as well
Slide 10 COMPANY CONFIDENTIAL
Create Basic Project in C#: Win32
Select Windows Application
Slide 11 COMPANY CONFIDENTIAL
Create Basic Project in C#: IF61
Select Windows Console Application
Slide 12 COMPANY CONFIDENTIAL
Create Basic Project in C#: Win Mobile
Select Smart Device -> Device Application
Slide 13 COMPANY CONFIDENTIAL
Add RFID References
Add RFID class references to your project
Slide 14 COMPANY CONFIDENTIAL
RFID References
using Intermec.DataCollection.RFID;
Slide 15 COMPANY CONFIDENTIAL
IDL
You can use built in functions or send BRI commands via the IDL driver.
String sRSP = brdr.Execute("W EPCID=H010203040506070809101112"); String sRSP = brdr.Execute(“R POLL");
Slide 16 COMPANY CONFIDENTIAL
IDL
IDL DebuggerGreat tool shows you communications between reader
and the IDL.Logs information to a text file.Helps us provide you with support.IDLClassDebugLog.txt
Slide 17 COMPANY CONFIDENTIAL
IDL
How to create IDL Debugger object
BRIReader.LoggerOptionsAdv LogOp = new BRIReader.LoggerOptionsAdv();LogOp.LogFilePath = ".\\IDLClassDebugLog.txt";LogOp.ShowNonPrintableChars = true;
On mobile devices the log file is always placed in the root directory. You cannot change that location.
Slide 18 COMPANY CONFIDENTIAL
Run Time Reader Enabling on Mobile Devices
For mobile readers you can make sure that the reader is enabled in Intermec Settings using the following commands
Try {
Intermec.DataCollection.RFID.BasicBRIReader DCEConfig = new BasicBRIReader(null); DCEConfig.Open("TCP://127.0.0.1:2188"); string tt = DCEConfig.Execute("device 1 attrib adminstatus=on"); // BRI ‘device’ command. DCEConfig.Close();}catch (Exception e){
MessageBox.Show("Unable to activate DCE reader connection." + " Verify that the reader is connected and its battery is charged." + " You may not be able to open a reader connection", "DCEConfig.Execute Exception", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);}
Slide 19 COMPANY CONFIDENTIAL
Opening Reader with IDL
When you create the object you are opening the connection to the reader.
String tConnection=null; //mobile readers onlyString tConnection= "TCP://" + "127.0.0.1" + ":2189"; //network local hostString tConnection= "TCP://" + "192.168.27.33" + ":2189"; //networkString tConnection=“SERIAL://COM1”; //serial
this.brdr = new BRIReader(this, tConnection, 22000, 2000, LogOp); 2200 = reader buffer size 2000 = event queue size
Slide 20 COMPANY CONFIDENTIAL
IDL Buffers
Reader Buffer is used to store tags when you use the following commands:WRITEREAD REPORT=DIRECTREAD REPORT=NO
Event Buffer is used to store all events and also tag data when you use:READ REPORT=EVENTREAD REPORT=EVENTALL
Slide 21 COMPANY CONFIDENTIAL
Reader Command Responses
OK>Command succeeded
ERRInvalid command, typo, incorrect parameter, etc.
Slide 22 COMPANY CONFIDENTIAL
Tag Command Responses
RDERRRead error (could not complete read)
WRERRWrite error (could not complete write)
MEMOVRNMemory overrun error (exceed max byte in memory bank)
PVERRMemory locked or password protected or does not exist
PWERRNot enough RF power to execute command
Slide 23 COMPANY CONFIDENTIAL
Verifying Reader Connection
Mainly on handhelds. You can connect to DCE but not to reader.
Send PING commandResponse is “OK>”
String sMsg = brdr.Execute(“PING");
You can also send the VERSION command (VER)
Slide 24 COMPANY CONFIDENTIAL
Checking Reader Module Information Version
String sMsg = brdr.Execute(“VER");
IM5 RFID Reader Ver 9.22Basic Reader Interface Version 3.10FCC 915MHz CC014Copyright (C) 2008 Intermec Technologies Corp.OK>
BRIVER Returns BRI version Basic Reader Interface Version S
Slide 25 COMPANY CONFIDENTIAL
Setting Attributes
Select TAGTYPESet ANTSChoose between IDTRIES or IDTIMEOUTChoose between ANTTRIES or ANTTIMEOUTSet SESSION and INITIALQ
Slide 26 COMPANY CONFIDENTIAL
Setting Attributes
String sMsg = brdr.Execute(“ATTRIB IDTRIES=1"); String sMsg = brdr.Execute(“ATTRIB IDTIMEOUT=1OOO"); String sMsg = brdr.Execute(“ATTRIB TAGTYPE=EPCC1G2,ISO6BG2"); String sMsg = brdr.Execute(“ATTRIB SESSION=1"); String sMsg = brdr.Execute(“ATTRIB ANTS=1,2,3,4"); Response is “OK>”
Slide 27 COMPANY CONFIDENTIAL
Verify Attributes
String sMsg = brdr.Execute(“ATTRIB IDTRIES"); Response “ATTRIB IDTRIES=1CRLFOK>” String sMsg = brdr.Execute(“ATTRIB");
Returns list of all attributes
Slide 28 COMPANY CONFIDENTIAL
ATTRIB SESSION: What are they, when to use?
Valid values 0 to 3 Session = 0
No persistenceBest for reading single tagsBest for making tags/second measurements
Session = 1Max 5 seconds persistence.With Intermec readers we have found session one provides the
most consistent read rates when reading large numbers of tags. Session = 2 and Session = 3
Share the same persistence features.Min persistence time of 2 seconds.
Slide 29 COMPANY CONFIDENTIAL
Reading Tags
Pick your memory bank (0 to 3)Pick your data type
Hex, String, IntegerPick your parametersBasic read command formats:
READ HEX(Mem Bank:Start Addr,Length)READ STR(Mem Bank:Start Addr,Length)READ INT(Mem Bank:Start Addr,Length)Start address and length are always in bytes
Slide 30 COMPANY CONFIDENTIAL
Reading Tags: Memory Banks
EPC IDMemory bank 1, bytes 4-15Typically 96 bitsCan also have lengths 64 bits up to 240 bitsLength based on tag manufacturerREADREAD REPORT=XXXREAD HEX(1:4,12)
Slide 31 COMPANY CONFIDENTIAL
Reading Tags: Memory Banks
TIDTag IDMemory bank 2, bytes 0 to ???Manufacturer informationREAD TAGIDREAD HEX(2:0,4)READ HEX(2:0,8)
Slide 32 COMPANY CONFIDENTIAL
Reading Tags: Memory Banks
User MemoryMemory bank 3, bytes 0-?Length based on tag manufacturerREAD HEX(3:0,100)
Password MemoryMemory bank 0, bytes 0-?READ HEX(0:0,8)
Slide 33 COMPANY CONFIDENTIAL
Read/Write Command Parameters
ANTCOUNTTIMETAGIDEPCIDTAGTYPEAFIRead ant count time afi where….
Slide 34 COMPANY CONFIDENTIAL
Read Mode: When do use what?
REPORT=DIRECTExecute one read then stop
Continuous ReadingREPORT=NOREPORT=EVENTREPORT=EVENTALL
WHY USE THEM? WHEN TO USE THEM?
Slide 35 COMPANY CONFIDENTIAL
Read Mode: REPORT=DIRECT
Good for reading small number of tagsGood for mapping RF FieldReturns tag list after command completes
Depends on: IDTRIES, ANTTRIES, IDTIMEOUT, ANTTIMEOUT
String sMsg = brdr.Execute("R ANT");OrBool bStatus = brdr.Read();
Slide 36 COMPANY CONFIDENTIAL
Read Mode: REPORT=DIRECT
Reading fields and using filtersR Hex(3:0,8) ANT where hex(1:4,2)=h0102String sfilter= “hex(1:4,2)=h0102”String sfields= “Hex(3:0,8) ANT”bStatus = brdr.Read(sfilter, sfields);
Slide 37 COMPANY CONFIDENTIAL
Read Mode: REPORT=NO
Good for reading large number of tags.Not sure when tag will enter field.Must POLL for tag list.Provides best reading performance.
brdr.StartReadingTags(null, "COUNT ANT",BRIReader.TagReportOptions.POLL);
OR
tMsg = brdr.Execute("R ANT COUNT REPORT=NO");
Slide 38 COMPANY CONFIDENTIAL
Read Mode: REPORT=NO Must poll for tag list brdr.PollTags(); string sTagID = brdr.Execute("R POLL");
foreach (Tag tt in brdr.Tags){
string sTagID = tt.ToString(); if (tt.TagFields.ItemCount > 0) { foreach (TagField tf in tt.TagFields.FieldArray) {
sTagID += " "; sTagID += tf.ToString();
} } }
Slide 39 COMPANY CONFIDENTIAL
Read Mode: Disable Continuous Reading
You must turn off continuous read mode when you are done.brdr.StopReadingTags();sMsg = brdr.Execute("R STOP");
Slide 40 COMPANY CONFIDENTIAL
Read Mode: REPORT=EVENT
Good for reading large number of tags.Not sure when tag will enter field.Tags will be returned as events, EVT:TAG H….Tags will be returned one time only when first seen.Need to add IDL Tag Event handlerOnly on IF61 Release 2 will the performance equal
REPORT=NO
Slide 41 COMPANY CONFIDENTIAL
Read Mode: REPORT=EVENT
string sMsg = brdr.Execute("R ANT REPORT=EVENT");
sMsg == EVT:TAG H010203040506070809101112
brdr.StartReadingTags(null, “ANT TIME”, BRIReader.TagReportOptions.EVENT);
void brdr_EventHandlerTag(object sender, EVTADV_Tag_EventArgs EvtArgs) { //********************************************************************* // This function process any tag that is returned as an event. // This function is in use when you send a READ with REPORT=EVENT //*********************************************************************
string sMsg = EvtArgs.DataString.ToString(); ProcessTagData(sMsg); }
Slide 42 COMPANY CONFIDENTIAL
Read Mode: REPORT=EVENTALL
NOT good for reading large number of tags.Not sure when tag will enter field.Tags will be returned as events, EVT:TAG H….Tags will be returned each time they are seen.Good for testing purposes.Warning, you can get over whelmed by tags.
brdr.StartReadingTags(null, “ANT TIME”, BRIReader.TagReportOptions.EVENTALL); sMsg = brdr.Execute("R ANT REPORT=EVENTALL");
Slide 43 COMPANY CONFIDENTIAL
Writing to Tags
Must write even number of bytes (2,4,6,…) Must start write on even memory boundaries (0,2,4,…)
String CurrentCMD = “W hex(1:4,6)=h010203040506”try{ string sMsg = this.brdr.Execute(CurrentCMD);}catch (BasicReaderException eBRI){}
Slide 44 COMPANY CONFIDENTIAL
Using Triggers
If your application requires a motion sensor to tell the reader when to start and stop reading tags you should use triggers.
Triggers uses the General Purpose Inputs (GPI)Two types of triggers
State LevelEdge
Slide 45 COMPANY CONFIDENTIAL
When To Use Edge Triggers
Edge TriggersTrigger “mytrigger” gpioedge 1 1 filter 0Fires when state changes.Fires only one time.Do not need to use TRIGGERREADYAlways set FILTER to zero!
Slide 46 COMPANY CONFIDENTIAL
Create IDL Event Handlers
There are various IDL event handlers you may want or need to add to your application.
If you are just using the BRI interface and not the IDL you will not have access to these useful event handlers.
Slide 47 COMPANY CONFIDENTIAL
Create Event Handlersprivate int AddEventHandlers() { //********************************************************************* // Add the event handler to handle the tag events and trigger pulls. // Not all of these are used but added as samples of what are available. //*********************************************************************
try { this.brdr.EventHandlerRFIDButton += new DCE_BUTTON_EventHandlerAdv(brdr_EventHandlerRFIDButton); this.brdr.EventHandlerRadio += new Radio_EventHandlerAdv(brdr_EventHandlerRadio); this.brdr.EventHandlerTag += new Tag_EventHandlerAdv(brdr_EventHandlerTag); this.brdr.EventHandlerCenterTrigger += new CenterTrigger_EventHandlerAdv(brdr_EventHandlerCenterTrigger); this.brdr.EventHandlerDCE += new DCE_EventHandlerAdv(brdr_EventHandlerDCE); this.brdr.EventHandlerDeviceConnectState += new DCE_DeviceConnectStateEventHandlerAdv(brdr_EventHandlerDeviceConnectState); this.brdr.EventHandlerOverflow += new Overflow_EventHandlerAdv(brdr_EventHandlerOverflow); this.brdr.EventHandlerGPIO += new GPIO_EventHandlerAdv(Form1_EventHandlerGPIO); } catch { return -1; } return 0; }
Slide 48 COMPANY CONFIDENTIAL
Add Trigger Pull Event Handler
This is only for IP4 and IP30 readersvoid brdr_EventHandlerCenterTrigger(object sender, EVTADV_CenterTrigger_EventArgs EvtArgs){ //********************************************************************* // This function fires when the center trigger on the IP4 is pulled or released //********************************************************************* if (bReaderOffLine == true) { //irda connection is still asleep after a 700 resume return; } if (EvtArgs.CenterTriggerState.Equals(EVTADV_CenterTrigger_EventArgs.STATE.PULLED)) { } else if (EvtArgs.CenterTriggerState.Equals(EVTADV_CenterTrigger_EventArgs.STATE.RELEASED)) { }}
Slide 49 COMPANY CONFIDENTIAL
Add Connection State Handler
Only useful for the IP4 and IP30
void brdr_EventHandlerDeviceConnectState(object sender, EVTADV_DeviceConnectStateEventArgs EvtArgs)
{//your code here//will come back to this later
}
Slide 50 COMPANY CONFIDENTIAL
Tag Event Handler
this.brdr.StartReadingTags(null, "COUNT ANT", BRIReader.TagReportOptions.EVENT);
void brdr_EventHandlerTag(object sender, EVTADV_Tag_EventArgs EvtArgs){ //********************************************************************* // This function process any tag that is returned as an event. // This function is in use when you send a READ with REPORT=EVENT //********************************************************************* bool bStatus = false;
string sTagData = EvtArgs.DataString.ToString();
//do something with tag data}
Slide 51 COMPANY CONFIDENTIAL
Polling For Tags (Report=No)
this.brdr.StartReadingTags(null, "COUNT ANT", BRIReader.TagReportOptions.POLL);
bStatus = brdr.PollTags();
foreach (Tag tt in brdr.Tags){
string sTagID = tt.ToString(); if (tt.TagFields.ItemCount > 0) { foreach (TagField tf in tt.TagFields.FieldArray) {
sTagID += " "; sTagID += tf.ToString();
} } }
Slide 52 COMPANY CONFIDENTIAL
Add GPIO Event Handler
void Form1_EventHandlerGPIO(object sender, EVTADV_GPIO_EventArgs EvtArgs){ //process gpio trigger events if (EvtArgs.TriggerNameString.Equals("ENTER_ON")) { //your code here } else if (EvtArgs.TriggerNameString.Equals("EXIT_ON")) { //your code here }}
Slide 53 COMPANY CONFIDENTIAL
Sleep/Resume management for mobile readersWhen the terminal sleeps and then resumes it can
take some time before the DCE reestablishes a connection to the IP4/IP30.
Monitor for the following events:EVTADV_DeviceConnectStateEventArgs.States.OFFLINEEVTADV_DeviceConnectStateEventArgs.States.RECONNECTINGEVTADV_DeviceConnectStateEventArgs.States.CONNECTED
Slide 54 COMPANY CONFIDENTIAL
Sleep/Resume management on mobile readersvoid brdr_EventHandlerDeviceConnectState(object sender, EVTADV_DeviceConnectStateEventArgs EvtArgs) { switch (EvtArgs.DeviceConnectState) { case EVTADV_DeviceConnectStateEventArgs.States.OFFLINE: bReaderOffLine = true; bReaderConnecting = false; timer3.Enabled = true; //may check to see if unit never comes back online??? break; case EVTADV_DeviceConnectStateEventArgs.States.RECONNECTING: timer3.Enabled = false; bReaderConnecting = true; bReaderOffLine = true;
break; case EVTADV_DeviceConnectStateEventArgs.States.CONNECTED: timer3.Enabled = false; bReaderConnecting = false; bReaderOffLine = false; break; }}
Slide 55 COMPANY CONFIDENTIAL
RF Module Events
All PlatformsEVT:TRIGGER ExampleTrigger GPIO 15EVT:RADIO DUTY_CYCLE TIMELEFT xxxEVT:TAG H112210101122334411221122EVT:THERMAL OVERTEMP <degrees><<EVT:THERMAL NORMAL <degrees>
IF61EVT:RESET
Slide 56 COMPANY CONFIDENTIAL
RF Module Events
Handheld (IM4 based platforms)EVT:BATTERY LOW
Less than 20% charge remainingEVT:BATTERY CHARGED
Greater than 80% charge remainingEVT:BATTERY OPERATIONAL
20%-80% charge remaining
Slide 57 COMPANY CONFIDENTIAL
Add Bar Code Reference
Add reference to project
Slide 58 COMPANY CONFIDENTIAL
Add Bar Code Reference
Add: using Intermec.DataCollection;
Slide 59 COMPANY CONFIDENTIAL
Adding Bar Code Scanning
Create scanning object
//bar code scanner objectprotected BarcodeReader myBCScanner = new BarcodeReader();
Slide 60 COMPANY CONFIDENTIAL
Adding Bar Code Scanning
Add bar code scanner object and start thread so we can capture bar code events.
myBCScanner.BarcodeRead += new
BarcodeReadEventHandler(myBCScanner_BarcodeRead); myBCScanner.ThreadedRead(true); myBCScanner.ScannerEnable = true;
Slide 61 COMPANY CONFIDENTIAL
Adding Bar Code Scanning
Get Bar Code Data
void myBCScanner_BarcodeRead(object sender, BarcodeReadEventArgs bre) { //make sure scanner is off myBCScanner.ScannerOn = false;
//display data iBarCodeCount++; PostMessageToListBox1(iBarCodeCount + ". " + bre.strDataBuffer); label1.Text = "Bar Code Count = " + iBarCodeCount; }
Slide 62 COMPANY CONFIDENTIAL
Thank you.