The Raspberry Pi 4 stack of HATs, Bonnets and custom boards starts with the Raspberry Pi 4 and Rainbow Pibow Coupé 4 case.

Raspberry Pi 4 and case

The fan and custom board, version 2, sets on top of the case, against the 2x20 header and held in place by the screw in the lower left corner. The lose connector is plugged into the 16-channel PWM/Servo HAT that goes on next. Version 2 of the fan board makes room for the DSI ribbon cable on the left.

Raspberry Pi 4 with fan added

The 16-Channel PWM/Servo HAT is mounted above the fan board. In the middle of the HAT are 6 addressing pads used to distinguish this board from other boards using the I2C interface on the Raspberry Pi. None of the pads are soldered/shorted here therefore, address 0.

16 3-pin connectors across the front of the PWM/Servo HAT are the 16 PWM outputs and 5vdc. The control and 5vdc on the first connector on the left are used to control the fan (the brown/black/white cable). The others control servos to drive semaphores. 

On the right edge of the (blue) board are connectors for 1) 4 traffic monitor LEDs, 2) 4 tri-color LED signals and 3) a push-button to control the fan. For details see 16-Channel PWM/Servo HAT.

On the left edge are two black connectors for 5vdc to drive the servos connected to the system. This 5vdc is separate from the 5vdc used by the Raspberry Pi and on the 2x20 pin header. The plug is used to input 5vdc and the terminal block is used to daisy-chain the voltage to the IO Pi Plus HAT and PWM/Servo Bonnets that are next in the stack (red & black wires).

Raspberry Pi 4 with Servo/PWM HAT on top

The IO Pi Plus HAT is next receiving external 5vdc from the PWM/Servo HAT below. The external 5vdc provides power for the 32 IO pins added to the Raspberry Pi system by this HAT. The 32 IO pins are connected to two connectors each with a I2C buss address, in this case 4 and 5 as determined by the two sets of addressing pads on the upper left of the board.

Each 20 pin connector makes 5vdc, ground, 16 IO pins and 2 interrupts available. Each interrupt can monitor 8 of the IO pins on the plug for status changes. We will connect the interrupts to the Unicorn board on top of the stack connecting to Raspberry Pi pins to alert software to process changes in the input pins.

The IO Pi Plus HAT was added to the Raspberry Pi 4 (3) stack to provide inputs for the status of the turnouts and it eliminates the need for the second Raspberry Pi (3A).

IO Pi Plus adds 32 IO pins to the Pi

The first of three 16-Channel PWM / Servo Bonnets is connected to the raspberry Pi 2x20 header next. The Bonnets have the same functionality as the 16-channel PWM/Servo HAT, capable of controlling 16 servos. The bonnets do not have the modification area on the right side as does the HAT. Notice the 6 addressing pads middle right of the bonnet. In this case the low order bit, A0, is shorted for address 1 on the I2C bus. 5vdc is linked up from the IO Pi HAT by the red/black wires on the left. 

Raspberry Pi 4 stack with first Servo Bonnet added

Next in the stack are the second and third Servo Bonnets. They are addressed 2 and 3 using the 6 addressing pads. That provides control for a total of 64 (16x4) PWM/servos, 61 we were going to use. That is 1 for the fan and 60 for the semaphores (now just 56). Again the red & black wires on the left connect the external 5vdc to drive the attached servos. 

Raspberry Pi 4 stack with second Servo Bonnet addedRaspberry Pi 4 stack with third Servo Bonnet added

Finely an interface board is on top of the stack to connect to the two Unicorn displays. The 12-pin header brings out 3v3dc(1), 5vdc(2), grounds(3) and SPI interface(5) pins. 

Four 5vdc interrupt lines from the IO Pi HAT are brought up and connected to four 3v3dc Raspberry Pi GPIO pins through voltage dividers. This make the IO Pi interrupts accessible as interrupts to the software running on the Raspberry Pi.Boaed to connect Unicorns and IO Pi interrups