greg ciurpita gregc
Most modelers are not comfortable doing electrical wiring much less electronics and further still, programming. But the coding for many model railroad projects isn't really the problem, it's customizing it for a particular situation.
 
The biggest benefit of a software solution is that it is relatively easy to modify. Even if the processor is under the layout, a long enough USB cable can often be used to access the board, make and test the modification while working next to layout instead of crawling under the layout multiple times. It also encourages just trying something new because if it doesn't work out you can just reprogram it to the original code.
 
Another significant software benefit is that once the code is written, it can be re-used on many processors on the layout. However, what may need to change is the configuration, for example, if multiple turnouts need to be switched when using servos. Of course, generic groups of pins can be used on each Arduino for the turnout and panel switch pins often requiring no changes.
 
A common problem inexperienced programmers make is to embed their needs in the logic of the program. This approach may require modifying the code in more complicated applications. But typically requires more code and a typo can easily break the code. A better approach is instead of embedding the configuration as logic, it can be captured as data in the terms a railroader would understand.
 

Controlling, much less configuring the software of a complicated interlocking (below) can be daunting. Of course toggle switches and LEDs can be used but is tedious for an operator, especially one without experience. A modern version of a diode matrix using software makes aligning a route simple. But programming a processor to do this is challenging.
 
west_7-1-21.png
 
I believe the challenge for the programmer is to be able to represent the configuration in a table of data that doesn't require programming skills to read or modify.
 
For example, the following table entry describes a route selected when buttons x3 and c6 are pressed. The route requires that switch s63 and crossover x61 be reversed and crossovers x59, x57 and x54 be set normal.
 
    { Bx3, Bc6, { &s63r, &x61r, &x59n, &x57n, &x54n }},
 
Each switch is described by a ID, a switch position, N/R, corresponding bit value, 1/0, and Button switches are similarly described. Switch 63 is controlled by bit 2 on chip 1 and is reversed when its bit is set to 1. The ID and text string is used for debugging.
 
const PROGMEM SwMach_t s63r = { 63, R, 1, { 1, 2, "s63r" }};
 
The table for the interlocking above has ~60 routes. It is challenging just to get the table entries correct. Can you imagine what it would be like if code was involved?
 
No doubt some of this is tedious, but no more tedious than wiring it up.  (The initial wiring to test it and using a crude panel with buttons without LEDs)
 
DSC02441a.jpg
 
A big help when wiring is to drive panel LEDs from the switch machine that indicate the actual state of the turnouts, and not by the processor.
 
The above approach using tables could be used with different types of switch machines, even a mix by adding a  type  (e.g. Tortoise, servo) to the table entry and using different sub-functions for  MCP23017 and PCA9685 devices.
 
The software to manage the interlock using a table is not trivial but once written can be used elsewhere.
 
Final installation and panel
 
20220221_200448.jpg
 
westPnl.jpg

greg - LaVale, MD -- my layout   --  threads of interest

Reply 5
David Emery deemery2
I got this for my friend, who's a much better programmer than I'll ever be:
A13usaonutL._CLa|2140,2000|91EzxkjmuvL.png|0,0,2140,2000+0.0,0.0,2140..jpeg
 
His response was, "Yup, that's right."
 
dave
Modeling 1890s northeast US
Reply 8
Glenn Butcher ggbutcher
> I believe the challenge for the programmer is to be able to represent the configuration in a table of data that doesn't require
> programming skills to read or modify.
 
C/MRI and JMRI are fairly effective stabs at this.  I has amazed me how Bruce Chubb structured C/MRI software to do this with, of all things, Visual Basic code, also relying on well-written documentation to guide non-programming folk in modifying the code base to their particular use. JMRI has further abstracted things, you don't have to know any Java (thank God...) to configure complex interfaces AND logic.
 
I'm waiting, with some trepidation, to see things like, "Alexa, Emergency Stop.  Emergency Stop!  Alexa!!!!!!..... Dang."  😆
Reply 2
Alex Wood AlexW
What are those boards and where did you get them?

Modeling the modern era freelanced G&W Connecticut Northern

Reply 1
John P
I can see what Greg's boards are doing--a PIC processor, LM324 op amps each driving 2 Tortoise machines, 2 resistors to set the input voltage to one side of each op amp, 4 other resistors which set an address for serial communication with the PIC. All good stuff.
 
Here's a project that I worked on during the lockdown period a few years ago, an Android tablet running NX control of part of a freight yard. The layout is entered using a text format that combines graphic appearance and connectivity. Yes, it all has to be typed in, but I don't find that very burdensome. Not compared with building and wiring the actual layout! And yes, the NX feature is table-driven, not hard coded. Recursion is the One True Way. It works fine on the tablet, but I've never created an interface to the actual layout.
 
Reply 3
vasouthern
Im currently building CRMI based boards and helping several friends develope a signal system for their layouts. JMRI is my chosen route for the software and it is well supported and reliable.
 
The biggest challenge is helping others get the concepts of what is required to do signals. There must be feedback from the layout ( sensors ) before the controls mean anything. Train detection and turnout position is a must. Too many times modelers are too concerned about making it display signal aspects before getting the right info to make that logic work. Once the basics are covered, its honestly just input and output. Thats where the signal logic in JMRI makes it easier.
 
The other issue is there will be LOTS of wires. Thats also when keeping things simple and organized is a must. Just cut the red wire…..

Randy McKenzie
Virginia Southern - Ho triple decker 32x38

DCC++EX, JMRI, CMRI, Digitrax,  DIY Electronics
On Facebook:   http://www.facebook.com/groups/485922974770191/

Proto freelance merger of the CRR and Interstate

Based on the north end of the Clinchfield.

Author: MRH Article:  June 2014 issue Fast and Easy Trees.

Reply 2
greg ciurpita gregc
JMRI is my chosen route for the software and it is well supported and reliable.
can you describe how you describe signals in JMRI?
 
in this thread

greg - LaVale, MD -- my layout   --  threads of interest

Reply 1
kenheywood
I use Signal Mast Logic in JMRI implementing AAR-1946 (one of many available) signal standard. I use N3IX QuadLN_S hardware that translates JMRI signal aspects to LED signals and semaphore blade position. All I do is run the LED wire.
Reply 1
BR 218
Most modelers are not comfortable doing electrical wiring much less electronics and further still, programming. But the coding for many model railroad projects isn't really the problem, it's customizing it for a particular situation.
 
The biggest benefit of a software solution is that it is relatively easy to modify. Even if the processor is under the layout, a long enough USB cable can often be used to access the board, make and test the modification while working next to layout instead of crawling under the layout multiple times. It also encourages just trying something new because if it doesn't work out you can just reprogram it to the original code.
 
Another significant software benefit is that once the code is written, it can be re-used on many processors on the layout. However, what may need to change is the configuration, for example, if multiple turnouts need to be switched when using servos. Of course, generic groups of pins can be used on each Arduino for the turnout and panel switch pins often requiring no changes.
 
A common problem inexperienced programmers make is to embed their needs in the logic of the program. This approach may require modifying the code in more complicated applications. But typically requires more code and a typo can easily break the code. A better approach is instead of embedding the configuration as logic, it can be captured as data in the terms a railroader would understand.
 

Controlling, much less configuring the software of a complicated interlocking (below) can be daunting. Of course toggle switches and LEDs can be used but is tedious for an operator, especially one without experience. A modern version of a diode matrix using software makes aligning a route simple. But programming a processor to do this is challenging.
 
west_7-1-21.png
 
I believe the challenge for the programmer is to be able to represent the configuration in a table of data that doesn't require programming skills to read or modify.
 
For example, the following table entry describes a route selected when buttons x3 and c6 are pressed. The route requires that switch s63 and crossover x61 be reversed and crossovers x59, x57 and x54 be set normal.
 
  { Bx3, Bc6, { &s63r, &x61r, &x59n, &x57n, &x54n }},
 
Each switch is described by a ID, a switch position, N/R, corresponding bit value, 1/0, and Button switches are similarly described. Switch 63 is controlled by bit 2 on chip 1 and is reversed when its bit is set to 1. The ID and text string is used for debugging.
 
const PROGMEM SwMach_t s63r = { 63, R, 1, { 1, 2, "s63r" }};
 
The table for the interlocking above has ~60 routes. It is challenging just to get the table entries correct. Can you imagine what it would be like if code was involved?
 
No doubt some of this is tedious, but no more tedious than wiring it up. (The initial wiring to test it and using a crude panel with buttons without LEDs)
 
DSC02441a.jpg
 
A big help when wiring is to drive panel LEDs from the switch machine that indicate the actual state of the turnouts, and not by the processor.
 
The above approach using tables could be used with different types of switch machines, even a mix by adding a type (e.g. Tortoise, servo) to the table entry and using different sub-functions for MCP23017 and PCA9685 devices.
 
The software to manage the interlock using a table is not trivial but once written can be used elsewhere.
 
Final installation and panel
 
20220221_200448.jpg
 
westPnl.jpg
Hi Greg!
This is wonderful because then one always knows what will happen. But if you have a "dinosaur" analog control panel like mine you can loose sight after only a few weeks of not running the layout.
 
Please continue to tell us more!
 
Best wishes, Chuck
Schleswig - Holstein, Germany 👨🏻‍🌾🏡🐄🚜
Reply 1
vasouthern
can you describe how you describe signals in JMRI?
 
in this thread
Its a process of adding the signals to the correct output via the CMRI network ( Dr Chubbs system is fantastic ). Each output is added to a signal head, heads added to masts as needed. Then as Ken mentioned use the simple signal, use the signal style you desire, try the simple model railroad one to learn your way. Then for more”complicated” places, you can take the foundation and build.
Once you have block detection and turnout position sensors coming in, the simple logic solves most of the issues with aspects.
There are clinics online for using JMRI, as well as some good youtube videos on getting started.
It does require some time, a learning curve like everything else, and keep it simple.
How do you eat a elephant?, one bite at a time with ketchup.
Build a signal system one part at a time, skip the ketchup.

Randy McKenzie
Virginia Southern - Ho triple decker 32x38

DCC++EX, JMRI, CMRI, Digitrax,  DIY Electronics
On Facebook:   http://www.facebook.com/groups/485922974770191/

Proto freelance merger of the CRR and Interstate

Based on the north end of the Clinchfield.

Author: MRH Article:  June 2014 issue Fast and Easy Trees.

Reply 1
David Emery deemery2
rant:
As someone who wrote and particularly reviewed software for a living, one thing I continue to observe is how user-hostile common programming languages are.  A program is read many more times than it's written over the program's life, but we continue to use languages we believe that are "easy to write" rather than easy to read.  Add to that programming language syntax where common typos result in legal but incorrect programs ("&" vs "&&" as one example from C and similar languages), and it's no wonder we call it 'code.'  So if you're new to this and find all this 'code' hard to read, I feel your pain.
 
dave
Modeling 1890s northeast US
Reply 2
kenheywood
user-hostile common programming languages
Actually, JMRI Signal Mast Logic is generated automatically based upon signal placement on the layout diagram.
The diagram is "pick and drop".
No programming required.
Reply 1
greg ciurpita gregc
but we continue to use languages we believe that are "easy to write" rather than easy to read.
the purpose of this thread is to avoid the need for a modeler to look at any logic and only look at data that is organized in a way specific to the domain, in this case a list of switches and their position, Normal/Reversed, hiding (unless they look) the more cryptic code -- "no programming required".
 
don't believe this is that much different than using electronics with labels on the external connections or setting some configuration switches. Don't expect a user to understand the circuitry in the box.
 
as for the language, not sure what you think would be easier to read.  In many ways it's not dissimilar to descriptions of digital logic.     Compilers are getting better at making sure operators match the data types they're being applied to.    the logical AND, && should only be applied to booleans and bitwise AND, & to multi-bit variables.
 
"C" wasn't developed as a training language.  It was developed while UNIX was being developed to make it easier to write the operating system code by expert programmers.   It is well suited for embedded applications that manipulate hardware.  I often fail to state that the C Programming Language was written for developer alread proficient at programming.  In many ways it is simpler that other languages.

greg - LaVale, MD -- my layout   --  threads of interest

Reply 0
Jim at BSME
There are clinics online for using JMRI, as well as some good youtube videos on getting started.
There are also useless ones, I wish when people make these statements they would refer to ones they actually use and like. If someone found a particular clinic or youtube video very useful/informative it would be nice to point to the particular clinic/video. Even if you don't have a link to the clinic you could say the clinic given by X at the Y convention in hopes that someone else could actually find the clinic.
- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 1
barr_ceo
There are 3 things MRRs want from software:
 
1) Easy to use and modify for their specific wants / needs.
 
2) Runs on all OS's from MS DOS-Windows XXX, Apple 0S7 to Mac OSXX, and every possible flavor of Linux.
 
3) Open source, Supported with weekly updates, and free.
 
 
Pick any one.
 
I didn't say you'd GET, it, just "Pick one".
 
Who, Me? Cynical? Bah! 😎

Read my Journal / Blog...

!BARR_LO.GIF Freelanced N scale Class I   Digitrax & JMRI

 NRail  T-Trak Standards  T-Trak Wiki    My T-Trak Wiki Pages

Reply 2
vasouthern
There are also useless ones, I wish when people make these statements they would refer to ones they actually use and like. If someone found a particular clinic or youtube video very useful/informative it would be nice to point to the particular clinic/video. Even if you don't have a link to the clinic you could say the clinic given by X at the Y convention in hopes that someone else could actually find the clinic.
Search box is easy to use, what one person likes Im sure others wont.
As for suggestions, Toms Trains and Things has some to get people started.
The statement made was to help people see there is information available if they desire to go look.
Even poorly produced videos take effort and time, some people can teach and share, some people cant, but they at least tried.
Shame some people want to make useless comments too, highjacks threads away from the topic.

Randy McKenzie
Virginia Southern - Ho triple decker 32x38

DCC++EX, JMRI, CMRI, Digitrax,  DIY Electronics
On Facebook:   http://www.facebook.com/groups/485922974770191/

Proto freelance merger of the CRR and Interstate

Based on the north end of the Clinchfield.

Author: MRH Article:  June 2014 issue Fast and Easy Trees.

Reply 0
ednadolski
2) Runs on all OS's from MS DOS-Windows XXX, Apple 0S7 to Mac OSXX, and every possible flavor of Linux.
What, no Solaris?
 
(Sorry, is my ex-Sun bias showing again? 😃)
 
Ed
Reply 0
kenheywood
wish when people make these statements they would refer to ones they actually use and like
Well, I learned by following Bob Bucklew’s tutorial on JMRI signals that I link in my blog Control Points. He illustrates heads but I use masts (much easier).
Reply 1
YoHo
Yeah, JMRI is pretty straight forward if you go that route.
At least the pieces of it that I use.
 
I think the fundamental problem with signaling is:
 
1: there are so many ways to operate signaling that it is impossible to make a product that has no external programming and still covers a large set of likely implementations.
 
and
2: Digital logic is, in some sense how the prototype does it's job. That's how it works. If you want signals, you better learn about digital logic, because that's what they do.  
 
 
My big problem with solutions like the RR-circuits one I've been using is that it's SO generic to cover so many use cases, that the UI becomes cluttered.
 
The ways to fix that clutter would eat up CPU on the boards and require some pretty extensive JMRI support.
 
For example, it would be nice to be able to say click a radio button to say I want basic ABS and have all the unrelated functions disappear.
 
The core concept is simple, you have detectors that tell you if track is occupied or a switch is thrown. those generate unique IDs. You group LEDs into Signal masts and each aspect has a unique ID.
 
Then you have logic that relates the detectors to the LEDs.
 
If the Signal LCC board only had these 3 things on it, it would be simple, but it has a dozen other features to do other things. It's good it can do those things, but it makes it much harder to actually implement any one thing.
Reply 1
BR 218
the purpose of this thread is to avoid the need for a modeler to look at any logic and only look at data that is organized in a way specific to the domain, in this case a list of switches and their position, Normal/Reversed, hiding (unless they look) the more cryptic code -- "no programming required".
 
don't believe this is that much different than using electronics with labels on the external connections or setting some configuration switches. Don't expect a user to understand the circuitry in the box.
 
as for the language, not sure what you think would be easier to read.  In many ways it's not dissimilar to descriptions of digital logic.     Compilers are getting better at making sure operators match the data types they're being applied to.    the logical AND, && should only be applied to booleans and bitwise AND, & to multi-bit variables.
 
"C" wasn't developed as a training language.  It was developed while UNIX was being developed to make it easier to write the operating system code by expert programmers.   It is well suited for embedded applications that manipulate hardware.  I often fail to state that the C Programming Language was written for developer alread proficient at programming.  In many ways it is simpler that other languages.

Schleswig - Holstein, Germany 👨🏻‍🌾🏡🐄🚜
Reply 0
BR 218
the purpose of this thread is to avoid the need for a modeler to look at any logic and only look at data that is organized in a way specific to the domain, in this case a list of switches and their position, Normal/Reversed, hiding (unless they look) the more cryptic code -- "no programming required".
 
don't believe this is that much different than using electronics with labels on the external connections or setting some configuration switches. Don't expect a user to understand the circuitry in the box.
 
as for the language, not sure what you think would be easier to read.  In many ways it's not dissimilar to descriptions of digital logic.     Compilers are getting better at making sure operators match the data types they're being applied to.    the logical AND, && should only be applied to booleans and bitwise AND, & to multi-bit variables.
 
"C" wasn't developed as a training language.  It was developed while UNIX was being developed to make it easier to write the operating system code by expert programmers.   It is well suited for embedded applications that manipulate hardware.  I often fail to state that the C Programming Language was written for developer alread proficient at programming.  In many ways it is simpler that other languages.
I always liked working in C but the big hype over C++ annoyed me. In C all my functions & constants were clearly delcared at the top of my programs & were also easy to modify.
 
It was only stressfull if I forgot to link something or when the complier would flag a bunch of sytax errors or typos.
Chuck
Schleswig - Holstein, Germany 👨🏻‍🌾🏡🐄🚜
Reply 1
greg ciurpita gregc
what if you don't use JMRI?
 
i have another thread discussing ABS that similarly separates the logic from the description of the layout to describe the signal inputs, outputs, relationship between signals and which node drives the signal.  this information needs to be shared between all nodes to support APPROACH
 
somewhere down the road i envision incorporating turnouts to go beyond ABS

greg - LaVale, MD -- my layout   --  threads of interest

Reply 0
YoHo
Well, LCC only uses JMRI as a UI for configuration. It can do everything you're discussing without JMRI once set up.
Reply 0
Jim at BSME
Search box is easy to use, what one person likes Im sure others wont.
As for suggestions, Toms Trains and Things has some to get people started.
The statement made was to help people see there is information available if they desire to go look.
Even poorly produced videos take effort and time, some people can teach and share, some people cant, but they at least tried.
Ones taste can affect the effectiveness of the video, I don't like someone recording their computer screen by holding their cell phone and trying to type at the same time, but others may.
Search terms can make all the difference in the world finding a good/useful video, just because it is easy to type in a search box does not mean you'll get good results.
Understand that it takes time and effort to produce a video, but sorry to say some people should not, but their videos will come up in search results.
And why should I try to re-invent the wheel? If someone has already found useful videos/clinics why not mention them? Like you did in your reply about Toms Trains and Things, will check out his JRMI videos, hopefully he has some on Operations Pro, the ones I have found so far are excruciating to watch.
 
- Jim B.
Baltimore Society of Model Engineers, Estd. 1932
O & HO Scale model railroading
Check out BSME on: Facebook, Instagram
Reply 0
greg ciurpita gregc
As for suggestions, Toms Trains and Things has some to get people started.
why not provide links?

greg - LaVale, MD -- my layout   --  threads of interest

Reply 0
Reply