Okay, well either explanation will be great for me -- just set up the trains on my CAB-2 (with the engines on the track, presumably) and issue simple "train" commands from the Arduino, and Legacy takes care of the rest. Perfect! Thanks for your thoughts.
I have what I think are some pretty great solutions for tracking occupancy, setting turnouts, and other hardware control that will be needed on my Arduino-controlled automatic train layout. If you have any interest in this idea, please continue reading and let me know what you think...
For occupancy, I found these great 15VAC time-delay relays on eBay. I have chosen 15VAC with 0 to 5 seconds delay, but they are available in a variety of coil voltages and delay ranges. I can trip them with short isolated rail sections and 15VAC hot. I figure I'll set them at around 2 seconds and this will eliminate any potential "chatter" due to problems with wheels not making a perfect connection as they bridge the isolated rail, or long cars that could momentarily bridge the isolated section. I tested one and just an instantaneous tap of power to the coil closes the contacts and holds them for the specified time - the capacitor charges quickly! So when the relay releases, I can be pretty confident that the train has left the isolated section.
I also don't have to worry about contact bounce, because I'm going to be wiring the relay contacts to the input pins of a Parallel In Serial Out register (actually a bunch of them chained together) and simply poll them fairly frequently. So if a contact is bouncing when the input pin is latched -- no big deal, I'll catch it in another moment when I poll it again. I hope that makes sense.
These relays may seem like overkill because they close huge contacts which only need to provide a TTL-level signal to the shift register pins, but what I like about them is they really solve a lot of problems, they're self contained, and are only around $7 each including shipping. I don't even need to add bridge rectifiers!
I'll be glad to fill in more details for anyone who wants to know more, but that's the gist of it.
For turnout control, I've decided to use a gang of Serial In Parallel Out shift registers controlling an opto-isolated 5vdc bank of relays, available on eBay for less than $1 per relay on boards of 8. The relay coils can be powered independently, so the shift register pins are only powering the optos. The contacts will energize the switch machine coils with 14VAC.
I'll program the Arduino to just set one register bit at a time -- throw that particular coil, then set them all to zero to release that coil (all coils.) By holding the coil for only perhaps .1 second, I'll avoid burning out any switch machines, and never throw more than one machine simultaneously.
For routes, I'll just repeat the process for all of the switches in the route -- only triggering one switch at a time, but getting through them all very quickly.
I am also thinking I can avoid the need for the Atlas 6924 non-derail boards (which I would use as a "non coil fry" device) by wiring Atlas #57 turnout control buttons to my Arduino rather than to a 6924 or directly to switch machines. I won't have a non-derail feature, but I can easily implement one if I want to look at my occupation sensors at the entrances to turnouts -- even when the layout is not in "Automatic" mode.
Because Arduinos only cost around $10 each on eBay, I think I'm going to dedicate individual Arduinos to some tasks, such as monitoring the occupancy sensors, and managing turnouts/routes/switch controls -- even when not running my trains in "automatic" mode. I may also dedicate an Arduino to being the sole interface to Legacy via the RS232 serial port -- and let that Arduino build and disassemble TMCC (and eventually Legacy) commands to and from the rest of my automation system -- so only that one Arduino has to "know" how to do this.
Inter-Arduino communication could be via the I2C "two wire" bus, and could even allow for features that may be implemented in the future -- such as conditional requests to turn on accessories or stop the train momentarily or blow horns or whatever, when certain trains (or classes of trains) entered or left specific blocks. There are so many possibilities!
I can also add Arduino-based boards to control accessories, manage all of the signals, and other fun things that have not yet occurred to me ;-)
The turnout/route control Arduino and others will totally negate the need for Lionel's SC-2, ASC, etc. as well as the Atlas 6924 boards. They will be better for my purposes and cost *significantly* less than the commercial products. Even when in "manual" mode, the system will watch for switch and route and accessory commands from the CAB-2, and turnout "commands" from Atlas #57 control boxes, and respond accordingly. All of the hardware is really inexpensive and basically "off the shelf" -- no need for any custom circuitry, other than stringing shift registers together.
Sorry if that's confusing -- I have a ton of notes and test results that I am bringing together into an Evernote-based design document. And none of this has even touched on the algorithm I'm working on which will automatically control multiple trains and (hopefully) avoid collisions and deadlocks. But these are some hardware highlights of what I hope to do, and I wanted to share my thoughts with you guys (and gals?). I welcome any feedback you may have of what I may be overlooking etc., and am happy to compare notes with anyone working on similar projects. Lots of my early ideas and assumptions turned out to be wrong, and probably some of the above may be as well.
Thanks gunrunnerjohn and others for your helpful advice. Above all, I want to thank Professor Chaos for inspiring me to dive into this project, and for sharing his source code and hardware designs and ideas so freely. Have a look at his YouTube videos and you might see why I am so enthusiastic about this. Lots of fun!