Couple of months back I started working on a simple RFID application integrated to the Internet to do some interesting gamified use cases.
Well, if you ask what use cases did I have in mind, the easiest analogy that I have is Disney MagicWand.
The videos of magic band usage encouraged me to make a silly version of the application where I can take some data from the swipe of a band and then put it on a mobile notification to do something interesting, something worthwhile, something though provoking.
So I ordered a Chafon RFID reader and a few TK4100 re-programmable RFID tags.
In the first version here, I setup Chafon Reader to work with a Windows 10 laptop, .NET code using a bit of managed code wrapping up over the Chafon dll.
After the setup mentioned here below or in GitHub page, we can download and run this application.
The application scans all the ports, finds out the port on which our reader is available, gets ready to read tag. Once tag is scanned it just displays details in the console.
Steps to follow:
Chafon reference code is available for free download here
TK4100 specs are available here http://www.smartcardchn.com/uploadfile/single/TK4100.pdf
- Download Chafon RFID application for your corresponding LHF Device.
- Install the Prolific driver
- Follow the steps given by Chafon to update old driver in device manager (the pdf is inside the zip downloadable from Chafon site)
- Now use their given application to read and write into the tag
- you may want to make some changes to their code like I did – by adding a few decorators for the managed dll we are going to use
- Copy that dll into your executing code folder so that code can find it.
You may want to download and install Microsoft Visual C++ 2005 Redistributable Package (x86)https://www.microsoft.com/en-in/download/details.aspx?id=3387 to ensure that you are able to develop in a Win 10 x64 machine.
Uses dynamic port finding to ensure that you always get port where your device is connecting to. It could be COM3 or COM4 or COM8 based on what your laptop assigns it.
There are 2-3 sources which has contributed to this code. Please find the first one below where I understood what are the possibilities and how to get it done.
- Blog 1 from Rob and related tools list
- WMI code generator from Microsoft
- The initial code generated from the tool took me to this link which gave me a detailed industrial code snippet which could be reused in my case with a few modifications.
These changes ensured that irrespective of how and where I plugin my Chafon reader it gets picked up correctly as long as my simple string search for “”
In the next parts, I am planning to upload this data to an Azure IoTHub and also configure a simple RAW push notification channel to ensure that you get this as a RAW message in your mobile phone.
Once these two steps are done, then the possibilities are numerous in terms of how you want to play with this.
Be it a simple gamified application or a complex use case.
- for your kid inside your house – make her run into living room, tap it on her chair,
- increase your dogs happiness quotient by fastening it on the collar – (ensure the devices and tags are human and animal test and friendly, do take care of things like choking hazard etc.)
- Asset tracker like Tile App: Tie TK4100 to your keychain, build a custom key box with reader underneath your box [and a connected raspberry pi sending data our (here the program is on a laptop but)], use it to find out which key is taken out when and what time do you return etc.Use this data to manage your activities better or even simply to find whether your key is in the keybox or not.
2 thoughts on “Integrating Chafon RFID tags into your C#/.NET projects”
intresting stuff 👍
I’m interested in the library LFReaderAPI.dll whether it can work for EM4100XXYYY with 128 bits custum settings?