Skip to main content

This is a project I am working on. I am using an Allen-Bradley PLC unit to control a model railroad layout. This project normally would be considered impractical as there are better options out there to control a model layout. I am doing this as a learning tool to teach myself PLC programming. It is possible some of the electrical build for the layout may come in handy for some other project so there could be some useful information. I was lucky to be able to secure a large assortment of part from my prior job, they were scrapping machinery and I was able to take parts home for free.

The first thing I did was take this interface board and modify it so it can send a signal back to indicate the switch position. Most PLC and handling interface is 24 volts. I replaced the onboard resistors to 220 ohm to match the voltage given by the "RSC Lights" wire from the switch. The pictures show the switch position and the LED's on the interface board.

 

Attachments

Images (2)
  • 0213171816 (Medium)
  • 0213171816a (Medium)
Original Post

Replies sorted oldest to newest

The next step was to figure out a way for the PLC to change the switch. The remote switches are activated by a connection from track common to either Throughway or turnout. In my collection I have a lot of solid state relays, but experiments with them proved they will not work for switch throw. Once I connected a mechanical relay, the switch will operate.

The test setup uses two relays, one for throughway, one for turnout. They are connected in a way that both cannot be operated at the same time. The downside to this is it requires two outputs for each switch.

It is also not a good idea to maintain a constant contact to the switch wires. Once the switch is thrown and it activates the small switch inside, the motor will shut off, however if something jams the switch and it does not make the micro switch inside, the motor will continue to be powered and possibly burn up.

 

Later I will post the solution to this problem.

Mike

 

Attachments

Images (5)
  • 0213171904 (Medium)
  • 0213171912 (Medium)
  • 0213171924 (Medium)
  • 0213171945 (Medium)
  • 0213171947

Hi Mike,

What are you planning on for hardware?  Relay or sourcing outputs? A relay output would be most versatile, you could use any voltage. They are generally good for around 2 amps.  Using 2 outputs would be easiest. Whats nice is being able to adjust the output pulse time with the logic. 

I was also planning on using a plc on my layout. Originally I was going to use a touchscreen for controlling my layout but after learning whats out there,  MTH and Lionel made it to easy. I still plan on using a Micrologix 1400 for running crossing gates and traffic lights. I have a surplus of this platform since we have switched to Control Logix.

Let me know if I can help you with programming.

I started this project last year and continued this year so I have gotten pretty far with the project and now just starting to post here about it. I am using relays and a Micrologix 1000 since the software for it is free. I also scavenged several HMI panels and later on I plan to use them, IF I can interface them to the PLC. They were originally used on Mitsubishi PLC's and may not have the communication ability for Micrologix. (I am not that far yet)

The HMI panels I have are Proface.

Mike

 

The next step is to incorporate block detection on the layout.  I have on hand several Omron IO blocks which were used as an interface between machine components. This provides isolation between machines but allows communication. This will provide isolation to the layout track and the PLC.

I used the accessory activator pack as block detection. By isolating one outer rail a train can be detected on a section of track even if track power is off.

I connected the 24volt power supply common to track common. The test track shows when the caboose enters the block, it activates the Omron relay (these are solid state relays)

Mike

 

Attachments

Images (8)
  • 0214171820 (Medium)
  • 0214171845 (Medium)
  • 0214171910 (Medium)
  • 0214171910a (Medium)
  • 0218171855 (Medium)
  • 0218171901 (Medium)
  • 0218171905 (Medium)
  • 0218171905a (Medium)

The next step is to utilize this operator box. It has six lighted push buttons and an emergency stop. There is also an on-off switch on the side. I rewired it and added a terminal strip for experiments.

I also decided on how to handle the remote switches. My layout has three switches so I used a fourth relay as an "enable" this will use 4 PLC outputs total to control three switches. This will prevent a burnout of the switch in case it is jammed. Basically I select throughway or turnout on the switches, then turn on the enable relay for one second, then shut it off.

 

Attachments

Images (5)
  • 0304171919 (Medium)
  • 0304171924 (Medium)
  • 0310171858 (Medium)
  • 0311171949 (Medium)
  • 0323171833 (Medium)

The next step is to map out the PLC inputs and outputs. attached is my diagram, the PDF file. I plan to utilize the emergency stop button in case something goes wrong and I need to shut everything down fast. It is never a good idea to use a PLC program for an emergency stop, or a safety circuit. I plan to use a PNOZ safety relay for that. What I accounted for is an input to the PLC to tell it that an emergency stop condition has occurred. I also planned to have an automatic and manual control of the layout, this is also an input to the PLC to indicate it.

I am also allowing for 2 pushbutton inputs, and the rest will be the Omron IO block for 16 block detection and/or optical sensors.

On the output side, I allocated two for pushbutton lights, and two alarm conditions, one a "soft" alarm, the other a "hard" alarm.

4 outputs are used for the track switches. Three are the switch itself using a single pole, double throw relay (throughway/turnout) and the fourth is an enable to connect the relays to track common to allow the switch change. After one second, this relay shuts off to prevent a switch burnout. I timer relay would be ideal, but I don't have one, so the one second enable will be software controlled.

The last four outputs are to control track power in four sections. I decided on the mainline, throughway, side track, and spur track.

 

The document also shows the alarm conditions. I made up a document which maps out all the PLC's data to keep track of it so as I develop the project and add routines, I can keep track of what data I used so there is not a conflict. This includes binary data, timers, integers, and so forth. I made the alarm code one binary data and split it up into bits. This way, later on when I integrate a HMI panel, it can read this binary data and display an actual alarm.

Attachments

Images (6)
  • 0303171907 (Medium)
  • 0311171827 (Medium)
  • 0315171947 (Medium)
  • 0325171851 (Medium)
  • 0408171758 (Medium)
  • 0415171751 (Medium)
Files (1)

I forgot to add in the above post the automatic and manual mode. I am using a typical start-stop circuit except I used a second relay for the stop part since the pushbuttons are normally open and not normally closed. The second relay handles the stop part. This way I push one button to latch automatic mode, and the second button unlatches it for manual mode. This also sends an input back to the PLC to show the status. This way, in manual mode, the PLC will know not to do anything and it does not have control of the layout.

Once the wiring was done, I ran some tests with RSlogix and connected the operator panel to test automatic and manual mode. Red light is manual mode "Stop" and green is automatic mode "start"

The completed PLC interface is shown, the left terminal strip for the initial tests has the emergency stop and emergency reset jumped. These are connected to the PNOZ relay (yellow relay) which handles the safety circuit. Once an E-stop has been tripped, a button has to be pressed to reset it.  The PNOZ relay has track power and 24 volts ran through it. If this relay trips, it drops all track power and shuts down the relays.

The top row is the terminal strips with the IO and other interface.

Second row, the left two relays are the automatic and manual mode, the four thin white relays are the track switch control (three switches plus enable) The thicker orange relays are for track power, they are rated for a higher current then the white relays.  The yellow relay is the PNOZ safety relay, The green relay block is the input isolation to the PLC.

Bottom row is a terminal strip for 24 volts and common, then there are three fuses to protect the power supply in the event of a short circuit. The PLC unit and then a 5 amp 24 volt power supply with a small breaker for the 120v AC line.

Attachments

Images (3)
  • 0415171816a (Medium)
  • 0415171817 (Medium)
  • 0415171838 (Large)

You did a good job of controlling as much as you can with limited I/O.  I take it you are trying to accomplish what you want with the hardware you have available.

Moving up to modular plc like the 1100,1200 or 1400 will allow adding on additional 

I/O and still use Logix 500, not sure how much you can do with 500 lite.

Watch Ebay.  You could use logic instead of many of the relays. Modifying logic is much easier than hardware.

If you can find a 1400 you can use Ethernet instead of DH485 for communicating with your proface. Much easier.

Safety relays are generally used to reduce personal injury risk and not really necessary for protecting hardware.  They add complexity. 

A force guided relay tied to your Estop would make a good MCR.

postwars posted:

You did a good job of controlling as much as you can with limited I/O.  I take it you are trying to accomplish what you want with the hardware you have available.

Moving up to modular plc like the 1100,1200 or 1400 will allow adding on additional 

I/O and still use Logix 500, not sure how much you can do with 500 lite.

Watch Ebay.  You could use logic instead of many of the relays. Modifying logic is much easier than hardware.

If you can find a 1400 you can use Ethernet instead of DH485 for communicating with your proface. Much easier.

Safety relays are generally used to reduce personal injury risk and not really necessary for protecting hardware.  They add complexity. 

A force guided relay tied to your Estop would make a good MCR.

I am using what I have on hand. So far I have been able to do what I need to with the RSlogix Lite,  I figure I still have a lot to learn with what I have, and in the future if I need more, I can upgrade.

I made the layout basically the same as my around the wall layout, with three switches, a side and spur. I hope when I have this completed, that I will use it to operate my around the wall layout. For that, I have enough I/O to do the job.

I am limited by the fact I cannot control the throttle, nor operate the bell and whistle buttons on the CW80.

Mike

 

Consolidated Leo posted:

Interesting! But I don't live in the world of PLC (programmable logic controllers) so I don't know all the acronyms. Please define these (at least once) for those of us who might not know them. What is MCR, HMI? That would help for those who want to follow along.

MCR = Machine control relay. Typically in an automation environment, a series of buttons are placed around the machine so in the event the machine jams, or some other event, a button can be pushed to cut the power and other sources of energy to a machine. (emergency stop) In my setup, the yellow relay is the safety relay, if I press the emergency stop button, it cuts off all track power and cuts the 24 volts to the external circuits. I admit, this is overkill and probably not needed as the worst thing that will happen is the trains will collide. Once I reset the emergency stop, power is not restored until I press a reset button.

HMI = Human Machine Interface. I attached a photo of a panel I plan to use and an image of a typical one. These are touchscreens that you program with virtual buttons, readouts, and so forth. It reads and writes the data bits in the PLC so I for example can program it to throw a switch by touching an image of the switch.  I can perhaps program an image of my layout and have it highlight the areas where trains are detected, show the status of the switches, etc.

In my above post, where I listed the inputs and outputs. below that is a series of alarm codes I made up. The reason I broke it down like that is for a future use of the HMI panel. The panel will read this data bit, and if a code is set (the data bit is non-zero) the panel's software can display an written alarm on the screen.

"No train detected on side!" as an example. I also have a tower light and audio box, which I have not shown yet.

I can also program virtual buttons, say for example I have a train running on the main, and another one is parked on the side track. I can make a button with a caption like "switch trains with side" and once I touch that button, the program will exchange the trains, pull out the one on the side track, and put the one running into the side track.

Mike

 

 

Attachments

Images (3)
  • 0303171907 (Medium)
  • 0311171949 (Medium)
  • serveimage

The next step was to add a signal tower and audible alarm. The light tower has three colors, Green, Yellow, and Red. I used Green for automatic mode, Yellow for manual mode, and Red for hard alarm. The Patlite can generate four audible alerts, but I am only using two of them. One for a soft alarm, the other a hard alarm.

What I mean by a "soft" alarm, is a condition where I want to unit to have an audible alert, but its not a condition that would shut down the layout. For my experimental code, I activate this soft alarm when the program executes, and stop it when it completes.

A hard alarm would be a condition where something has gone wrong and the program stops executing.

Mike

 

Attachments

Images (4)
  • 0422171032 (Medium)
  • 1103171834 (Medium)
  • 1105171621 (Medium)
  • Page 7

The next step is to make a control for the layout so I have the track power and remote switches in one place. I have 4 track power and 3 switches. I also want to allow for automatic or manual control, so a few relays were used to accomplish this. When the unit is in manual mode, the switches will work and I can control the layout from this panel. When automatic mode is enabled, control is handed off to the PLC and the switches are disconnected.

Attachments

Images (6)
  • 1105171714 (Medium)
  • 1111170827 (Medium)
  • 1111171010 (Medium)
  • 1111171522 (Medium)
  • 1112170858 (Medium)
  • 1112171012 (Medium)

At this point enough hardware has been built to start coding. The first program I wrote will simply exchange the running train. There is one sitting on the side track, when the code executes, it will pull the train out of the siding, and put the running train into the siding. The program does check to see if there is a train waiting in the side track, if it is not there, it alarms out and the running train just keeps running. For these first test programs, I locked the locomotives in forward only. I don't have enough hardware built yet to detect forward and reverse moves.  If there is interest, I can post the program code.

 

https://youtu.be/PVNcV0xu_uA

 

 

Last edited by mikeexplorer

Whats nice is with logic you can program about anything you can dream up without any wiring.

There are instructions for about anything: Inputs, outputs, bits (virtual relays) timers, counters, math functions and dozens more.

I plan on using one for train detection, crossing gates, and traffic lights. MTH has made controlling the trains and switches to easy.

Scott

 

 

Add Reply

Post

OGR Publishing, Inc., 1310 Eastside Centre Ct, Suite 6, Mountain Home, AR 72653
800-980-OGRR (6477)
www.ogaugerr.com

×
×
×
×
Link copied to your clipboard.
×
×