9 - 15 Mar
The JMRI software packages which interfaces/drives the DCC++ Base Station, is written in Java and Jython, a Java implementation of Python. So, adding Jython scripts to the JMRI may be an easy way to drive the hardware from the PC. This also may be a way to incorporate existing Raspberry Pi libraries (in Python) into a Java event driven Raspberry Pi program.
Getting Jython scripts to actually make a train run, control turnouts and monitor sensors is not intuitively obvious to this casual observer. But I am getting examples to work. Part of my problem may be the difference between what the JMRI designer's interest/intentions were and what I want Train Thing to do.
When I get something simple running, I see a video in the future. Another steep learning curve!
Knowledge is dangerous! Looking at JMRI I notice they use "feedback" from turnouts (switches) to know what state each turnout is in. This is feedback from the turnout/controller or something vs just waiting some time and assuming that the turnout is in the new position. This is an issue I was worrying about in the Design Considerations. The 2 switches inside the Tortoise close somewhere between when the motor stalls out with the turnout fully THROWN or CLEARED. I can see this by watching the turnout and the red/green LED connected to one of the Tortoise switches, the light changes way before the turnout/Tortoise stops moving.
Enter the idle mind (A drive to Durango and back). Why not build a bracket to hold two small reed switches and attach a small magnet to the moving part of the Tortoise? Parts are ordered. The only problem is where to attach 24 inputs from the 24 switches/sensors to get the information into the system? (1 input for clear, 1 input for thrown for each of 12 turnouts). The Arduino Maga is already loaded with the 36 block sensors, 2 relay controls and pins used with the Motor Shield. The current Raspberry Pi is also full with 12 LEDs for the 4 short 3-LED signals, a fan button, I2C & SPI interfaces for the Unicorn display and 60 servos. A second Raspberry Pi, with 28 GPIO pins, can accept the needed 24 new sensors to report the state of the turnouts. This new Raspberry Pi can reuse some of the first Raspberry Pi's communication software. See changes in the Design, Phase II, new Raspberry Pi (3A), and Turnout Sensor Commands