Location detection using RFID

M

Michael

Registered
26 Jan 2010
78
15
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.

114005_ad0e8b9364fd04c9e436c2a233216310.jpg


113733_026d923e6b213f9f04a068a2530ed7b7.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

Last edited:
idlemarvel

idlemarvel

Registered
13 Jul 2015
1,621
91
Ascot
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?
 
M

Michael

Registered
26 Jan 2010
78
15
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: idlemarvel
GAP

GAP

G Scale trains, Lawn Bowls.
14 Jun 2011
2,447
11
65
Bomaderry, New South Wales, Australia
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

idlemarvel

Registered
13 Jul 2015
1,621
91
Ascot
GAP GAP Rocrail runs on a Raspberry Pi (as well as Windows or Mac) and supports RFID including RC522 or ID-12 sensors
 
idlemarvel

idlemarvel

Registered
13 Jul 2015
1,621
91
Ascot
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.
 
M

Michael

Registered
26 Jan 2010
78
15
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.

113817_f34e658805bc2982c59ea1903f35d0a2.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: idlemarvel
T

Thickmike

Registered
14 Aug 2016
5
0
68
Northamptonshire
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
 
K

kevinhammond

Registered
9 Apr 2016
9
0
57
Scotland
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.
 
M

Michael

Registered
26 Jan 2010
78
15
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.