Skip to main content

Hi everyone,

I am new to the forum and am looking for advice on what I want to do as part of my new layout. I am rebuilding an old layout that I had with my dad.

The layout will be 3-rail O scale (atlas tracks/switches). I intend for the signals to be a combination of Atlas signals, and custom dwarf signals I will make myself using LEDs and a 3d printer.

I am a software developer and also have a ton of spare PCs that I would like to put to use to automate and control the layout so I am looking at doing the following:

-Automating the signal systems into blocks, as well as have a few manual signal systems controllable by PC. The block signals do not need to be controllable by PC but must be able to update their status to the PC (either by serial (RS-232) or USB).

-Control of switch tracks by PC

-Control of power blocks by PC, as well as voltages within those blocks if possible (for older lionel engines I have and MTH DCS engines that I cannot control via PC).

-Control of certain engines (I know Lionel legacy publicized their protocol).

 

I am testing out the following ideas and would love advice:

-Azatrax makes USB controllable boards for switches that I am testing, I can connect dwarf signal LEDs to it so those align with the switch.

-Lionel Legacy for the lionel legacy engines I have, with the SER2 that allows me to send commands via RS-232 to the tracks.

 

I am at a loss to find a solution for the following:

-Automated block signals that can report their status to a PC.

-Manual signals that can be controlled via PC.

-Automated block power controlled via PC.

 

Any advice on solutions to the above 3 problems would be really appreciated!

 

Thanks,

Dan

 

Last edited by DashingDanLIRR
Original Post

Replies sorted oldest to newest

Hi Dan, 

Welcome to the forum.  

First it seems your question falls somewhere between alternate control systems and TMCC/Legacy, rather than DCC.  That's not super important, but you'd probably get more people looking if you'd posted in the TMCC, LionChief/Alternate control, or even in the Electrical forum.    

As far as actually controlling your layout from the PC you have a few options.  You could scratch build a control system and all of the electronics to run everything, and it wouldn't be especially hard to do if you know your way around the software and hardware aspects... and you have a lot of time to reinvent the wheel.   My suggestion would be to use the TMCC or Legacy systems for layout and engine control, and all of their associated hardware for operating switches and accessories.  From there you can connect the PC to the TMCC base or Legacy SER2 over RS232.  every command from the remote is echoed over the serial connection so you can write your program to update it's self with any commands sent from the remote, as well as sending out commands from your PC.  

When it comes to the track signals, I think your best option is to automate them from the track with sensors or insulated rails to detect trains.  From there you can use some simple hardware to read the signals state into the PC.  

For your questions, I think you are going to have to build your own interface as i don't think thee are any signals on the market ready made for what you need.  

-Automated block signals that can report their status to a PC.

-Manual signals that can be controlled via PC.

-Automated block power controlled via PC.

Basically what you need to do here is get a TTL level signal voltage from each signal that you can use to interface with the PC.  The simplest thing would be to use a relay connected to each signal to toggle the signal level for the PC.  I'd use something like a 74ls165 parallel to serial shift register to bring all of your signals together into one line of serial data for your PC that you could read with a few pins on the parallel port, or use something like an arduino  as an interface between the hardware and PC-via-USB.  

If you wanted to use the PC to take all the inputs from sensors, then send all the outputs for the signals, you can do that as well by reading in all of the sensor inputs, once again using parallel to serial shift registers, then send the outputs with serial to parallel shift registers such as the 74HC595.  I think this is the route you're looking for where you use the PC to control all of the signals rather than using a network of relays and such.  

If you wanted, you could build your own sensors with infrared phototransistors  to detect the location of trains, and use LED's in your signals to keep everything on the system at TTL level so that you do not have to worry about rectifying AC to DC or voltage level shifting.  

In the end  I think you're going to end up wanting to use something like an Arduino or RaspberryPi to interface between the layout and your software interface, and you will probably end up needing a lot of shift registers to bring many data lines into a small number of I/O pins, and to bring a few I/O pins back out to many output pins.  You may also want to look into the inexpensive relay boards often sold for arduino projects.  These come in many types, but the ones I use have 16 relays each one with built in optocouplers that you can run from TTL levels.  

Hopefully there is something here that helps you.  Software is not my strong suit, but I'd be happy to help with the hardware end.  I remember my fathers layout which we had automated for blocks  and switches with a Commodore 64, and it was quite a bit of fun, but a lot of work.  Things are a lot easier now with the many cheap prebuilt modules that are out there.  

JGL

Have you looked into JMRI? I think there are a couple of folks here that are using it with their layouts. I believe one forum member has used it with PC's and Arduinos as well. There was another system called, I believe CMRI? I am not sure it is still actively supported? JMRI is still actively supported. 

Atlas has a very nice signal system, but I don't know about the PC interface with it? I have my eye on that one myself, for a future upgrade someday.  

I agree with JGL above, you might get more replies in the Electrical forum or one of the others? I don't think the DCC forum here gets a lot of traffic?

Last edited by rtr12

Hey RTR and John,

Thanks for your advice. I looked at JMRI actually and it did everything I wanted except it doesn't seem to work with 3 rail O due to the fact that the it expects the two side tracks to act for polarity and, in the case of a switch for example, the frog of the switch to act as a common ground. I wish there was a way to get it to work for 3-rail O.

For switch/engine control I agree that legacy/TMCC is the best route due to the fact the protocols are publicized, it MIGHT (I would have to look into the source code) be able to integrate the JMRI panel application with the legacy switch controls if I can develop a software level interface that can spit out the correct commands via RS232.

I will start looking into the relay option, I already have a few raspberry pi's and have some experience playing around with them (they run windows 10 IoT now and my specialty is coding in C# so that isn't too difficult for me), the difficulty I have would be figuring out the hardware side of things and for making the switches change exactly the way I want them too. From research the new solid state relays should allow a gradual on/off of the LED so as to replicate current day signals (mainly NYCTA and PRR is what I am looking at). I am going to follow this here https://www.hackster.io/Anurag...me-automation-0dcefc as a way to hook up the RPi to multiple arduinos and those to multiple relays.

I am thinking of using an ultrasonic sensor on the arduino so as to detect the train in that block and trigger the sensor, unlike a photo sensor this would allow for bridges to be placed above the track as well as signals in tunnels. Please let me know what you think.

 

When I get a moment I will repost the question in electrical as you have suggested.

 

Thanks,

Dan

 

Dan, doing what you want to do is very possible. I'm in the process of doing something similar myself. There are two distinct parts to the solution, hardware and software. For your purposes, JMRI is the software. It can do everything you need it to do, and it is totally customizable . The TMCC codes are already programmed into it. Use JMRI panel pro to describe your layout to the computer.

Now you need hardware. You said you have computers available, what you are missing is a "bridge" to read and write data to and from the layout. I'm using a product called C/MRI, which stands for Computer/Model Railroad Interface. It takes an RS-232 line and runs it through an adapter card to get RS-485. From there it can communicate with the layout via input and output cards. The new style have 32 bits per card. JMRI is set up so that C/MRI bits can be directly assigned to the devices you have described with panel pro.

Your 3 basic railroad functions are, turnout control and signaling, which are outputs, and detection which is an input function. Because you have chosen Atlas track, you can use the second outside rail as your detection. No fancy equipment required, just a couple capacitors and diodes, and straight to the input.

Do you have a track plan?

Hi Elliot,

I like your C/MRI idea for the switches. Right now I created an experimental circle of Atlas O-54 curves and one O-54 atlas switch leading to a siding. I have two atlas signals so I would like to create 2 signal blocks out of the circle. I have one Legacy engine an ES44AC. Basically I'm looking to get my test track working in all the ways I want it to before I even start redoing my benchwork, as where I place the monitor screens (if I place them I.E. get this working) will make a significant difference.

So I am left with these questions:

Who is a good seller of C/MRI products? from a search I found only one website: http://www.jlcenterprises.net/

How do I wire an Atlas O 3 rail switch via C/MRI to JMRI (would I need a DCC command station also)?

What is a good manufacturer of power block transformers and how would I wire them via C/MRI to JMRI

How would I wire my signals via C/MRI to JMRI (for the signals I have a greater preference to go the raspberry pi route just because I would have significantly more control, but I am still interested to learn this method as well).

Thanks for all the help!

Dan

You can still use a Raspberry or Arduino with JMRI. I have the Arduino emulate the C/MRI protocol, so JMRI thinks it's dealing with C/MRI hardware.

With JMRI scripting you can also pass TMCC commands through to the layout. I have the Arduino mediate the connection to the command base, but it could be done directly.

MTH signals are pretty easy to take apart & wire the LEDs directly to your hardware of choice.

Last edited by Professor Chaos

From what I have read, http://www.jlcenterprises.net/ is the website of Dr. Bruce Chubb who I believe is the creator of the CMRI stuff. Also the only place you can get it as far as I know? From the looks of your link it does appear to still be supported. He has also written some books and articles on the CMRI hardware and interfacing with a PC. I was hoping some of the folks using JMRI with 3 rail O gauge would reply here, which they have. I find this all very interesting and I will be following along, but the details are still a bit above my pay grade.

Last edited by rtr12

Hi Dan,

Individual bare boards only can be purchased through JLC Enterprises (this is Dr. Bruce Chubb’s company – Bruce is the inventor of C/MRI).  JLC has both user and application manuals for sale on this site.  If you do go the C/MRI route, I highly, highly recommend that you purchase these manuals as they have very detailed “how-to” on both the board components w/component part numbers, system architecture, construction, and many, many software and hardware interface examples.  Therefore, 99% of your questions on C/MRI will be answered in these very comprehensive manuals.

For fully assembled C/MRI boards, there is Sliq Electronics:

http://sliqelectronics.com/pricing/

 There is also an active CMRI_Users Yahoo Group where you can post detailed questions.

 Just to clear on some of the terms, C/MRI is the hardware that interfaces your computer, PC or Rasberry Pi, to the railroad via, serial-based RS-232, RS-422, or RS-485 interface.  J/MRI is an open sourced Java-based application that can be customized through Java scripting or used with canned templates to create your model railroad control application that will interface with various model railroad interface systems, not just C/MRI.  J/MRI software is very versatile and does more than model railroad control, it also has the ability to program DCC decoders - for those that use DCC, and it includes a car forwarding operations application.  The J/MRI software is available for download at sourceforge.net:

 http://jmri.sourceforge.net/

 The C/MRI manuals available from JLC also include the source code for the interface protocol routines and some initial hardware diagnostic test applications so you can test out your interface boards (very handy if you decide to procure the components from companies like Jameco, Mouser, and Digi-Key to assemble your own system using the JLC bare boards) and then go on to apply the initialize, read and write protocol routines to your own model railroad control software that you write from scratch, if you choose to go that route.  The C/MRI system has been around for quite a while (started back in the 80’s as a 14-part series in Model Railroader magazine) and not really morphed that much over all these years even as technology has changed drastically but it continues to be one of the most used (thousands of installations) model railroad computer control systems out there due to its simplicity, versatility, and reliability.

 Scott K.

Austin, TX

IMHO the CMRI manuals are over kill, expensive and not up to date.  I ordered several years ago.  You can obtain all needed info online.  Just Google CMRI and Arduino.  There are many NMRA presentations.  Also Dr. Chubb has recently published a series on signalling in MRC.  There are also several Yahoo groups focused on CMRI, JMRI and Arduino relative to model railroading.

Chris 

Dan,  the examples may be spelled out for 2 rail,  but the number of rails makes no difference for what you want to do. 3 rails actually makes some things easier, the only thing that will come into play is AC vs DC, and that is easily solved.

I agree with Chris, don't bother with the manuals (yet). They are full of a lot of material that you will not need. There is also a lot of repeat between the book and the handbook.

Earlier I asked if you have a track plan. Seeing the scope of your project will help to determine how much hardware you will need. C/MRI is nice, but may be overkill. Arduino or Raspberry Pi  may be all you need. I am only using it for two reasons. One, I need over 200 inputs for detection, and over 300 outputs for turnouts and signaling. Two, I already own all the equipment. I bought it 25 years ago for another layout, and I want to recycle it into my current layout.

I'm not quite sure you have a full grasp of exactly what you need to accomplish your automation goal, I feel that you are only looking at bits and pieces and not seeing the big picture. I get that impression from your previous posts.

You need to look at everything as a device that is either on or off. Turnouts are each just one device, and take one output bit each. Detection tells the computer where the trains are on the layout. Every detection track segment is one input bit. When you feed the detection data into the computer, JMRI will do the calculations for you and return the signal aspects all you need to do is assign the output bits to turn the lights on and off.

There is a lot more to say about this, but I'll stop here for now.

Hi Elliot,

I do understand the general idea that (if I wanted to) I can make each insulated section its own detection blocks, and feed that information into JMRI, that the detection blocks are inputs and the signal aspects outputs. My issue is general lack of documentation at the moment which is why I want to get the manuals just to get a handle over the protocol. I also agree that for my test loop I want to try out using arduinos so I can get an idea of how everything should work.

Thanks,
Dan

Last edited by DashingDanLIRR

Here's an example of what you can make with JMRI. Turnouts and signals are controlled by sending C/MRI commands to an Arduino, which triggers the required hardware. For accessories and operating cars, the JMRI controls invoke Jython scripts that create a TMCC command and send the TMCC command to the Arduino. The Arduino then passes the TMCC command to the Legacy base.

 JMRI panel

Attachments

Images (1)
  • JMRI panel
Last edited by Professor Chaos

Thanks for setting me straight on that Dan. The thing is the manual is extremely 2 rail-centric, so much of the content isn't applicable to your situation, though some of it is.

As for the whole protocol thing, if I'm not mistaken, when you use C/MRI with JMRI, it is as close to plug 'n play as you can get. The actual communication is taken care of when you assign the C/MRI bits to the JMRI panel devices, and need not be looked at directly. If there was anything to really study, it would be JMRI, and that material is available online.

When you choose Arduino or Raspberry Pi or another system that has a micro processor, communication protocol may come into play. However, JMRI is set up to accept data from other hardware systems not just C/MRI. As far as I know C/MRI has no processor, except that it packs and unpacks the data that is sent over the serial line. It doesn't perform calculations.

Back in the old days, before JMRI, you had to write your own software to control C/MRI. A good chunk of the manual is devoted to that. I am sadly all too familiar with this, as, on that other layout of mine, I paid someone thousands of dollars to write software which was ultimately only partially complete when the money ran out. Now JMRI is free and 10,000 times more powerful, than what I had 25 years ago. Up until 4 years ago I thought I was going to have to write my own software, then I attended a couple of clinics on JMRI at the NMRA convention. I'm so glad I don't have to write it! I have better things to do, like draw my control panel.

Let me look in the C/MRI manual and see if there is a table that has what you want. Or, you could ask Professor Chaos nicely, because it sounds like he has already invented that wheel.

Last edited by Big_Boy_4005

As Elliott has said CMRI and JMRI are plug and play.  Use this guy's open source Arduino sketch and instructions to make an inexpensive Arduino UNO a CMRI device.  http://www.utrainia.com/tag/cmri  Focus on these instructions and JMRI documentation and you can have a loop of track up and running in an evening.  Detection, signaling and control H/W aside.  3 rail detection is rather simple due to the dual outside third rail.  Search Prof Chaos previous posts on CMRI, JMRI and Arduino to this forum for some ideas.  He also has some YouTube videos showing his layout automation.  Very cool.

Chris

Ultimately what I would like to do is develop a library in C# to emulate the CMRI node (similar to the CMRI library for arduino) such that I can use the GPIOs off the raspberry pi as input/output lines. From what I gather online the GPIOs are 3.3v and the input/output lines expect a different amount of voltage so I would have to look into how to step down the voltage as well (resistor etc.).Then I would create (or latch on to the existing) network driver in JMRI to connect and talk to the first raspberry pi in the chain of RS485 raspberry pis.However that is far down the line. I need to understand the actual serial messages first, the bytes it expects, the voltages it expects, and all of that info.I read on one of the sites that the C/MRI arduino library does not function on an arduino with an FTDI USB-Serial chip, is this correct? If so, which arduino would you recommend? The one from the blog looks like a nano but according to Arduino's site that has an FTDI chip as well (all of theirs for the most part does)Thanks,Dan

Sounds like an interesting project.  Keep us up to date on your progress.  You should defiantly start following the Yahoo CMRI group.  There have been debates on the use of Raspberry Pi vs. Arduino and folks undertaking projects such as yours.  I am using a Mega 2560 which does not use the FTDI chip.  The cpnode guy's are using a Leonardo and have also released their sketch as open source.  

Chris

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.
×
×