What is RFID

An introduction to RFID and how it works.

What is RFID?

RFID stands for Radio Frequency IDentification, and is a technology you will probably be familiar with using, even if you don't realise it.
Contactless debit/credit cards use RFID, as do library systems where you just put your books on a platform, and the titles are read out.  "Chipped" pets use RFID, and it is also used for keyless entry, where you bring your keycard near to a reader, and the door unlocks.  It is used for stock control, and even for protecting higher value items from theft from shops .  All smart phones incorporate RFID, and this is why you can wave your phone over a supermarket checkout reader, and your bank account will be debited.  It is, of course, also used on public transport, such as Oyster cards (in London), and either pre-payment schemes or pay-as-you-go in many other places.
RFID is also known as NFC (Near Field Communication), although there are some subtle differences between the two, they are interchangeable terms.
RFID differs from other short distance radio communication methods, in that it does not need a battery or other power source at one end to make it work.  Other short distance systems, such as Bluetooth, require power at both ends - and this is why you need to charge up you wireless ear buds, or your wireless mouse and keyboard.  You never need to charge up your credit/debit card (except, of course, with money!).

Parts of a RFID system

A RFID system comprises two major parts - the Reader and the Tag.
For example, in the case of contactless payment, the reader is in the supermarket payment device, and the tag is in your debit card.  The reader has a loop aerial attached to it, which is basically like some windings of a transformer.  The tag in your debit card also has a loop aerial embedded in the plastic, which is a few loops of conductive material, which acts as an aerial.  Note that the tag in a debit card is completely separate from the set of conductive pads which enable you to do transactions in an ATM, or by putting your card into the supermarket payment device.
The reader is an active device - it has power attached to it.  The tag is a passive device - there is no battery or other power source in your debit card.
The reader transmits electro-magnetic waves, in the case of a debit card reader, at 13.56MHz.  When your debit card comes within a short distance (maybe 1 cm) of the reader, there is enough power picked up in the loop aerial of the debit card to power up the tag - this is akin to a transformer, where the primary and secondary coils are coupled magnetically - except here there is an air-gap, rather a magnetic core.
The reader can then send, by modulating the 13.56MHz carrier, a message to the tag.  The tag can then transmit a message back to the reader, on a different carrier frequency.  As long as the tag and reader are within range of one another, then there can be an exchange of messages.
In the case of a debit card, your bank details are sent back to the reader, and then the reader can log these, along with the amount of your supermarket shopping basket.  At some point in the future, the supermarket payment device will contact your bank, and request a transfer of money out of your account into the supermarket's account.
The data sent between the reader and the tag is (or should be) encrypted - this is to try and stop people "cloning" your card.
The same sort of transaction happens when taking books out of the library - the books are placed on the reader, and the tag is usually a paper thin insert stuck into the cover of the book.  The tag has memory in it - in the case of the debit card, the bank programs in your bank details.  In the case of the library book, the library can program in the title, the author, and maybe the ISBN number, and possibly a library inventory number.  As you are checking out the books, the reader could program into the tag the date the book needs to be returned by.  This means that when you return the book, and place it into the reader to register the return, the reader can locally work out whether the book is overdue, and therefore overdue charges may apply.  The library system also uses another feature of RFID - anti-collision.  If you place several books in the reader, then the reader can communicate with each of them in turn - the messages from the tags do not get muddled up.  At least, that is the theory, but it doesn't always work perfectly in practice, as anyone using a library check-out will know!

RFID in Model Railways

The idea of using RFID in model railways has been around since at least 2009 - see the History page in the Technology section for more details.
The basic idea is that the rolling stock contains a passive RFID tag, and the reader is placed under the track, so each time a piece of rolling stock passes over the reader, the reader will register the presence of the rolling stock.  The railway control system can then either log which piece of rolling stock passes (which might be used for sorting wagons), or just that rolling stock is passing (used for block occupancy for example).
There are various requirements for model railways which do not occur in other uses.
1] The tag and the aerial can be placed, by design in the correct x position with respect to one another, the tag is on the rolling stock, and the aerial is beneath the track, and this means it is guaranteed that the tag will pass over the aerial (although care must be taken with the placement of the tag on long wagons, or carriages/locos with bogies).  This is a great advantage compared, say, to waving a bank card over a checkout reader.
2] The tag is generally a known distance above the aerial, as the rolling stock is on rails, and doesn't fly!  This is almost an on/off situation, if the tag works at the correct reading distance it will continue to work - neither the aerial power, nor the tag characteristics will degrade with time.
3] The tag needs to be small - this is a big disadvantage, as generally the larger the area of the tag and reader aerial, the greater the read distance (up to a point).  4] The reader aerial needs to be small - if it is too large, then the read area will increase too much in the y direction, and rolling stock on an adjacent track could be registered by mistake.
5] The read needs to be fast, otherwise fast moving rolling stock will be missed by the reader.  This is a major requirement, and influences which system can be used.
6] The tags need to be cost effective. If tags are to be put on a large number of pieces of rolling stock, then the cost must not become prohibitive.
7] There need to be multiple readers in a system, and they must not interfere.  This is a unique requirement - there is only one reader per supermarket checkout line, and only one reader per library checkout station.
8] The whole system must be cost effective, including multiple readers and a data concentrator.
9] Data must be output directly in a form that railway control systems can use.
10] All parts of the system should be able to be installed by the average modeller.
This is not an exhaustive list of requirements, but it illustrates the many points that need to be taken into account when designing a system.


In contactless credit/debit card transactions, one of the most important aspects is security.  You don't want your bank details being exposed, so the data between the reader and tag has several stages, so that the data can be encrypted.  With library systems, that is not an issue, but there may be much more data to be exchanged, such as name of book, author, ISBN etc.  All of these take time - the data rate between the tag and the card is limited, but in the bank and library case this does not matter, if it take a second or two to complete the transaction, then that is fine. 
In model railway systems, speed is of the essence. In the first systems, the RFID system was being used to sort wagons, and the trains were therefore running very slowly, so the 125KHz system (which was originally for "chipping" pets), worked quite well.  The data that needs to be read out of the chip is the Unique Identification Number (UID), which is usually 56 bits long - a 8 bit RFID header, a 8 bit manufacturer code, and a 40 bit unique number.  The unique number gives over a trillion (1,000,000,000,000) different number, hence it is truly unique.  This is the number that is reported through the MERG CBus DDES, and hence to JMRI.
Just asking the tag for it's UID is also the quickest transaction that can take place, and hence this transaction is the best one to use for speed.
Working out all the numbers, and the maths behind this is explained in the Maths section of theses Technology pages, meant that the original 125kHz system was no way near fast enough.  Therefore, the 13.56MHz system was chosen.  In simple terms, with 13.56MHz, using a 25mm long aerial, allows a read speed of 90 times a second, and a guaranteed error-free read on HO/OO at a scale speed of 125mph (200kph). 
With smaller gauges than HO/OO, things become a bit easier, as the scale speed of 125mph is slower in real terms (125mph is 66cm/sec in HO/OO, and about 33cm/second in N-gauge).
For larger gauges, such as O or G, a scale speed of 125mph is obviously faster in real terms, so a longer aerial is required.  This is a good reason for separating the aerial from the reader electronics.
Theoretically, even a Japanese bullet train travelling at a scale speed of 300mph could be detected, using an aerial only 75mm long - but I doubt whether models are available that travel at that high scale speed!.