RFID tags

Have you stumbled upon something really cool and new in model railway. Share it with us.
aleopardstail
Posts: 314
Joined: Thu Apr 29, 2021 9:48 pm

Re: RFID tags

Post by aleopardstail »

Experimentationifcating stuffs

progress!

first up, the hardware set up as it stands:

Image http://www.aleopardstail.com/IMG_3010.JPG

this is a MFRC522 board from the bay of Eeeee, basically out of the package, its due to be modified but the bits have yet to arrive, so needs must. some dirty kitchen roll as used to clean paint brushes used to hold it to the bit of 0.5mm plastic painted grey below the track. I will eventually experiment with it rotated 90 degrees and the wires soldered to the other side so it sits more or less totally within the track footprint.

I've been using 10mmx20mm self adhesive RFID tags, on coaches these are simply stuck under the bogie out of sight and work fine. however for locomotives there have been problems. I think this is a mix of the antenna not being strong enough (hence the planned modifications) the tags not be "anti metal" ones and the metal in the locomotive chassis.

there are some more tags on order but a few weeks off, smaller and with a suitable backing. I have also tried some ferrite sheet to go behind the tag thats meant to work but made no difference at all, we live and learn. I then tried adding a bit of a gap thus:

Image http://www.aleopardstail.com/IMG_3011.JPG

this the underside of the J52, the white block is 2mm thick plastic sheet, with a tag stuck below it, currently just wedged into place.

and..

it works!

Image http://www.aleopardstail.com/IDE%20Output%2001.png

the very crude output the top five lines are the tag on the locomotive with the default values, the next five are the coach where 16 bytes have been programmed in. will be waiting to see how well the other tags work and testing more however this is perhaps a good sign that this can work under a locomotive.

further testing to involve passing at higher speeds and trying with other locomotives with these and the other tags. and then to remove the DCC-EX++ stuff from Dingleberry and transplant it here to ensure that DCC track signals don't cause problems. however looking good
Bigmet
Posts: 10333
Joined: Tue Aug 14, 2007 2:19 pm

Re: RFID tags

Post by Bigmet »

Looks like you have functioning proof of concept there. I would want to test for effects from being right next to your wifi hub, using your mobile phone, and other like sources of local broadcast traffic.
aleopardstail
Posts: 314
Joined: Thu Apr 29, 2021 9:48 pm

Re: RFID tags

Post by aleopardstail »

Bigmet wrote: Wed May 08, 2024 10:35 am Looks like you have functioning proof of concept there. I would want to test for effects from being right next to your wifi hub, using your mobile phone, and other like sources of local broadcast traffic.
quite a lot of testing is planned for this, DC & DCC power. there will be a bit of wifi traffic around this as for one thing the ESP8266 its powered by will be using MQTT to report its findings and take commands for tag programming.

it also really needs a length of track longer than the current test track to allow higher speed testing and then ways to minimise "read error" returns, reliability is currently not where it needs to be.

further work is needed to see if sticking power pickups near the tag (e.g. coach lighting) causes issues.

there are however a few good outcomes so far
- this will work with a parallel track, RFID tagged vehicle adjacent to the reader doesn't change the readings, the thing seems to have quite a narrow window above the antenna
- the cheap Ntag213 stickers work well for rolling stock, even if more expensive ones are needed for locomotives to be reliable.

whole point of all this is to test the viability of it before building it into a larger layout.

note, there are lower frequency RFID systems that have greater read ranges, however they also seem to read more slowly, good for the basic ID but less so for the idea of storing data, I adapted the code slightly to allow some very space inefficient but simple data encoding..

two bytes for the loco painted ID, 00-99 then 00-99 stored as integer values, a single ascii character then another number.. e.g. '39', '80', 'J', '52' which reads back nicely, then if its the front or rear tag (using a whole byte to store a 0 or 1!), and a byte for a vehicle type then sub type

get a read back that can tell locomotives and coaches apart and produced a display thus:

Locomotive: 3908 Type: J52
+ Express Passenger Coach (Composite)
+ Express Passenger Coach (Brake Composite)

ok doesn't do anything with it, and its not recognising thats a train, just a series of tags, heck not yet processing the locomotive direction, but its a bit more readable than the hex output when testing.

a lot of testing coming up though, the fact this will "require" playing trains is purely coincidental, as is the way it "needs" a proper layout to test it on
Bigmet
Posts: 10333
Joined: Tue Aug 14, 2007 2:19 pm

Re: RFID tags

Post by Bigmet »

aleopardstail wrote: Wed May 08, 2024 11:05 am ...then if its the front or rear tag... its not recognising thats a train, just a series of tags...
With locos and dedicated brake end vehicles having a 'start/end of train' bit on the tags, that's a nod to traditional railway practise of 'lamps' at both ends of trains! Enables some 'signalman code' to deal with a 'no end of train' input, telling you the section where the absent vehicle(s) must be.
aleopardstail
Posts: 314
Joined: Thu Apr 29, 2021 9:48 pm

Re: RFID tags

Post by aleopardstail »

Bigmet wrote: Thu May 09, 2024 10:13 am
aleopardstail wrote: Wed May 08, 2024 11:05 am ...then if its the front or rear tag... its not recognising thats a train, just a series of tags...
With locos and dedicated brake end vehicles having a 'start/end of train' bit on the tags, that's a nod to traditional railway practise of 'lamps' at both ends of trains! Enables some 'signalman code' to deal with a 'no end of train' input, telling you the section where the absent vehicle(s) must be.
hadn't actually thought about that however yes that could actually work quite well with brake vans and brake coaches having twin tags - had thought about that so that function decoders could be added to control tail end lights but yes actually could also be used to try and spot split trains.

I was planning a slightly more basic system that can count tags and know the length of the various rakes but hadn't actually considered using it for train coupling failure or derailment detection

idea currently is basically four sensors for the whole layout, three covering fiddle yard approaches to allow an automated "signal box" to manage the yard routing and the final one is the station approach which only really needs to split "express passenger", "local passenger" and "local goods" to the correct arrival roads and make the machine that goes Ping go Ping is said road is not clear

there were a few other thoughts about turning lights on and off as things enter/leave but an automated controller can do that anyway.

the layout will actually be quite basic, what I'm after is the lower level to be fully automated so that the operator (muggins) is tasked with turning trains round at the station and trying to send them out at least as fast as they arrive
Bigmet
Posts: 10333
Joined: Tue Aug 14, 2007 2:19 pm

Re: RFID tags

Post by Bigmet »

As always, many ways to skin multiple varieties of cats; and you only want those that are of definite value to your particular operation.

Mine is unseen derailment (any cause: foreign object, coupler or other vehicle mechanism failure, etc.) to avoid dependence on the mk1 earhole picking up the resulting rumbly noises. Current RTR OO traction has advanced to the point that much of it is near unstoppable in these circumstances, and it can make a mighty mess in very lttle time, as it keeps right on moving.
aleopardstail
Posts: 314
Joined: Thu Apr 29, 2021 9:48 pm

Re: RFID tags

Post by aleopardstail »

Interesting, the MRFC522 boards have a pair of inductors, 2.2uH, however they are a rubbish current rating. I've replaced them with ones rated for 1.6A and now tags read, reliably, at 25mm and out to 30mm occasionally.

still have the issues with metal in proximity which needs a bit more thought - e.g. Hornby coaches are fine, tag under the bogie away from the ballast weight, however some dapol wagons have a large weight the length of them and its causing issues even with the tag spaced away from it, though they do work stuck to the couplers at the ends. this is likely going to require some slightly more expensive, anti-metal and smaller tags to be more reliable around metal - though the cheaper ones obviously work with some stock.

good though is the range has increased and so has the reliability of tags not too near metal (it does seem to be metal directly above the tag as well as they fit on locomotives nearer the ends)
aleopardstail
Posts: 314
Joined: Thu Apr 29, 2021 9:48 pm

Re: RFID tags

Post by aleopardstail »

Bit more fiddling, just code changes this time, the ESP8266 now connects to the house WiFi, and has a MQTT capability added, for now it just sends the tag IG to the track/reporter/1 topic which JMRI is picking up nicely.

notable that currently the RFID integration in JMRI is "work in progress", a lot of potential though at present not easy to associate a tag with a locomotive or anything else. And it certainly doesn't have a way to manage two tags on one thing (the ESP8266 code is set to only send the "forward" tag on models with two).

that said having the MQTT stuff set up means its also possible to public more useful information, e.g. a vehicle type etc, code needs adapting so it can describe a train. needs a way to know when its seen the whole thing.

current thinking is to tap into block detection, have the sensor at the start of a block, then make the block longer than the longest train with a short "stop block" at the end approaching the signal to the next block - that bits easy, then the block detection hardware can fling out when a train has hit that stop block and this thing can hear it and go "ahh, the train must have finished, I shall now send out a full train description"

which is likely be be quite simple, locomotive DCC address, a generic train type (likely set as the "worst" of whatever is in it with express passenger at the top and unfitted freight at the bottom) and a train length built from the tag data - thinking being thats what the signal logic needs, JMRI can then show just the locos (with MQTT code it is fed on adjusted to only send the locomotives)

also, the capacitors to fine tune the antenna are now here, along with a non-corridor coach that needs tagging
aleopardstail
Posts: 314
Joined: Thu Apr 29, 2021 9:48 pm

Re: RFID tags

Post by aleopardstail »

overview as it stands

Image http://www.aleopardstail.com/IMG_3015.JPG

an Innocent B12 and a slightly less innocent coach stalking it lurk unaware, the tag reader to the left will catch the tricky blighters

Image http://www.aleopardstail.com/IMG_3016.JPG

caught banged to rights and no mistake!

all the information displayed in the serial output is stored on the RFID tags, this is now also connected via WiFi and passes the tag IDs to JMRI (when its running) using MQTT, it seems JMRI can't do a whole lot with them (like easily associate them with locomotives and coaches) but whatever it gets them. likely code change to just pass loco IDs coming up.

also listens to MQTT for a block occupancy sensor (virtual currently) that also reports via MQTT - when that goes ACTIVE the list of tags passed is processed into a train and reported upon - this will eventually be summarised and also published on MQTT.

basically a somewhat crude but working prototype. have a few more of the tag readers on order so as to have a few for the layout and then a dedicated programmer.

need to finalise the data format to use, have 16 bytes, only using 7 so far, and only really some of the bits of them
Post Reply