Model train crossing signals

After you mentioned opto isolators earlier, I already decided to go that way, 4N36 probably.