Building & engineering time: 1 month
This is my first train automation project. It contains four train loops with one big crossing.
The passenger trains (7745 and 7755) stop automatically at the station every third time they pass it. Analog IR sensors register when a train passes the sensor (see image of the layout below). The controller simply counts how many times the passenger train has passed the sensor. At the third time, the controller makes the passenger train stop at the station by disabling the track. After a delay the controller makes the train leave the station by powering up the track again. This is done with a PWM-signal (Pulse Width Modulation) and this makes the train start not directly at full speed. If that were the case, the locomotive would speed away, leaving the wagons behind (with angry passengers as a result).
Crossing & freight trains
The freight trains stop automatically in case the crossing is occupied. When the 7745 passenger train nears the crossing, the power will be taken off the isolated sections (see image of the layout below). The system knows when the train is nearing the crossing by polling the value of the distance senor. The power is put back on once the 7745 passenger train has crossed the crossing again. This means that when the passenger train is on the upper side of the crossing, the freight trains stop on the isolated part because it is disabled by the system.
Image of the layout