I have an IR pair for over 100m made with 12F series PIC. Sorry I cannot publish the code as this is a commercial product. But for 2Km, you may need many pairs.

PM me for any more infos.

Ioannis