Skip to main content

On my web page, I describe the work that I've been doing to implement a method of train detection on my layout. My layout uses 3-rail tubular track so all of the work that I've done is with that kind of track.

I envision a scheme where there are RFID tag readers at strategic places around the layout (placed under the tracks). RFID tags are attached underneath every engine and car on the layout. Tags are loaded with information about the engine/car to which they are attached. A control computer could then use that tag information to control the engines.

I would use the Elechouse CC1101E radio and commands that I developed for the RTC program using OOK transmission codes.

Needs to be cheap. I chose the 13.56 MHz tags.

I plan to put two tags on each engine, one on the front truck and one on the rear truck. Cabooses will have one tag on the rear truck. All other cars will have a tag on one of the trucks. I plan on each tag having information about its distance from the end of the car. I hope to be able to couple/uncouple, pickup and drop off cars automatically via the control computer.

My scheme is based on Arduino computers and RFID tag readers from Elechouse. Each Arduino processes detection information for up to 6 tags. Any number of Arduinos then send this tag information to a Master Control Arduino. This computer uses the tag information know the position of every engine and car on the layout. This computer constructs commands which are sent over the radio to the TIU which forwards them on to track and to the engines. Here is a photo of one Arduino with one tag reader connected - with the RF antenna placed under the track:IMG_9674

My web page describes what I've done up until now and has a bunch of videos:

So what can we do with this? I envision a "smart" Master Control program which gets the tag information and controls the trains. Say, for example, you are running one freight train, doing switching to drop off and pick up cars. Let a computer run another freight train in the other direction. The computer would know where your train is and control the other train to take sidings to keep out of your way.

Or maybe, the computer controls a 1st Class train over the layout while you, controlling a peddler freight, have to figure out how to keep out of the way of the 1st Class train while still doing your work.

This video shows a short clip of a P&LE GP38-2 being controlled based on tag detections  on my test layout.


Images (1)
  • IMG_9674: Arduino with one RFID tag reader
Videos (1)
Last edited by SanDiegoMark
Original Post

Replies sorted oldest to newest

The RFID system I developed about 10 years ago consisted of a PIC based board. It wasn't computer controlled but a stand alone system tied into the Atlas signal system. When a train approached a red signal the RFID reader under the track would read the engines TAG and then generate the proper engine commands to stop the train. It would also blow the horn/whistle ( 1 toot). When the signal turned green engine commands would blow 2 toots and start the train up. 

I've made some pretty good progress on my RFID train detection scheme. It is now very reliable and I feel comfortable leaving the layout room (but not going to far!).

Three new videos on my web page

videos #13, 14 and 15. For higher resolution videos, go to my YouTube page:

In video 15, I've moved the RFID detectors to my layout (from the carpet) and show the RTC program along with the detectors running three trains. I used this during my TTOS SP Layout Open House Tour on the 28th of last month.  The program kept 3 trains running on my layout for 4 hours while I talked with the visitors.


This is a series of Videos describing and demonstrating my Tag Detection
Hardware and Software. This effort has kept me busy as we self-isolate during
these times of COVID-19. They are available on YouTube as well as on my
my web page. You might get higher resolution on YouTube and there are more
notes and comments on my web page.

1 - Tag Reader Hardware
2 - Tag Mounting
3 - Tag Programming
4 - Simple Tag Detection Script
5 - Tags and Train Control
6 - Running 3 Tag Scripts - Screen Capture
7 - Running 3 Tag Scripts - Layout View

This is the kind of stuff that people should be working on implementing in bigger scale for mid-level MRR folks.  Beginners would be a bit confused, but for those who have actual layouts that can run 2 or 3 full consists, I really feel like opening up different ways to control the trains are going to be the next real leap in the hobby.

Maybe it won't be RFID, maybe it won't be Arduino, but SOMETHING is going to happen that will be easy enough for the masses to start using.

This is great stuff!

I love the idea, but implementation is a bit over my head.  I'm not an EE and I've never done anything with an Arduino.  I really don't know where I would begin.

I've been hard at work designing complex layouts for my 12 x 18 space featuring multiple routes.  Basically three short trains alternating among two mainlines.  I would love to set it up as an automaton (think "demonstration mode" for visitors)  Or even better, have a computer-controlled passenger train that stops at stations, while the human operators try to complete a switch list with a local freight.

I was mulling implementation with the Lionel LCS sensor track, and layout control through an iPad.  Or go all-in with JMRI / C-MRI.  Although a lot of the equipment I have is Legacy and DCS I'm not wedded to either of those systems; in fact I would prefer a non-proprietary system.  With 40+ switches in 200 sq ft some kind of computer-assisted visual control and routing is mandatory.  Especially if I want my guests to take an active role in operating the layout.

Earlier this year Lionel introduced track with built-in LED lights.  I think it's mostly a gimmick for Christmas tree layouts.  But some variation of that could be a visual cue directing visitors where to go.  Imagine... when a train passes the track the LED is extinguished and the "passengers" are picked up, etc.  Just a thought...  With the nature of my layout designs, if some randomness could be introduced it could make for a highly varied operating experience.

Another possible use of your RFID tags, would be with locomotive sound.  All the Fat Boys in the world won't match a subwoofer and high-quality monitors (speakers) under the platform.  What if the sound were to modulate based on the position of the loco as it moves around the platform?  Just thinking aloud here...

Your work amazes me, but I struggle to learn by watching videos.  Maybe you could do a clinic at a future York or Cal Stewart meet (do they still have those?)  As always thanks for sharing!

Last edited by Ted S

Add Reply

The DCS Forum is sponsored by
OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
Link copied to your clipboard.