Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

PLC controlled model train, please help

6067 views
12 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    February 2013
  • 4 posts
PLC controlled model train, please help
Posted by raider49xr on Friday, February 22, 2013 7:02 PM

Greetings,

I am an electro-mechanical engineering student at Penn State Berks campus.  Currently I have a class on the introduction to PLC basics utilizing the Allen Bradley RsLogix 500 PLC.  I am working on the planning stages of a model train controlled by PLC project and am looking for input.  I have a basic understanding of writing code but need help in reference to controlling the model train.

The basic overview and background to this project:

The model train will represent how the PLCs are used in industrial settings.  I would like to be able to control the movement of an engine with a single car attached.  There will be a user interface to chose specific functions or tasks to be completed by the train so I will need to be able to control the movement of the car(the speed does not matter--just movement).  Also, I would like to incorporate signals along the trains path, crossing areas, and track switching which would all be automated by the plc. I have the track layout determined but I am not sure how to add it to this post.  Basically it is an oval which the train will travel around in the clockwise direction.  There will be two chances for the train to complete inner loops and an outer loop.  Upon entering each loop I need the train to stop for industrial processes to take place then the train to continue around to complete the loop.  I am leaning towards HO scale DC trains.  I do not have the track and items in my possecion yet but will next week.

My questions are:

What I/O modules would you reccomend for these controls.

What methods can be utilized to control the trains movement?

Is it possible to communicate with DCC components with the PLC?

Any wiring recomendations for track and signals, etc.

 

  • Member since
    July 2008
  • 1,204 posts
Posted by mfm37 on Friday, February 22, 2013 10:42 PM

What is PLC?

  • Member since
    May 2015
  • 5,134 posts
Posted by ericsp on Friday, February 22, 2013 11:19 PM

PLC = Programmable logic controller

You will not be able to put a PLC in the rolling stock (unless it is a very large scale). I think your only option is controlling the the power to the rails and automatically lining the switches.

Once you figure out how you will control the process you can determine what inputs to and outputs from the PLC are needed. Once you know that you can figure out what modules you need.

Think of communications protocols as languages. If two people do not know a common language, they will need a translator or not communicate. It is the same with electronics. I seriously doubt anybody has, or ever will, make a gateway to allow any DCC protocol to communicate with any process control protocol.

"No soup for you!" - Yev Kassem (from Seinfeld)

  • Member since
    February 2013
  • 4 posts
Posted by raider49xr on Saturday, February 23, 2013 7:45 AM

I was considering wiring each section of the track independantly and then have the PLC sequentually power each section of the track and power down the previous section as forward sections are energized.  This will essentually control the engines location be able to stop and start it anywhere on the track.  Also I would be able to possible control more than one engine at a time.

  • Member since
    January 2007
  • From: Eastern Shore Virginia
  • 3,290 posts
Posted by gandydancer19 on Saturday, February 23, 2013 10:19 AM

The most common module to use would be relay type modules.

Atlas snap switches for turnouts would be the easiest to set up. These are twin coil type machines. Activate one coil momentarily and the turnout sets one route, activate the other coil momentarily and it switches to the other route.

Most other devices will work with relays as well. Grade crossings and Signals, etc. These could be simulated with different color of LED's or small bulbs. Simple relays to control each LED on and off. Grade crossing lights flash alternately. If there are solid state relay modules, they may work as well but individual LED's draw small current, 20ma or so.

Block power following like you have suggested will work as well.

If you want to add some pizzazz, set up a module or two that can control the voltage to the track. Then you can start the train slowly by ramping up the voltage and ramping it down when you want to stop instead of a bang on and bang off.

DCC requires a specific digital pulse train type signal and would require you to purchase a DCC system to use as an interface to the PLC system. I doubt if there are any off the shelf PLC to DCC interface modules available.

Hope this helps.

Elmer.

The above is my opinion, from an active and experienced Model Railroader in N scale and HO since 1961.

(Modeling Freelance, Eastern US, HO scale, in 1962, with NCE DCC for locomotive control and a stand alone LocoNet for block detection and signals.) http://waynes-trains.com/ at home, and N scale at the Club.

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Saturday, February 23, 2013 11:54 AM

 Right down the road from me. Interesting project idea - great working a hobby into somethign practical.

I think Elmer pretty much covered it. Simple stop/start for the train is probably easiest. DCC interface would be much more complex - it would be possible to use a D/A module to control the throttle of a DCC system, but the only way you can get that off the shelf without actually cutting intot he DCC system would be a Digitrax Zephyr, and use a jump port - it's designed to hook a standard DC power pack up to add an extra throttle or two, and works with a 0-12 volt input. You'd still have to actually select the loco and activate it. The Bachmann EZ Command is probably cheap enough to not care about voiding warranty - you could tie a contact to one of the buttons, which is how it selects a loco, question is what needs to replace the poentiometer - you could use a servo output and just control it, rather than electrically repalce it. All depends on you level of electronics skill. DC control with simple relays shutting off the power at stop locations is DEFINITELY the easier route.

 Turnouts, if you use the solenoid machines, need a momentary pulse output at realtively high current, or you could use Tortoise motors, which take a continuous 9-12V at low current, simply reverse polarity to change position.

  One thing, if you use relay outputs to simply chop power to make the train stop at each location - wire the relay outputs to short the track when power is off. IE, when 'Go', track power is connected to the power supply, when relay goes to 'stop' it disconnects from the power suppyl but shorts the track. This will make the stops more precise - shorting the motor outputs will brake it to stop faster than just letting it float.

 I love this sort of stuff, but never get to play. I was doing some work at RACC the other week and was in the building where they have the industrial control labs and it makes me want to take a class so I can go play with all the cool toys.

                  --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    February 2013
  • 4 posts
Posted by raider49xr on Saturday, February 23, 2013 12:38 PM
Randy,
If you would be interested in helping us out I could set a time where you could come into our labs to help us brain storm. If you would be interested that would be great, we do have a decent amount of electrical tools and components available along with Plc stations. Once we get the track layout set up and all the model railroad accessories, I will keep updates on this post
  • Member since
    December 2001
  • 1,932 posts
Posted by Stevert on Saturday, February 23, 2013 2:17 PM

I agree with the opinion that in this specific case, controlling the train's movement might be easier and less expensive using DC, unless you already have a DCC system laying around. 

However, the LocoNet_hackers guys (LocoNet is Digitrax's communication method) seem to have a lot of experience interfacing PLC-type stuff with the LocoNet.  You may want to join their Yahoo! Group and pose your question there.  They may be able to give you some pointers or suggestions.

http://groups.yahoo.com/group/loconet_hackers/

  • Member since
    July 2009
  • From: lavale, md
  • 4,654 posts
Posted by gregc on Saturday, February 23, 2013 5:50 PM

how do you determine the position of the train?

if you could determine the location of the engine, you can simply control power and polarity of the track.

greg - Philadelphia & Reading / Reading

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Saturday, February 23, 2013 6:53 PM

 If we assume the car will always be coupled to the loco, a super simple way would be to use some magnetic sensors and a magnet ont he bottom of the loco and car. Or possibly trip contacts the signal the PLC when the loco gets to a specific point. Unless the object is to simulate a working railroad with multiple trains running, I don;t think there is a need for more traditional block detection.

 It sounds to me that this is more like a simulation of an industrial transport system than a railroad system. So perhaps some of the things we'd need to make a realistic railroad function aren't strictly needed for this.

       --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    February 2013
  • 4 posts
Posted by raider49xr on Saturday, February 23, 2013 7:07 PM
The position of the train could be indicated by a number of methods, simple throw switch, magnetic sensor, photo eye, inferred, I will check to see what we have around the lab on Monday that is compatible with the Plc. We could use the sensor to power up and power specific blocks of track which might make it possible to control more than one train. And yes the main idea is to model an industrial setting but the more processes we can include the better so it makes sense to use accessories compatible with model trains. It seems we are moving away from DCc however I will be checking into the yahoo link listed above.
  • Member since
    July 2009
  • From: lavale, md
  • 4,654 posts
Posted by gregc on Saturday, February 23, 2013 10:44 PM

raider49xr
We could use the sensor to power up and power specific blocks of track which might make it possible to control more than one train.

And yes the main idea is to model an industrial setting but the more processes we can include the better so it makes sense to use accessories compatible with model trains.

what do you mean by industrial process?    and what accessories do you have in mind?

i write firmware and often use state machines.   If the train needed to back into a spur, presumably

  1. activate a position sensor, at a point where the train would be stopped and readied to back into the spur,  (i realize you may not have to activate a sensor, and that you would expect a trigger from a specific sensor, 4 below)
  2. prepare a path (align turnouts) for a train to reach the desired spur
  3. power the train, presumably moving forward
  4. when it reaches the position sensor, stop the train
  5. switch the spur turnout
  6. activate a position sensor in the spur
  7. power the train to move backwards into the spur
  8. when it reaches the position sensor in the spur stop the train

presumably the train is now ready for the next movement.   Is the an example of part of an industrial process sequence thru a couple states?  

If so, it seems that the events triggering the state machine would be the position sensors indicating the presence of the train and possibly a delay, resulting in one or more actions triggered by those events.   Is this the way to think about the industrial process sequence(s)?

a TC4423/4/5 may be useful for controlling train (other things) power and polarity.   But position sensors seem essential.

greg - Philadelphia & Reading / Reading

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Saturday, February 23, 2013 10:57 PM

 Think microcontroller on a macro level. After having some experience with PLCs and more so with machine tool CNC controllers, microcontrollers like the PIC are simply reduced scale low power versions of PLCs.You have inputs and outputs - contact sensors, switches, analog input, analog output - except much larger and capable of handling much higher voltages and currents. Guess it's just me, I find this stuff cool to play around with. I need to settle on a platform and start using it though. I started with PICs, but the whole DIY world seems to have gone Aurdino.

                 --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!