How can I write data on UHF RFID tags?
Asked Answered
S

7

8

I am working on an RFID-based inventory control project, and I want to make a writer through which I can write data on each passive RFID tag. How can I accomplish that?

Shishko answered 3/8, 2013 at 10:2 Comment(0)
R
8

Depending on your budget, it may be much simpler to purchase an RFID reader (which is also a writer) than to make one. There are many great readers on the market with fairly easy to use APIs. Also, most of the major UHF RFID readers work with a common standard called LLRP (Low Level Reader Protocol); so, you can write one set of code and it will work with any reader that supports LLRP. The vast majority of UHF RFID tags work on the gen2 protocol (ISO 18000-6C), so just be sure your reader/writer does as well.

Assuming you are using a gen2 RFID tag, writing to the tag is fairly simple. You simply tell the reader (via a command) to encode the tag. Of course, there are a few considerations to note such as encoding must be in hexadecimal format and there are a few different memory blocks on the tag - EPC, Reserved, TID, and User. (Note: you can't encode to all memory blocks. For more basic information on this topic, see this blog post: http://blog.atlasrfidstore.com/types-of-memory-in-gen-2-uhf-rfid-tags.)

Another thing to consider is how much data you would like to encode to the tag. The two primary memory blocks you'll be using are the EPC (typically 96 bits, but, on some tags, this number can be higher) and User (about 512 bits is standard, but there are some gen2 tags on the market that have much higher User memory).

Ruff answered 23/8, 2013 at 22:37 Comment(0)
H
3

RFID reading and writing is still specific to the technology of the tags, the hardware reader, and to the software device drivers. There is no common Windows API for RFID. However, there is a standard called UnifiedPOS that provides a wrapper around RFID scanners that makes them all behave the same. You write your app once to the UnifiedPOS interface, then you can use any RFID scanners that have a UnifiedPOS compatible Service Object. It's available as OPOS for Windows, and "JavaPOS" for Java. There is also Microsoft's POS for .Net.

When selecting the hardware for the tags and readers, consider if the manufacturer provides compatible service objects. It will make reading and writing much simpler.

Helminthic answered 5/8, 2013 at 16:36 Comment(0)
E
0

RFID is a magnetic tag, so If you've some good knowledge in this subject, you can build it but I think (I don't know exactly the process) that it's pretty hard to do...

However, I know there is an Arduino NFC Shield which can, maybe help you. Something like this: http://www.adafruit.com/products/789

Encompass answered 3/8, 2013 at 10:32 Comment(1)
The OP asked for UHF RFID, which is using electro-magnetic radiation. NFC is based on HF RFID, which is using inductive coupling. The two are completely different in the electronics involved.Injure
A
0

I would recommend using one of these bad boys.Scanfob® Ultra-BB2 GEN2 (UHF) Bluetooth RFID Reader/Writer https://serialio.com/products/rfid/readerwriters/scanfob%C2%AE-ultra-bb2-gen2-uhf-bluetooth-rfid-readerwriter

This will allow you write user data to a tag using Android or Windows with SerialMagic (license for SerialMagic embedded in Scanfob®Ultra-BB2).

This reader is also compatible with Mac OSX & iOS. Only capable of reading tags to cursor location (Bluetooth HID) on iOS.

Arabela answered 10/3, 2014 at 21:48 Comment(0)
D
0

I'm not sure if by "writer" you mean hardware (+ software) or if a software satisfy your needs. @Gp2mv3 mentions NFC, so if your tags fall into the NFC type subset of RFID, the simplest is to grab your phone, download a free NFC writer app and use that.

If you want to write your own software, for Android platform there are a lot of examples, and I assume it's the same for other platforms too. I can imagine even a setup where you connect your phone to your PC through USB and you use it with a hybrid PC + mobile app companion software as a writer.

Dipterocarpaceous answered 9/9, 2016 at 0:55 Comment(0)
I
0
#include <SPI.h>
#include <MFRC522.h>
/*Using Hardware SPI of Arduino */
/*MOSI (11), MISO (12) and SCK (13) are fixed */
/*You can configure SS and RST Pins*/
#define SS_PIN 10  /* Slave Select Pin */
#define RST_PIN 7  /* Reset Pin */
/* Create an instance of MFRC522 */
MFRC522 mfrc522(SS_PIN, RST_PIN);
/* Create an instance of MIFARE_Key */
MFRC522::MIFARE_Key key;          
/* Set the block to which we want to write data */
/* Be aware of Sector Trailer Blocks */
int blockNum = 2;  
/* Create an array of 16 Bytes and fill it with data */
/* This is the actual data which is going to be written into the card */
byte blockData [16] = {"Hi Ozzy"};
/* Create another array to read data from Block */
/* Legthn of buffer should be 2 Bytes more than the size of Block (16 Bytes) */
byte bufferLen = 18;
byte readBlockData[18];
MFRC522::StatusCode status;
void setup() 
{
/* Initialize serial communications with the PC */
  Serial.begin(9600);
/* Initialize SPI bus */
  SPI.begin();
/* Initialize MFRC522 Module */
  mfrc522.PCD_Init();
  Serial.println("Scan a MIFARE 1K Tag to write data...");
}
void loop()
{
/* Prepare the ksy for authentication */
/* All keys are set to FFFFFFFFFFFFh at chip delivery from the factory */
for (byte i = 0; i < 6; i++)
  {
    key.keyByte[i] = 0xFF;
  }
/* Look for new cards */
/* Reset the loop if no new card is present on RC522 Reader */
if ( ! mfrc522.PICC_IsNewCardPresent())
  {
return;
  }
/* Select one of the cards */
if ( ! mfrc522.PICC_ReadCardSerial()) 
  {
return;
  }
  Serial.print("\n");
  Serial.println("**Card Detected**");
/* Print UID of the Card */
  Serial.print(F("Card UID:"));
for (byte i = 0; i < mfrc522.uid.size; i++)
  {
    Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(mfrc522.uid.uidByte[i], HEX);
  }
  Serial.print("\n");
/* Print type of card (for example, MIFARE 1K) */
  Serial.print(F("PICC type: "));
  MFRC522::PICC_Type piccType = mfrc522.PICC_GetType(mfrc522.uid.sak);
  Serial.println(mfrc522.PICC_GetTypeName(piccType));
/* Call 'WriteDataToBlock' function, which will write data to the block */
   Serial.print("\n");
   Serial.println("Writing to Data Block...");
WriteDataToBlock(blockNum, blockData);
/* Read data from the same block */
   Serial.print("\n");
   Serial.println("Reading from Data Block...");
ReadDataFromBlock(blockNum, readBlockData);
/* If you want to print the full memory dump, uncomment the next line */
//mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
/* Print the data read from block */
   Serial.print("\n");
   Serial.print("Data in Block:");
   Serial.print(blockNum);
   Serial.print(" --> ");
for (int j=0 ; j<16 ; j++)
   {
     Serial.write(readBlockData[j]);
   }
   Serial.print("\n");
}
void WriteDataToBlock(int blockNum, byte blockData[]) 
{
/* Authenticating the desired data block for write access using Key A */
  status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, blockNum, &key, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK)
  {
    Serial.print("Authentication failed for Write: ");
    Serial.println(mfrc522.GetStatusCodeName(status));
return;
  }
else
  {
    Serial.println("Authentication success");
  }
/* Write data to the block */
  status = mfrc522.MIFARE_Write(blockNum, blockData, 16);
if (status != MFRC522::STATUS_OK)
  {
    Serial.print("Writing to Block failed: ");
    Serial.println(mfrc522.GetStatusCodeName(status));
return;
  }
else
  {
    Serial.println("Data was written into Block successfully");
  }
}
void ReadDataFromBlock(int blockNum, byte readBlockData[]) 
{
/* Authenticating the desired data block for Read access using Key A */
  byte status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, blockNum, &key, &(mfrc522.uid));
if (status != MFRC522::STATUS_OK)
  {
     Serial.print("Authentication failed for Read: ");
     Serial.println(mfrc522.GetStatusCodeName(status));
return;
  }
else
  {
    Serial.println("Authentication success");
  }
/* Reading data from the Block */
  status = mfrc522.MIFARE_Read(blockNum, readBlockData, &bufferLen);
if (status != MFRC522::STATUS_OK)
  {
    Serial.print("Reading failed: ");
    Serial.println(mfrc522.GetStatusCodeName(status));
return;
  }
else
  {
    Serial.println("Block was read successfully");  
  }
}
Ichthyo answered 2/4, 2023 at 22:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.