StaRFIshrail Difference

An introduction to the difference between StaRFIshrail and other systems,
including design goals.


A lot of hobbyists have spent much time trying to make RFID work, and many of their attempts have been successful. For the most part, hobbyists have been trying to adapt existing components, such as the IDLA12/20 or RC522. I looked at many sources, and soon realised that even the limited number of design goals I had identified could not be satisfied, and certainly not at a reasonable cost, and with good reliability. Single RFID points with slow moving trains can certainly be implemented, but I wanted to use RFID both for train identification and block detection, with the possibility of speed and direction detection as well.  Rather than having a number of different detectors, I wanted to try and roll all detectors into one system.  Although systems using RC522s with a few detectors and small computers such as Arduino will probably turn out to be cheaper, I wanted to make a system for multiple RFID points, and the StaRFIshrail system will almost certainly be cheaper, and certainly be much easier, than using RC522s and Arduinos.

Design Goals

There were many design goals identified to create a useful RFID system for model railways.  Some of these are based on limitations of other systems, and some are general "wants", and some "if only's".
1] High reliability - I wanted a system which did not need to be "tweeked", and would work faultlessly
2] Easy installation by the average modeller, and which would always work if installed correctly.
3] Able to be used on both HO/OO and N gauges, with the possibility of going up to O gauge, and down to Z gauge.
4] Multiple RFID points available, with expandability to encompass even very large layouts.
5] Interfacing to common computer control standards (JMRI, RocRail, CBus).
6] Value for money
7] Cheap tags
8] Installation of aerials under baseboard, so retrofitting on an existing layout would be as easy as possible.
9] Easy connection, as so many problems with electronics come down to connection problems.
10] Must be able to work with fast moving trains, ideally up to maximum allowable scale speed (target 125mph, 200kph).
11] Must be able to distinguish detection properly on adjacent tracks
12] Ability to detect in and out points for RFID readers.
13] Tags must be suitable for attaching to rolling stock easily.
14] Use electronic components with a guaranteed availability.
This was quite a list, and I soon realised that taking existing blocks, such as Arduino, RC522s etc could never satisfy all my goals, so the only way was to design a system from scratch.

Aerials and Speed

I wanted the aerials to be easily mounted, ideally with the aerials being mounted UNDER the baseboard, and I found flat aerials from Molex.  These really are thin, about 0.1mm, and are available in a variety of sizes - the smallest being 25mm by 15mm.  This was the ideal size, as they would fit either across or inline on both HO/OO and N gauge.  HO/OO gauge normally has tracks spaced at 67mm or so, whilst N gauge is half this, around 33mm (these are differences between Rad1 and Rad2 curves, or the normal distance for back-to-back points).  I had decided on 13.56MHz ISO15693 for the RFID standard, mainly because there were some very small flat tags available in 3mm square and 8mm square, the tag chips were easily available if I wanted to try and make my own tags, and the reader chips were about the cheapest available.  I managed to get 90 reads a second from the reader chip, which coupled with the size of the aerial, meant I could pick up trains travelling at 125mph HO/OO scale speed with accuracy.  The 8mm tags gave a read distance of around 30mm+, which means for HO/OO I could mount the aerials under a 9mm baseboard. The 3mm tags only gave a read distance of 15mm - but for N gauge the aerials could be mounted under the track. This was looking promising!.
Also, the presence of the track between the aerial and the reader did not make any difference, whether the track was carrying dc or DCC signals.
The RF signal was really tightly controlled, so two aerials and readers on adjacent tracks did not interfere, even on N gauge - and for HO/OO gauge you could even put a reader on the slip between back-to-back points, and trains going straight through the points on either track were not detected.
For O gauge, a larger aerial was needed, as otherwise at full speed a tag could be missed - an O gauge train travelling at 200kph scale speed covers 129cm in one second, equivalent to 14mm for every attempted read.  Using larger 45mm by 34mm aerials meant that the read would always be picked up.

Hub and connections

One of the design goals was to be able to use multiple RFID points, and with easy and reliable connection.  This would require a "hub", or central point, which could connect to many RFID readers.  The reader chips, which use I2C as an interface standard, could be set to one of 4 addresses, so it was a simple decision to have up to 4 readers on a single daisy-chained cable.  8 cables out of a hub seemed reasonable, so the hub could handle up to 32 readers simultaneously.  To make wiring easier, power and signals would be better on a single cable, as this would reduce the number of connections required.  This led on to using RJ45 Ethernet-type cables as the preferred interconnect , as they are cheap, easily available, locking, and, as a bonus, come in a variety of colours.
Interfaces were the next consideration, and I decided on three. which would act simultaneously but independently.  These interfaces had to be able to handle the data coming not just from a single hub, but from multiple hubs if they were connected together.  Ethernet was the natural standard to choose, as this is a universal standard for connection to computers, and can be used wired or wirelessly.  USB was also an easy decision - serial communication is a tried and tested interface.  Looking at the railway specific interfaces, there were three to choose from - DCC, Loconet and CBus.  The amount of data potentially coming from a hub (or a few hubs) could potentially overwhelm both DCC and Loconet.  DCC runs at 9K6 baud, and Loconet at 16.6k baud - CBus runs at 125k baud, and therefore will handle a lot more data, including data between hubs - so in a multiple hub set up, only one Ethernet port need be used on the control computer.  Using CBus also meant that in a computer-less system, the MERG modes SLiM and FLiM could be used.


Initially, I made just a single reader, which would be daisy chained to other readers.  As I wanted the hub to provide the power through the cable, each reader needed an on-board switched mode power supply, to convert the 12V or so coming down the cable to a nicely regulated 5V for the reader to use.  Between the flat aerials and the reader chip there has to be a matching network - the RF output of the chip can not exceed 5V (or 10V in antiphase), and this is simply not enough voltage and power to transmit the signal to a RFID tag 30mm or more away.  Therefore, there is a matching network on the board, which means that you get about 70V across the aerial.  However, the wires going to the aerial are part of this matching network, and consequently the aerial and the board must be matched for best performance.  I ended up with having three lengths of aerial wire, and different matching networks on the board.  You can therefore choose how long the aerial wire will be, safe in the knowledge that the performance will be the same.  It then occured to me that in general RFID points would be grouped, for instance in fiddle yards and stations, so I made a dual reader and a quad reader.  The quad reader is the most cost effective, as there is only one switched mode power supply, the board area is much smaller than 4 single readers, and there are fewer connectors and switches.


Tags were an area of concern.  Most tags are way too big - though the original "grain of rice" tag was small, and of the right sort of size for modelling. This is because the bulk of the market is not concerned with small tags - debit cards, keyless entry, ticketing, library books are all very much larger than the space available on a HO/OO (or even worse) N-gauge piece of rolling stock.  One of the deal-breakers that meant I chose ISO15693 standard was that there were some small tags (8mm square), and very small tags (3mm square), easily available through electronic distribution channels.  In addition, the actual tag chips, which measure a miniscule 1.5mm by 1mm were also available, so I would have the option of making my own tags, if I felt brave enough.
Having got the rest of the system working, I bit the bullet, and designed my own tags.  These consist of the tag chip, a matching capacitor, and a loop of conducting track, which forms an inductor.  However, this circuit is almost impossible to simulate, so the only way is to try it with different geometries, and see which one works (if any!).  I found I could get boards made on a very thin FR4 substrate, just 0.1mm thick, and I then laid out a whole load of different geometries on a board, hoping that at least a few would work.  Fortunately, most of them did, and I found a couple of sizes which would give a read distance of around 31mm, and were a more useful shape than the square Murata tags.  The best compromise was a 6mm by 9mm tag, which could be fitted between the wheels of a N-gauge loco, yet still gave a 30mm+ read distance.  This would mean that N-gauge could be accomplished with aerials under the baseboard, and this tag could be used for N, OO/HO and O gauges.

Why no kits?

This is easy - availability of components, and reliability.  A lot of components, especially chips, are now only available in surface mount, and with pins that are very close together.  The reader chip, and the two main chips on the hub, the processor and the Xilinx, have pins that are just 0.5mm apart.  Although these can be assembled at home, you really need specialist equipment - a high power binocular microscope to be able to see what you are doing, and a very fine tip on a temperature controlled soldering, and these items are beyond the means of an average modeller.  You also need a lot of experience, otherwise you can end up with a mess than can't be corrected.  You also need a very steady hand!. Also, the smaller the components, the smaller the pcb, which can be quite an expensive part of the overall build.
Every solder joint is also a potential of failure, and they all need to be good for reliability.  Another issue is getting the components in the right place, many surface mount components are not marked, especially capacitors.  So, getting exactly the right amount of solder on each pad by using a solder screen, placing components by machine for no errors, and then soldering under very carefully controlled temperature profiles, give boards that work first time, and have long term reliability.
The hobbyist still has plenty to do in the StaRFIshrail system - planning, mounting the boards, running the cabling, placing the aerials, mounting the tags, and making the whole system work with your railway.


Now, practically all the design goals were met.  Although MERG(you have to be a member to buy the kits) and CGA (for RocRail) issue kits for hobbyists to build at home, the technology has now moved on, and surface mount components were the only way to go.  Besides which, the major components in the system, the reader chips, the Xilinx FPGA and the processor were only available in surface mount.  Therefore, the whole of the system would be built with surface mount components for reliability, with through hole components for the connectors, for reliability and robustness.  This method reduces the board size, and so the cost, but dramatically increases the reliability, as machine-placed components mean no errors.  The boards were designed to be just two layer, with no components on the reverse side.  Most importantly, there are no user set-ups, apart from controls for the interface and addressing.

Name and Logo

Naming a product or a business is always problemmatic.  The name needs to be memorable, ideally have some some relationship to the products, and also have an available web address.  I initially tried to find a word with RFID as a letter combination, but the only word in English with this combination is "perfidy" * and it's derivatives, - not exactly the impression I wanted to give!
I then tried the letter combination of RFI, and there were hundreds of words, but as soon I saw starfish, I knew this was the one.  Combining this with rail (which is common to railway and railroad, depending on where you are in the world) I had the name starfishrail (pronounced star fish rail) - which was sufficiently different such that the web addresses and were available, and which should also be memorable and easy to pronounce, even for non native English language speakers.
The logo naturally followed - a starfish and a cross section of a rail.
The capitalisation was done to emphasise the RFI part, hence StaRFIshrail.

*Perfidy - Disloyalty, Betrayal, Treason - Cambridge English Dictionary.

Why not RC522?

Using RC522 modules might seem a natural choice.  I have seen prices as low as £1.50 for a RC522 reader card, through generally they are more likely to be in the £3-£5 region.  These modules come direct from China, come with a key tag, and the major use if for keyless entry.  They have their own pcb aerial, and the chip used is a NXP MFRC522.  Note the price of the module, and then note that the cheapest price I can buy this particular chip from electronic suppliers in Europe or America is a few pence under £4 - even in quantities of 1000!.  The Chinese, because of volume production (in the millions) can easily undercut anything made in the West.  However, you pay a low price, and get what you get - which is fine if you are making a keyless entry system with an Arduino.
A lot of effort has been made by MERG members trying to make a cheap system based round the RC522 to work, and to a certain extent they have been successful.  However, I wanted to make a system specifically for model railways, where I was in control of all aspects of the system, and therefore it could be made exactly to specification.  I wanted an external aerial, and I also wanted to be able to match that aerial to the reader chip for the very best performance, and this alone dictated that bulk standard RC522 readers were not the way to go.
The reason for going to ISO15693,  rather than ISO14443, which is what the RC522 uses, was based on available tags and tag chips, and cost of reader chips.  Tags had to be available through normal electronic distribution channels in low volumes, and had to be right size and a reasonable price.  3mm square and 8mm square tags were available, as were the ISO15693 tag chips - this meant that I could make my own tags if required, matching then to the size required for model railways.