At the present time, we don't have an RFID reader in our catalogue because to this date we haven't found an RFID module to be embedded which is compatible with our quality requirements and our price range. But from time to time, we try products that we find on the market to see what they are worth, and whether they can be used with Yoctopuce modules. This is what we did this week with the ID01 UHF RFID reader, sold by DFRobot.
DFRobot products, generally aiming a minimal sale price, don't target the same customers as we do, as we are looking for quality as a priority. But this reader caught our attention because it uses an RS485 interface, seems to use a robust enclosure, and is sold at a price which let us hope that it could be of a good enough quality.
The ID01 UHF RFID reader
Connections
This reader needs a 7V / 2A power supply. It's not usual, but you can find it. For communication, we opted for the RS485 version, betting that if DFRobot had made an RS485 version there was a good possibility for it to be serious. The ID01 documentation uses the A/B terminology for the communication wires, which is unfortunately ambiguous. So FYI, the yellow wire corresponds to TX-/RX-, while the green wire corresponds to TX+/RX+. Here is how to connect the reader to a Yocto-RS485-V2
Connecting the ID01 UHF RFID reader to the Yocto-RS485-V2
Communication with the reader
Communications go through a proprietary binary protocol. By searching the PDF documentation and with some trials and errors, we determined how to make the basic functions of the reader work with a Yocto-RS485-V2. We then wrote a small Python library enabling you to easily use it from a computer. You can find this library on GitHub. We didn't make a PyPI package for this tiny library. Simply copy the ID01.py file in your project. However, this file uses the yoctopuce library to communicate with the Yocto-RS485-V2, so you must install this latter library with PyPI in your project. Here is how to use it:
Initialization
When instantiating the library, you indicate if your RS485 interface is connected by USB or available through the network at a given IP address (via a YoctoHub-Ethernet for example, or on a remote machine with the VirtualHub software).
rfidReader = ID01("usb")
Connection
Connection with the interface is performed when you call the connect() method. The library looks for an RS485 interface with the ID01_RFID logical name.
if status != "OK":
sys.exit(status)
If the RS485 interface is not found, the connect() function returns an explicit message.
Checking the reader version
As we suspect that not all versions of the DFRobot reader work in the same way, we implemented a function enabling us to know the software version running on the reader. The version for which we tested our code calls itself version "06.50".
Reading an RFID tag
The RFID tag identifier provided with the reader corresponds to 12 bytes (6 words of 16 bits). You can obtain them with the requestTagIdentification() method, which returns a list of 6 values between 0 and 65535 included if a tag is detected, an empty list otherwise.
if len(tag) != 0:
print("Tag detected: ", tag)
Changing the identifier of an RFID tag
The tag identifier is in a modifiable data zone of the tag, called "EPC", at address 2. We also implemented the method enabling you to write data on the RFID tag, in particular to modify this identifier.
ID_ADDR = 2
NEW_IDENT = [1,2,3,4,5,6]
status = rfidReader.writeWordsToTag(EPC_BANK, ID_ADDR, NEW_IDENT)
if status != "OK":
print("Error: "+status)
Reading/writing data in the "User" zone
Another read/write data zone is also available, with a varying size depending on the tags. You can write and read in this zone with the following methods (8 words at a time at most):
data = rfidReader.readWordsFromTag(USER_BANK, 0, 8)
for i in range(8):
data[i] += 1
status = rfidReader.writeWordsToTag(USER_BANK, 0, data)
if status != "OK":
print("Error: "+status)
Diagnosis tools
To test the detection of your RFID tags, the reader has a function allowing you to continuously read tags located in the vicinity and to signal with a beep each tag detection. You can use the following methods to control this behavior:
status = rfidReader.setReaderBuzzer(1) # 1=ON, 0=OFF
status = rfidReader.stopContinuousReading()
Complaints
The functions above are designed to work when only one tag at a time is close to the reader. The DFRobot documentation mentions some functions that you can use in "multi-tag" mode, but it is too brief for us to make anything of it in the time-frame we allocated for this project. To be honest, the documentation of this RFID reader, written in English-Chinese, is far from adequate. Field explanations are of the type "Command Code is a command code domain", "Command Data is the parameter domain of command frame", and the documentation doesn't even specify basic things such as the algorithm used for packet checksum. The code example, for Arduino, only shows how to send a few predefined commands, without demonstrating how to read RFID tags. We take heart by thinking that thanks to all this you may want to use our library and our modules rather than breaking your head on this documentation :-)
Conclusion
The Yocto-RS485-V2 enabled us to quickly use this relatively cheap RFID reader, despite its poor documentation. Finally, the solution enables you to write personalized data on the UHF RFID tags at a few tens of centimeters, which is not bad for a product in this price range. But the poor quality of the documentation seriously limits the potential of this reader. It's a shame.
Out of curiosity, when we were almost done with this project, we opened the DFRobot enclosure to see if we could find out which was the RFID module used by DFRobot, in order to look for more documentation. The said module doesn't bear a single inscription, but a quick search on Alibaba enabled us to guess that it's the Jietong JT-2850 module. With this keyword, you can find on GitHub a documentation which is very similar to that provided by DFRobot, but with several extra pages, including the computation method for the checksum and a table of configurable parameters in the EEPROM, among which the parameter enabling you to enable the "multi-tag" mode. So, not only DFRobot simply copy-pasted the documentation of the manufacturer without trying to make it more readable, but important parts were also omitted...