Model trains pick up electrical power from the ... The build uses an available Arduino library, so if you want to get into the protocol you’ll have to work through that code.
The recommended input for most Arduino models when powered via non-USB means is 7 to 12V, with a limit of 20V. It's always a good idea to read the specification sheet, though, just to make sure.
The Arduino Mega is a useful tool for the maker. Generally, once one has come up with plans for blinking LEDs that require more IO than is available on the Arduino Uno, one graduates to the Mega ...