I'm going to use a stripped down simple version. I have IR detection working at a four foot distance. I'm going to aim down the track and trigger the crossing when anything is inside that block.
Imagine two detection beams running down the track, each opposite directions from the crossing with an overlap across the crossing. This involves two IR LED's and two detectors, and one LM358 dual op amp. There also would be a couple transistors and a 555 timer for the flasher. I plan on one flashing timer for all crossings to save hardware.
Whatever beam is broken first has control. The last car would have to clear that area to turn the lights off. This starts it early as the train approaches, and shuts it off after the last car clears the crossing. The second beam, covering the large distance away from the crossing as the train has passed the crossing, would just be ignored. It also works on a back-out. I just have to back out enough to clear the initial triggering point.
Because I don't have DCC, and I'm using old controls, I know the train direction by knowing the polarity across the rails. This is what I am planning on initially using to determine which area detector to use. With DCC I'd have to either somehow know the direction, or use a little simple logic system to know which way the train is coming from.
I don't think it is too tough.
Tom