Reading RFID device

etienne_marais

Honorary Master
Joined
Mar 16, 2008
Messages
16,250
Reaction score
19,740
Location
Centurion
So we have a couple of RFID readers (cheapies from China) which Windows detects and polls.

If we bring an RFID card near the new device it beeps and sometimes brings up something random, like open one of the pictures in the picture folder.

The RFID card goes hand in hand with a different RFID reader we have been using for years now, but they are explicitly read, not activated on contact (using our legacy RFID readers).

I am trying to see if I can read from the card using c#, I am not sure if I must deactivate something in Windows first to take control of the new RFID reader, I am also not sure if I am somehow forced to use polling mode (instead of the code below).

The initialization seems to work fine using the vendor and product ids as found in device manager.

Code:
namespace TestUSBRFIDReader
{
    class Program
    {
        public static UsbDeviceFinder MyUsbFinder = new UsbDeviceFinder(65535,53);

        static void Main(string[] args)
        {
            UsbDevice usbd = UsbDevice.OpenUsbDevice(MyUsbFinder);
            bool c = MyUsbFinder.Check(usbd);
            usbd.Open();

            IUsbDevice wholeUSBDevice = usbd as IUsbDevice;

            if (ReferenceEquals(wholeUSBDevice,null))
            {
                wholeUSBDevice.SetConfiguration(1);
                wholeUSBDevice.ClaimInterface(0);
            }

            UsbEndpointReader r = usbd.OpenEndpointReader(ReadEndpointID.Ep01);

            byte[] buff = new byte[1024];

            ErrorCode ec = ErrorCode.None;

            while (ec == ErrorCode.None)
            {
                int bytesRead;
                ec = r.Read(buff, 5000, out bytesRead);

                Console.WriteLine(bytesRead + " bytes read");
                Console.WriteLine(Encoding.Default.GetString(buff, 0, bytesRead));

            }

            usbd.Close();
        }
    }
}

It reads 0 bytes and the light on the device does not flash nor does it beep.

Any ideas ?
 
Questions:
1. What kind of RFID (125kHz/13.56MHz)
I don't know, is there a way to find out ?
2. In the case of 13.56MHz are these ISO14443 or other types of tag
I don't know, is there a way to find out ? The RFID card itself is manufactured by JINGDA in China, I don't know who manufactured the new RFID reader.
3. Did the vendor of said cheap readers provide an API to control the reader?
No.
 
For the benefit of others:
The typical 125kHz readers (which I get a feeling is what we're dealing with here) are basically tags with a serial number. These tags contain a supposedly unique serial number which is transmitted back to the reader whenever its in the field. That's all. The trouble is that some of the readers use a specific protocol to send the retrieved information.. this is called WIEGAND protocol.

If its a smart card, then ISO7816/ISO14443 come into play with a whole sequence of APPLICATION SELECTION and all that jazz. There's MIFARE in that mix too, which is proprietary
 
For the benefit of others:
The typical 125kHz readers (which I get a feeling is what we're dealing with here) are basically tags with a serial number. These tags contain a supposedly unique serial number which is transmitted back to the reader whenever its in the field. That's all. The trouble is that some of the readers use a specific protocol to send the retrieved information.. this is called WIEGAND protocol.

If its a smart card, then ISO7816/ISO14443 come into play with a whole sequence of APPLICATION SELECTION and all that jazz. There's MIFARE in that mix too, which is proprietary
Thanks for that.

So in our legacy system we have cards with multiple fields which can be read and written, even the serial number (unique id) can be written. We were provided with an API called jingda.dll and there is also a mifare.dll included.

I have a feeling with the new reader we will need an API too as it seems to be a customized environment.

Getting these cheap new readers to work is not important. (Though what I mentioned in the PM needs discussing if you are willing).
 
Thanks for that.

So in our legacy system we have cards with multiple fields which can be read and written, even the serial number (unique id) can be written. We were provided with an API called jingda.dll and there is also a mifare.dll included.

I have a feeling with the new reader we will need an API too as it seems to be a customized environment.

Getting these cheap new readers to work is not important. (Though what I mentioned in the PM needs discussing if you are willing).
That gave it away, its a 13.56MHz reader, and the mifare.dll is the driver API for using those cards.
For your use case I advise against this particular frequency. You're in smartcard territory.
 
That gave it away, its a 13.56MHz reader, and the mifare.dll is the driver API for using those cards.
For your use case I advise against this particular frequency. You're in smartcard territory.
Why do you advise against using this frequency ? Lots of these cheap readers support HID mode if you want to only read
 
Why do you advise against using this frequency ? Lots of these cheap readers support HID mode if you want to only read
Depends on the use case, that’s basically NFC. You might not everything to be able to read it.
 
Yes the RF engineering is challenging
I work at 125kHz and track my cats at range. Calculations are easy and I don't need state of the art test equipment which costs a fortune.

What the OP wants is best served either by tags in that frequency or active transponders in the Ku band.

I have the equipment on hand for testing and type approval for contactless chip cards for banking which operate at 13.56MHz. The specifications to get good reliable performance are pretty tough to meet. Said equipment is valued at R125k.. never believed a small suitcase could be worth more than the combined value of both my ageing vehicles.

This is why I advise against using the band for things like this. The whole system was designed for humans placing cards on readers, the card is held stationary (well mostly). Most if not all 13.56MHz tags are smart, that means the first thing they send back when powered is the ATR (answer to reset). That ATR contains similar information to the cheap 125kHz tag in that there is a serial number but a lot more stuff is in there.

Then to go further you need to do anti-collision, application selection and then file access. If the card is moved out of the field or even moved around during this, the risk of data corruption and the card being blocked is dramatic.

We tried this system in the field, at events. It was a failure because of the problem of writing to the cards and people being "too fast" with them, interference out in the open, and a whole bunch of technical aspects that would bore the crap out of you if I had to write it all down here...

At least 40% of the smart cards ended up being useless because the field was disrupted during crypto operations. And this is why your bank card is mainly read only with a bit of cryptographical request taking place. The only thing that can get messed up with your contactless debit/credit card is the the APPLICATION CRYPTOGRAM stages of EMV and then the transaction is declined anyway. No biggie.. no damage to the card or its contents.
 
There seems to be a big surge in UHF popularity. The RF is easier due to shorter wavelength as I understand
 
1. Read range is short and the RF engineering to get even a decent range is not easy
2. ISO and proprietary protocols in the mix which adds to the cost
But far more secure, Wiegand is swiss cheese, Mifare is slightly better. So it depends on the application.
 
There seems to be a big surge in UHF popularity. The RF is easier due to shorter wavelength as I understand
If only that was true...

The OP's application is concerned with tracking work in progress, not security.
Wiegand is not secure, that's the protocol coming out of many of the reader modules I use. The one scanning my cats in and out the house spits out 26 bit Wiegand each time one of them goes in and out the cat flap.

I have spent a couple of years with this, spread out over a decade, I can only get long read ranges from lower frequencies using passive tags

Active tags are what the OP requires, and a good example of that kind of engineering is the e-toll tag. Its VERY directional, and its fast.

As to whether I can do that kind of system design. Of course I can, the fly in the ointment is when people see my invoice for work done.
 
If only that was true...

The OP's application is concerned with tracking work in progress, not security.
Wiegand is not secure, that's the protocol coming out of many of the reader modules I use. The one scanning my cats in and out the house spits out 26 bit Wiegand each time one of them goes in and out the cat flap.

I have spent a couple of years with this, spread out over a decade, I can only get long read ranges from lower frequencies using passive tags

Active tags are what the OP requires, and a good example of that kind of engineering is the e-toll tag. Its VERY directional, and its fast.

As to whether I can do that kind of system design. Of course I can, the fly in the ointment is when people see my invoice for work done.
Nah i think you have it the wrong way round. You have way longer read ranges with UHF
 
If only that was true...

The OP's application is concerned with tracking work in progress, not security.
Wiegand is not secure, that's the protocol coming out of many of the reader modules I use. The one scanning my cats in and out the house spits out 26 bit Wiegand each time one of them goes in and out the cat flap.

I have spent a couple of years with this, spread out over a decade, I can only get long read ranges from lower frequencies using passive tags

Active tags are what the OP requires, and a good example of that kind of engineering is the e-toll tag. Its VERY directional, and its fast.

As to whether I can do that kind of system design. Of course I can, the fly in the ointment is when people see my invoice for work done.
Yet Wiegand and Prox cards are used by 95% of all "security" estates and businesses for "secure" access card entry systems. Yes, I am looking at you, HID Global, and many others like Paxton et al. It's a shocking shame.
 
Nah i think you have it the wrong way round. You have way longer read ranges with UHF
‘Passive’ was the keyword, you can’t read something that isn’t powered.
Dear OP, have you considered using QR codes and QR readers?
The Japanese invented QR to solve this kind of problem.
I can get QR code scanners for cheap as chips, actually getting one to play with soon
That’s just a barcode reader though?
Other factors come into play, such as capacity for data vs error correction, lighting etc. Denso has a nice app for testing purposes.
Also device configuration, if it can run on a virtual COM port instead of as a keyboard wedge, that way it can be a background service without affecting an end-user.
Yet Wiegand and Prox cards are used by 95% of all "security" estates and businesses for "secure" access card entry systems. Yes, I am looking at you, HID Global, and many others like Paxton et al. It's a shocking shame.
They need to upgrade to BLE lol.
In this context it has nothing to do with the card, it’s merely communication.
I could pass the data from a QR code to the controller using a board like below.
obverse_V2_1.jpg
 
Top
Sign up to the MyBroadband newsletter
X