One thing I do besides build & operate railroads is mess around with Arduinos. These are small low-cost low-power computers that are really good for messing around with.
I’ve designed an add-on board called the cpShield, which is meant to make the Arduino into a general I/O board, mainly for use as a part of a CMRI network for model railroads. The cpShield has 16 general I/O lines, and can control a single stall motor (such as a Tortoise) or two servos.
There’s also an I2C connection for adding additional boards. There are 16 and 32 I/O line boards called the IOX16 & IOX32 that I have used.
I’ve also written code for turning this into a node on a CMRI network.
There’s a library called IOLine, which generalizes the notion of an input or output line between the Arduino pins, the IOX extender boards (which do the same thing, but with a different code interface), or internal variables.
There’s another to provide a decent interface to the IOX extender boards, which use an MCP23017 I2C chip. The library is quite unoriginally called MCP23017.
Lastly, there’s code to implement the node side of a CMRI network. You still need driver software on a central computer to run the network.
I’ve spent the last few evenings making lights blink with the Arduinos, and have recently updated the code out on Github.
Go, have fun with it