I've been working on an Arduino-based project that controls my trains via Legacy, very much as Professor Chaos has done. As Rudy says, you'll need an SER2 but the programming is pretty easy and Prof Chaos has been kind enough to share what he has done to help you get started.
To send Legacy commands, you'll need the Legacy spec which requires (or used to require?) becoming an LCS Partner -- which is simple enough but you'll need to sign an NDA.
Here are the videos that Professor Chaos made that really inspired me on this project: https://www.youtube.com/channe...1UcTotGFTEih-nNVzL_w
I'm using 7 Arduino Megas, and my software monitors the location of all trains, throws turnouts, reserves and releases sections of track, blows the whistle, makes announcements, control accessories, and slowly accelerates and decelerates each train as it departs and arrives. I've provided more detail in other posts, so if you're interested you might search my older posts.