Location detection using RFID

Michael

Registered
26 Jan 2010
139
16
Best answers
0
Country flag
On another recent thread, someone said they hadn't heard of RFID being used in the garden. I use it, so I thought I would share what I have done.

I have a bespoke system (both hardware and software) so it's not DCC and might not be very relevant to other people but it proves the technology works.

I use ESP8266s in my locos and an ESP32 in a handheld controller. They all connect to a standard wireless network and messages are sent between devices using the MQTT protocol. All devices can send and receive messages so the handheld controller, apart from controlling my locos, can receive messages (like speed and battery voltage) from them.

I use a separate wagon for location rather than integrate it into all my locos. It comprises an ESP8266 based Wemos D1 mini pro and an RDM630 125KHz RFID reader from Seeed (not RDM6300). The coil fits under the wagon. I use the credit card sized tags and they fit under my Peco 45mm code 250 track, and are then covered in ballast. The smaller tags can also be used if fitted between the sleepers. There are 10 on my 160 foot layout.

P1000501.jpg

rfid2.jpg

When the wagon goes over the card it picks up the card number and sends it as an MQTT message. The loco receives this message and thus knows where it is. There is a schedule within the program which, when in auto mode, allows the loco speed, direction, acceleration/de-acceleration and stop time (if applicable) to be set for each location.

In summer I spend a lot of time in the garden (gardening, relaxing, eating, drinking) so having a train going round, changing speed, stopping at stations, makes it more interesting than just going round and round.

Michael
 

Attachments

  • rfid.jpg
    rfid.jpg
    40.1 KB · Views: 0
Last edited:
  • Like
Reactions: 2 users

idlemarvel

Neither idle nor a marvel
13 Jul 2015
3,136
801
Ascot
Country
Mars
Best answers
0
Country flag
Thanks Michael, as I was that "someone" I'm especially grateful for you taking to trouble to write this up. I guess the credit cards tags are fairly waterproof although maybe not UV resistant plastic?
 

Michael

Registered
26 Jan 2010
139
16
Best answers
0
Country flag
Apologies Dave (idlemarvel) , for not using your name. They are waterproof, specified to -40° and made of PVC. Not sure about UV but they only cost 30p each so no great expense to replace them occasionally. They have only been installed since last summer so time will tell.

Michael
 
  • Like
Reactions: 1 user

GAP

G Scale Trains, HO Trains, 1:1 Sugar Cane trains
14 Jun 2011
4,059
944
Bundaberg Queensland, Australia
Country
Australia
ringbalin-light-railway.blogspot.com
Best answers
0
Country flag
This has now got my attention as well.
As a retirement project I am looking for a detection method that I can use to transfer the location of locos on my layout so that the location can be displayed on a screen.
For the display I am considering JMRI or trying to write a simple python program (when I learn python) that would run on a Raspberry Pi.
 

idlemarvel

Neither idle nor a marvel
13 Jul 2015
3,136
801
Ascot
Country
Mars
Best answers
0
Country flag
GAP GAP Rocrail runs on a Raspberry Pi (as well as Windows or Mac) and supports RFID including RC522 or ID-12 sensors
 

idlemarvel

Neither idle nor a marvel
13 Jul 2015
3,136
801
Ascot
Country
Mars
Best answers
0
Country flag
Apologies Dave (idlemarvel) , for not using your name. They are waterproof, specified to -40° and made of PVC. Not sure about UV but they only cost 30p each so no great expense to replace them occasionally. They have only been installed since last summer so time will tell.

Michael
It's an interesting approach to have the readers mobile and the tags static. Most RFID implementations for model railways I have seen use static readers and tags mounted in the locos or rolling stock, but if you have to install things outside your approach makes sense.
 

Michael

Registered
26 Jan 2010
139
16
Best answers
0
Country flag
Rocrail runs on a Raspberry Pi (as well as Windows or Mac) and supports RFID including RC522 or ID-12 sensors


The RC522 operates at 13.56 MHz and uses the Mifare type cards. More secure versions of this card are found in banking cards and the concessionary bus pass scheme. Having spent the latter part of my working life using these cards, this was my first choice. However, there were a few problems, in particular the distance required between the card and the reader for a moving train. This might be OK for smaller scale indoor layouts but from my tests, not for large scale. I switched to the 125Khz system which has a greater reading range for the size of aerial you can fit under a wagon.

rc522.jpg


It's an interesting approach to have the readers mobile and the tags static. Most RFID implementations for model railways I have seen use static readers and tags mounted in the locos or rolling stock, but if you have to install things outside your approach makes sense.

Yes, fitting a tag in every item of stock is another option but waterproofing and providing power for a lot of readers spreadout over a large outdoor layout would be impractical.
 
  • Like
Reactions: 1 user

Thickmike

Registered
14 Aug 2016
5
1
73
Northamptonshire
Best answers
0
Hi. This is an interesting thread - thank you to all. Michael, I wonder if you are transferring an industry approach to garden rail - is it possible to only read tags on entering and exiting locations where you need to know the train is there - not everywhere - this should help minimise the number of readers. Also, I would question whether you need tags on every vehicle - as long as you have a rule that any motive power, whether locomotive, railcar or motorised brake van has a tag, that's all you need - every train has one and it would be easy to temporarily attach a tag to any visiting motive power.

However, this is an armchair view of the world - I've not tried doing it!

Thanks again
 

kevinhammond

Registered
9 Apr 2016
21
7
61
Scotland
Best answers
0
Thanks Michael, as I was that "someone" I'm especially grateful for you taking to trouble to write this up. I guess the credit cards tags are fairly waterproof although maybe not UV resistant plastic?

I'd have thought you could just coat the cards to provide UV/additional water resistance if that was an issue. Shouldn't reduce the radio range.
As the OP says, it's not obviously worth the cost, but could save your time in replacing/reprogramming the cards.

Interesting idea to keep the cards static and move the readers.
 

Michael

Registered
26 Jan 2010
139
16
Best answers
0
Country flag
Many thanks for the replies and likes.

Also, I would question whether you need tags on every vehicle

The tags are on the track, I need one reader per running train.

I'd have thought you could just coat the cards to provide UV/additional water resistance if that was an issue. Shouldn't reduce the radio range.
As the OP says, it's not obviously worth the cost, but could save your time in replacing/reprogramming the cards.

I don't think this will be an issue. The cards are read only, I use the last two digits of the serial number.


I have a correction to make. I've just built the electronics into a 2nd wagon so I can run two trains at the same time in auto mode. I couldn't find the original reader module I am currently using (RDM630) so I bought what I thought was a modern equivalent, an RDM6300. To my cost I have found that this is a cheap inferior clone. In particular, it has a much reduced operating range and doesn't work on a moving train.

The correct one, RDM630 from Seeed, arrived yesterday and works well like the original. Dealers on Ebay are also selling the inferior product as an RDM630.

I have updated the opening post. Apologies for the confusion.

PS I still prefer to use a good old fashioned handheld controller for the majority of the time.
 

Michael

Registered
26 Jan 2010
139
16
Best answers
0
Country flag
An update.

I now use the ID-12LA or ID-20LA RFID readers as they have an integral aerial and have a much greater range than the other types. They are now fitted to my LGB 24140 loco and Accucraft Baguley Diesel and 2 wagons which are used with my other locos.

lgb_kjf.JPG
accucraft_wagon.jpg

I've just added control for my points so the locos can now control the points.

Here's my initial test for the Baguley with one point. The LGB loco in the foreground is also in automatic mode.