Model Railroad System
2.2.2
|
This example illustrates how one might implement the control aspects of a simple interchange between two rail lines that meet at a level crossing.
The layout module is shown here:
We will control the two turnouts with a SMCSenseHAT. This board uses 4 GPIO pins on the Raspberry Pi, two to set the motors and two to sense the state of the switch motors.
Signaling will be with 8 three color single head signals and with 2 3 over 2 double head signals at the point entrance to the turnouts. There is a total of twelve heads and we will use three QuadSignalCA HATs and common anode LED signals.
We will be sensing occupancy of 8 blocks:
We can use a pair of Circuits 4 Tracks Quad Occupancy detector boards, with their outputs wired to 8 of the Raspberry Pi's GPIO pins.
We will have a total of 5 HAT boards:
The SMCSenseHAT is hardwired to use Wiring Pi pins 0, 1, 2, and 3 (BCM pins 17, 18, 27, and 22). The PiGPIO XML file included with this example, maps Motor 1 (pin 0 for motor control and pin 2 for point sense) to SW1 and motor 2 (pin 1 for motor control and pin 3 for point sense) to SW2.
The SMCSenseHAT is connected as shown here:
The Adafruit Perma-Proto HAT is wired as shown below. The only components installed on this board are a pair of 6 position screw terminals. It is possible to use a board that simply has screw terminals for the GPIO pins (like the Adafruit Pi-EzConnect Terminal Block Breakout HAT) instead of wiring up a board like this. The PiGPIO XML file included with this example maps the GPIO pins like this:
This is how the GPIOs are wired:
The QuadSignal XML files included with this example maps the signals like this:
This is how the QuadSignalCA HATs are wired (be sure to take note of the address jumpers):
This example uses these 3 OpenLCB daemons:
This example also uses a CTC panel created by the Dispatcher program.
Each deamon instance's configuration is taken from an XML file (included in this example's distribution directory) and the CTC panel exists as a Tcl/Tk source file (which is also included in this example's distribution directory).