My Model Train PLC Project Update


Supporting Member
Join Date
Nov 2018
I have been doing this project as a means to learn PLC programming. Awhile back I got stuck in a rut with doing this project and I asked some questions here. Thanks to others who pointed out some bad programming practices I was using in designing this project I was able to overcome the problems.

Originally I designed it with a Micrologix 1000 PLC, but soon ran into several problems, one was the limited I/O and that it could not be expanded. Plus its a discontinued model and twice I had to repair it for bad output relays. It also had limited memory and by the time I wrote in one of the train operations, I was nearly out of memory.

This is the "Second generation" project. I upgraded to a Micrologix 1400 which allowed for more I/O and Ethernet capability for the HMI. The RSlogix Micro Starter was not the expensive to purchase (about $160) so for a "home budget" it was a good way to go. I am using a C-more Micro for the HMI panel because it was not expensive. I also had on hand a smaller 4 inch panel which I discovered also has an ethernet port so I plan to use it for a second display. I originally bought this one several years ago to use with my trainer kit and basically has sat off to the side for awhile. Now I can use it.

Eventually this project will be transferred to my living room. I already have an around the ceiling layout now so I designed this project to be basically the same track layout. I have a pedestal from an old take-out robot which is where the HMI panel will be mounted.

This is a tour of the project with the hardware and ladders and a demonstration of routines. At the time I didn't have any written yet but I designed a menu system for the routines. It was originally an idea of the "mission" code that is on the website "contact and coil" but I later designed my own way to run routines and seamlessly hand off to another routine.
One of my locomotives has been acting weird with its direction control. It is due to the electronic direction control is failing and over time it is getting worse. However, I have been able to exploit this problem as a means to test my programs to react to a situation where things don't go as planned. This is one example where the subroutine gave up after so many tries to get the locomotive to run in the correct direction and shut down the layout.
The program for this project is large, but as shown above with the train operation routines and the menu system how one routine can hand off to another and the concept of routines that run endlessly and some routines that do an operation and end. If anyone wants to see that part of the code I will post it.

It is kind of a "mission" as described in "contact and coil" but utilizes integers to jump to the selected operation and using a flag that I call "end request" which will tell an endless running routine to end its operation at a given state. Train operations that are not endless would ignore this flag, complete its operation, then end.

I am using integers to indicate what the current running routine is, and what the "next" routine will be and another integer is set as a flag to tell the main ladder that the routine has ended so it knows to hand off to the next routine.


Similar Topics

What happens if you power up a 1783-MS10T with a Compact Flash card from a 1783-MS06T? Does it work, but with the "extra" ports unconfigured? If...
Hi , Where i can find Mitsubishi PLC Card end of line & replacement model details. i am looking for Q02CPU replacement model. Please advice. thanks
I've blown the Output Transistor on the Output Card of a Compact Logix 1769-L24ER-QBFC1B It says J378. Does anyone know the replacement part...
I call this "slightly off topic" because my model railroad layout is controlled by a PLC. Christmas themed trains running on the layout, one at a...
In the past I have been familiar with the 1769-L35E series CompactLogix PLCs by Allen Bradley. For those PLCs (firmware version 20.19), when the...
Top Bottom