For Chapter 6 of my book, Arduino and LEGO Projects, I built an IR controller that could control a LEGO train.