I have a couple of electric Lego Duplo trains which I want to make more intelligent. Like remote control, collision/stall detection and the ability to work together to pull more load. For the inter locomotive communication I’ll use IR transceivers at the front and back. To keep it simple the IR beam is not modulated and is connected to an UART. (one UART for the front and one for the back of the locomotive). I have tested a receiver circuit using a photodiode and a phototransistor. The phototransistor circuit is the most simple and worked well with a range over 30 CM which is enough. a baudrate of 1200 work best, with 2400 and 4800 baud the range was decreased.
This circuit can also be used with an Arduino. The IR LED and IR phototransistor pairs are sold on ebay.