My solution to the problem has resulted in 3 2 processors to control/monitor the hardware directed by a laptop. 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 and 4 tri-color signals to control

  • Control
    • 4 trains.
    • 12 switches/turnouts.
    • 2 relays to reverse polarity on two sections of track.
  • Monitor
    • 32 sensors to detect the trains in the 16 blocks of track.
    • 4 sensors in the parking lot to detect parked trains.
    • 24 sensors to reflect cleared/thrown/unknown state of the 12 switches.
  • Control the aspect of signals
    • 56 52 semaphores on 28 26 dual headed poles.
    • 4 semaphores on 4 single headed poles.
    • 12 LEDs in 4 tri-color LED signals in the parking lot.


Unrelated to solving the problem we have added 6 4 LEDs to monitor communications between the four three computers in the system. Added a controlled fan to the Raspberry Pi 4 (3) and two 16X16 LED displays.

  • Traffic monitor 
    • 2 LEDs between the Arduino (2) and Raspberry Pi (3).
    • 2 LEDs between the Raspberry Pi (3) and Raspberry Pi (3A).
    • 2 LEDs between the Raspberry Pi (3A) and Laptop (4).
  • Fan Control
    • 1 push button to control fan mode Auto/Manual and On/Off in the manual mode.
    • 1 PWM output to control the fan.
  • Display 
    • On two 16X16 LED arrays:
      • Signal aspect in lieu of back ordered signals.
      • Fan status and relative processor temperature.
    • On 3.5" DSI touch screen:
      • Randomize path assignment/selection.
      • Display path/train assignment during run.


The Arduino Maga (2) IO pins were quickly used up controlling the Arduino Motor Shield to develop the DCC signals, monitoring the 36 sensors embedded in the track and controlling 2 relays reversing the signal to two track blocks. The Arduino uses the DCC signal to control the 4 trains and the 12 switches/turnouts.


The first Raspberry Pi 4 (3) uses 24 27 of the 28 GPIO pins:

  • 2 GPIO pins, I2C, (Inter-Integrated Circuit), interface, to control the 4 PWM add-on boards providing:.
    • 60 PWM outputs to control servos for the semaphores.
    • 1 PWM output to control the fan.
    • (3 PWM outputs not used.)
    • Added IO Pi HAT which provides 32 IO pins to monitor the state of the 12 turnouts (24 pins).
  • 12 GPIO pins controlling the 12 LEDs in the 4 tri-color or dwarf signals
  • 4 GPIO pins controlling LEDs reflecting computer traffic.
  • 1 GPIO pin for the fan control push button.
  • 5 GPIO pins, SPI0 interface, to control the two 16X16 Unicorn HAT HD displaying signal aspects.
  • 3 GPIO pins, inputs to monitor 3 interrupts from the IO Pi board.


The second Raspberry Pi 3B+ (3A) uses 26 of the 28 GPIO pins:

  • 24 pins to monitor the two states of the 12 switches
  • 2 pins to control :LEDs reflecting computer traffic.


The Laptop provides the user interface to the system, controls the process by sending commands to the three two micro-processors and receiving status from the three two processors.