Python script to get status of an RFID reader

This is the RFID reader that I am using for a college project. It can be quite labour intensive to make a lot of readings especially if the power is varied over time. The reader is connected to a computer via an ethernet cable. It has a fixed ip address that displays a webpage when typed into a browser.

RFID Reader
RFID Reader

Here is the homepage that is displayed in the browser. Clicking on demo brings up preprepared page that can find tags, set transmit power level, communication protocol for the tags (there are different types for different tags) and a q-value(this depends on how many tags will be read at once)

Intelleflex homepage screenshot
Intelleflex homepage screenshot

This is the demo page. All of the wanted parameters are entered in by hand. The page then puts all of these commands into an XML file and sends them to the reader for execution. The reader returns its results in an XML file, this is parsed an diplayed in a table on the webpage. It displays the EPC(Electronic Product Code) of any tags found as well as the power of the signal received from that tag amongst some other things.

Intelleflex Page
Intelleflex Page

Due to the nature of the project, I’m going to be fiddling with the settings a lot, changing the sensitivity, reader speed, power. As you can probably imagine, this takes forever when entering in the values by hand. There is a data sheet available with the device that says it does accept XML commands sent over TCP/IP. Presumably this is how the reader is meant to be used for any serious work as opposed to just using demo mode all the time. I tried out a very simple python script with the TCP/IP code taken straight from wikipedia, then I plugged in the right IP and port number. There are a list of XML commands in the data sheet so I picked the most basic one :getReaderStatus/. It was sent and I got a response! This is probably the most basic thing ever, but I thought it was pretty cool, check out the python script and output below.

import socket

TCP_IP = '192.168.0.113'
TCP_PORT = 80
BUFFER_SIZE = 1024
MESSAGE ="<getReaderStatus/>";

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP,TCP_PORT))
s.send(MESSAGE)

data = s.recv(BUFFER_SIZE)
s.close()

print "received data: ", data

Terminal Output:

Terminal output
Terminal output

The received data is in XML format so figuring out how to parse that will be the next step. This opens up the possibility for interesting experiments that would not have otherwise been possible. Could use the python plotting library matplotlib to get values for different power levels and graph them. Very cool.

One thought on “Python script to get status of an RFID reader

Leave a Reply to samvithinfocom Cancel reply

%d bloggers like this: