Sign in to follow this  
Followers 0
mikeexplorer

Update on my Model Train Project

4 posts in this topic

Posted (edited)

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.

 

 

Edited by mikeexplorer

Share this post


Link to post
Share on other sites

This is a more recent video that demonstrates the train operation routines and handing off from one to another. In this case I have actual train operations written.

 

Share this post


Link to post
Share on other sites

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.


Mike

 

Share this post


Link to post
Share on other sites

A demonstration when things go wrong, due to a locomotive's direction control that is failing. Its a good test for the programs to sense this.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0