When I started playing for RFID tags/readers I was very confused with how the data was encoded and transmitted from the tags to the reader.
The first thing one must realize is that the tag does not actually transmitter anything. Passive tags (tags that are powered from the reader) gets energized by the 125Khz magnetic wave generated by the RFID reader. All that the tag then does is open/close its coils. This causes interface on the reader coil, which is called back scatter. The reader processes this back scatter and decode the “transmitted” data. Up to this point the only encoding method is Amplitude modulation, the tag changes the amplitude of the reader’s magnetic field.
It is at this point where things starts to get confusing. The data is transmitted using to techniques. First it gets encoded (Normally Manchester or Bi-Phase), and then the encoded data stream gets modulated on a RF level. The modulation is either ASK, FSK, or PSK.
Based on my experience, EM4100 tags are encoded using either ASK or PSK, and HID encoded using FSK.
For a reader to correctly read a tag the following must be done:
Generate a constant 125KHz modulating frequency to the reader coil
- The microprocessor must wait for a transition from low to high on its signal input pin
- Start to capture the duration of X amount of high and low pulses (The amount should be more that twice the encoded data packet length)
- The pulse lengths must then be decoded to a multibit data stream, based on the modulation method used (pulse duration, and if it is a high or low).
- The multibit data stream must then be decoded to a single bit data stream using Manchester or bi-phase decoding.
- Search for the appropriate start header which is different for the different tag types (e.g. 9 ones: 111111111 for EM4100, 15 ones: 111111111111111 for HID and 10 zeros: 0000000000 for FDX-B)
- Extract the correct amount of bits after the header and separate all the required control/ parity bits from the data bits
- Convert the bits into numbers using bit shifting loops.
The chip manufacturer Microchip has a very good design document with sample code, designs and explanations, below is FSK/PSK examples extracted from their guide .