This section of the documentation describes each major design element and its significant segments. The intent is to have all the design objectives, considerations and implementation in one place. Where useful, links to other relevant sections of the documentation are included. This should avoid saying the same thing twice or presenting conflicting information or the need for a scavenger hunt to find design details.

The problem, control trains running around a track, is a process control problem which needs to control some things and receive information about changes in the state of the system. i.e. where the trains are, whether the switches/turnouts are cleared or thrown or in between and polarity of power to two blocks of track. This has resulted in 18 things to control and 60 sensors to monitor. Adding the "may have" signals there are an additional 60 56 semaphore signals, 4 tri-color signals and the color of 64 LEDs to control. See Interface Analysis for more details.

In addition there are three "because I can" functions:

  1. Monitor the traffic between the 3 processors; commands from the Laptop (4) & status returned to the Laptop, and traffic between the Raspberry Pi and Arduino.
  2. Suggest randomly assigned paths for each train and which trains to run. For reference display on the layout the assigned paths for each run of TrainThing.
  3. Control a cooling fan for the Raspberry Pi 4 based on CPU temperature and display the temperature and fan status.

In the following outline of this section the numbers refer to the numbers given to major elements in the Design section above.

  • 1. Layout
    • Track
    • Two reversible track blocks
    • Power distribution
    • Switches/turnouts 
    • IR sensor
    • Signals
  • 2. Arduino
    • DCC++ Base Station Software
      • Control the trains
      • Control switches/turnouts
    • IR sensor monitor
    • Reversing relay control
  • 3. Raspberry Pi 4
    • Signal management between Laptop (4) and Arduino (2).
    • Process Signal control commands from the Lap Top (4) & return status.
    • Control the 60 (56) semaphore servos/signals.
    • Control the 4 tri-color LED signals.
    • Display all 64 signal aspects on two Unicorn HAT HD LED arrays.
    • Control Raspberry Pi 4 Fan custom board.
    • Display Fan status on Unicorn HAT.
    • Traffic Monitor LEDs: to/from Arduino and to/from the Laptop.
    • Added
      • Process switch/turnout status commands from the Lap Top (4) and return status.
      • Monitor/Report status of the switches on the Layout (1).
      • Delay reporting status to mirror transit time of switches.
      • Randomize Route Selection/display.
  • 3A. Raspberry Pi 3 (deleted. Added to (3) above)
    • Signal management between Lap Top (4) and Raspberry Pi 4 (3).
    • Process switch status commands from the Lap Top (4) and return status.
    • Monitor/Report status of the switches on the Layout (1).
    • Delay reporting status to mirror transit time of switches.
    • Traffic monitor LEDs: to/from Laptop.
    • Randomize Route Selection/display.
  • 4. Laptop
    • Configure TrainThing Hardware
      • Configure Wabbits that control switches, part of the layout (1).
      • Configure Arduino (2):
        • IR Sensor Inputs.
        • Relay Control Outputs.
        • Train Addressing.
      • Configure Raspberry Pi 4 (3):
        • Semaphore signal to Servo address.
        • Semaphore signal aspect to servo angle.
        • semaphore signal to Unicorn X,Y coordinates.
      • Configure Raspberry Pi 3 (3A)
        • Associate turnout sensor ID with Raspberry Pi GPIO pin.
    • GUI to setup TrainThing run
      • Configure Graphic display.
      • Assign routes to trains.
    • Graphic display of TrainThing Status.
    • Run TrainThing.
    • GUI to end TrainThing run.