I want to use an Arduino to send TMCC commands to my various TMCC engines, just like I can with my TMCC handheld controller. Emulate my TMCC controller with an Arduino. How do I get the TMCC RF parts to do this? Cannibalize an existing TMCC controller? Anyone tried to do this?
Replies sorted oldest to newest
That sounds interesting as well. First project is to sense input from two I/R sensors, compute scale speed, and output it to a 3 digit 7-segment display. Fun stuff!
Both these ideas can be realized by connecting an Arduino to the DB9 serial port of a Base-1, Base-1L or Legacy Base. The TMCC and Legacy command specification is freely available. Note that to work with the full Legacy command set, an LCS SRE2 module is required. The SER2 is compatible with the Legacy and Base-1L, but not the original Trainmaster/Base-1 command base.
get the spec here: http://www.lionel.com/lcs/LCSP...er/styled/index.html
I thought that the DB9 port only allowed the TMCC base unit to talk to the TMCC controllers (ASC, BPC, etc.) but not to the engines via RF. I want to be able to communicate with the engines via the Arduino. Maybe I need to use the third wire that the Action Recorder uses. Can you send me a link to a TMCC spec that might explain all this?
OK, I see the spec now! I can control an engine from the DB9 port. Thanks! Wonder if anyone has done this with an Arduino or do I write my own code?
The DB9 port on the Base unit is also an input that will accept any commands in the proper format. I've been doing that for 20 years with PIC based circuitry.
You might also want to check out my Windows and Android TMCC/Legacy/LCS software. Click on the links in my signature below for more information. Please let me know if you have any questions.
Thanks, Harvy, I'll check it out. But I need to slow the TMCC trains based on conditions on the layout, not from my Android phone. But the smartphone software would be neat as well.
Check out a previous post.
New life for a ECU-1 Train Control Transmitter
It is able to control any TMCC command.
Hi Don - it's pretty easy to read and write TMCC or Legacy commands to and from the command base serial ports. As Rudy mentioned, a SER2 is the most convenient way to go. Do keep in mind that the earth ground (ground for the command base) is supposed to be isolated from layout common (outside rail).
If you take a look at this link, you can find some of my Arduino projects. "Train Control" is a very complex system that automates train control, controls switches, signals, and accessories, and communicates with JMRI running on a computer. But you will find examples of how to send TMCC, Legacy, and DCS commands over the Arduino serial port.
"Uncoupler Monitor" is a much simpler program that listens to the serial stream from the command base, and activates a relay module in response to commands directed to ACC 1-8. Essentially a cheap and customizable version of the ASC.
For layout control I like the Arduino Mega, because it has four hardware serial ports. For accessories like the uncoupler monitor I like the Arduino Pro Mini, which is very small and costs less than $10. I am fiddling with transmitting commands from the Legacy base to HC-12 radio modules, with Arduino Minis in rolling stock picking up the radio commands (like a cheap and customizable Mini Commander).
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.
Attachments
You do not need to be a LCS Partner to get the Legacy Spec. The TMCC and Legacy Specs are available in one document on Lionel's LCS page. Now to get the the specs for all of the LCS modules and the format of the commands on the LCS bus, you will need to be an LCS Partner. But if you just want to send Legacy commands you do not need to know anything about LCS, but you will need a SER2. The SER2 is the only thing that will accept Legacy formated commands. If you want to send them over wifi and use the LCS Wi-Fi module, then you will need to become an LCS Partner, like myself.
Harvy is exactly right. There has NEVER been an NDA requirement to get a copy of the Legacy spec and the TMCC commands have ALWAYS been available (they are published in the original CAB1/BASE1 manual).
Since I'll only be talking to the TMCC Base Unit I think that I only need the TMCC command subset, so I don't think I need any specific Legacy information. I think I have the codes I need but a link to an on-line copy of the original TMCC CAB1/BASE1 manual would be helpful.
If you are only going to use TMCC commands and not Legacy, then you don't even need a SER2. You can connect directly to the Base-1's DB9 serial port. In fact, I don't think it would work if you went through a SER2. If you did I don't think the Base-1 would be able to recognize the commands. As far as I know the Base-1 can only recognize native TMCC commands, and that would not be what it would be receiving if you went through a SER2. I don't think any LCS module would work with the Base-1. Rudy can confirn that.
If you have a hard copy of the TMCC manual, then you have everything you need. If you prefer an online copy you can search for it on Lionel's site under "Support". I don't think the manual has ever changed though.
I just downloaded the original TMCC manual from Lionel. I have attached it here.
Attachments
Harvy posted:If you are only going to use TMCC commands and not Legacy, then you don't even need a SER2. You can connect directly to the Base-1's DB9 serial port. In fact, I don't think it would work if you went through a SER2. If you did I don't think the Base-1 would be able to recognize the commands. As far as I know the Base-1 can only recognize native TMCC commands, and that would not be what it would be receiving if you went through a SER2.. I don't think any LCS module would work with the Base-1. Rudy can confirn that.
Correct, the original Base1 aka Trainmaster Command System is not compatible with and of the Layout Control System/LCS modules. Base1L and Base2 aka 990 Legacy Control System will both work with all LCS modules.
Based on the original poster's needs, no SER2 required.
Thanks Harvy for the link to the TMCC Manual. It has the general TMCC info that I already know. Now I need to know the protocol for talking from the Arduino to the DB9 port on the TMCC Base Unit. Where can I get that additional level of detail?
Don Furgerson posted:Thanks Harvy for the link to the TMCC Manual. It has the general TMCC info that I already know. Now I need to know the protocol for talking from the Arduino to the DB9 port on the TMCC Base Unit. Where can I get that additional level of detail?
All of the information is in the attachment starting on page 36. Let me know if you need help deciphering it.
Don, the documentation for the protocol is here.
If you look in my Train Control program under the _interface tab, you will see routines for transmitting TMCC and the various kinds of Legacy commands.
I find it useful to have all the routines deposit commands in a circular buffer; another routine called from loop() sends commands out the serial port if at least 30 milliseconds have elapsed since the last command sent.