Introducing DCC++ ---a complete open-source DCC station and interface

Gregg Aug 25, 2015

  1. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Steve, can you provide the list of errors you are receiving? You are correct that you should be running this in the Processing IDE (the latest version, which is 3.0.1), but I import some other libraries that may require Java to be installed on the computer as well. I had always assumed all the libraries would be included with Processing, but perhaps that's a bad assumption. Scott seems to have had good luck with Java installed as well, and I have Java installed on all of my machines (probably couldn't delete it if I wanted to!)

    - Gregg
     
  2. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Gregg ....... Please excuse my last (yes I do have Java installed).......It was late last night after a dinner party and I was anxious to get it to work. This morning with a clear head and a thorough reading .... I have achieved full operation and functionality (n scale )....... my sincere thanks for your very professional instruction in getting us into this project as well as your patience in walking us through to fruition. Again, Thank you.
    Steve
     
  3. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Steve - that's great! Glad to hear it's all working. Please let me know if you have any questions once you start customizing the interface.
     
  4. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Gregg, New wrinkle ....... after everything worked (on my desktop Win 10 box) I grabbed an old Win 7 laptop (for portable use) and installed everything but it wouldn't handle Process 3 so DLed Process 2 ....... when I open the sketch I get a very small window showing just the upper left quadrant of the display, which can not be maximized or enlarged with the cursor ........ I looked at void display in the core components tab but I am not sure if that is where the main display is configured ...... how can I configure the main display window to enable using the cursor to enlarge the window?
     
  5. papahnash

    papahnash TrainBoard Member

    337
    69
    17
    Gregg,
    I downloaded and installed BaseStation in the Arduino. I brought up the serial window and typed <s> and got the return with the build date and a number of H values.
    In my tablet Windows 8 32 bit I installed Processing3 and downloaded controller, unzipped it in the Processing3 library. I am able to run the controller in the emulator but when I attempt to select com 4 where the Arduino is attached, I get the message "DCCpp_Controller (Not Responding)." When I try to close the program I get this message:
    "Java(TM) Platform SE binary is not responding."
    When I close back to the Processing3 screen the tab serialComponents is up showing and the line #101 saveXML(dccStatusXML,STATUS_FILE);
    In a red line under that is: Couldn't create a writer for C:\....
    I must have missed something but I don't know what.
    Thanks for all you have done and continue to do.

    Harold
     
    Last edited: Nov 1, 2015
  6. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Steve, the folks at Processing changed the way the size of the screen is called between version 2 and version 3. In version 2, the size is set by the size() command in the first line after setup(). In version 3, size() cannot take variables (even if static) if called from within setup() but it can be called from within a new Processing 3 subclass function called settings(). Since I'm now using Processing 3 I moved the size() command into the new settings() section. You just need to move it back to below the setup() section as follows:

    Starting in line 92 of DCCpp_Controller.pde under Processing 3:
    Code:
    //////////////////////////////////////////////////////////////////////////
    
    void settings(){
      size(SCREEN_WIDTH,SCREEN_HEIGHT);
    }
    
    //////////////////////////////////////////////////////////////////////////
    
    void setup(){
      Initialize();
    }
    
    //////////////////////////////////////////////////////////////////////////
    For Processing 2, move the size() command to directly under setup() and BEFORE Initialize():
    Code:
    //////////////////////////////////////////////////////////////////////////
    
    void setup(){
      size(SCREEN_WIDTH,SCREEN_HEIGHT);
      Initialize();
    }
    
    //////////////////////////////////////////////////////////////////////////
    Also, since the settings() function is now completely empty, you can delete it entirely.

    Note that SCREEN_WIDTH and SCREEN_HEIGHT are both variables defined near the beginning of DCCpp_Controller.pde. Feel free to change these as you begin to customize the interface to match your own layout, routes, etc. You can even create multiple throttles if you'd like (each with its own set of cab buttons).

    Hope this helps!

    -Gregg
     
  7. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Harold, it sounds like this is a Processing error message rather than a DCC++ error message (which should have said something like "Base Station Busy" or "Not Found." Since you are able to connect to the Arduino using the Serial Window and it's responding correctly, that means it's configured properly. I do know that the Serial communication mechanism within Processing has undergone a lot of revisions and in version 3 a new library was deployed. I'm wondering if this is an issue with Processing and Windows 8 on a tablet? Do you have a desktop you can try this on (Windows or Mac?). Also, I've only tested the system's new serial libraries under the 64-bit version of Processing --- perhaps this is a 32-bit compatibility problem? The Processing Forum may have some info (I know they are working on a number of bug-fixes). If all else fails you may want to try running Processing 2 to see if that works.

    -Gregg
     
  8. papahnash

    papahnash TrainBoard Member

    337
    69
    17
    Gregg, loaded it onto my laptop with Windows 7, 64-bit. Same problem. Loaded up Processing2 and encountered the same problem Steve had with screen size. Haven't had time to enter your code fix it yet. Going out of town tomorrow so I'll work on it when I return.
    Thanks.

    Harold
     
  9. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    That worked like a dream ....... my next project is code an "Inputbox" to accept a cab # into a throttle to facilitate adding an engine without having to go into/changing the actual coding. As I analyze the coding, I am truly amazed at the amount of work you have put into this and the sophistication of the entire project. I am not sure I have the patience to draw a track diagram ... it must have been tedious to say the least ...... but envious of your abilities I may just give it a try....... :)
    Steve
     
    papahnash likes this.
  10. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Hey, I might be interested in working on the JMRI plug-in... can one of y'all point me to the interface spec for the board?

    ETA: Nevermind. I found the documentation. I've already started on a command station interface module for JMRI for this... it will (I hope) be an interesting project...
     
    Last edited: Nov 2, 2015
    papahnash likes this.
  11. esfeld

    esfeld TrainBoard Member

    442
    382
    17
  12. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
  13. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Steve, glad to hear it's working under Processing 2. Your inputBox to set the cabs would be a terrific addition. Might be able to incorporate it into the XML status file as well so it gets saved between sessions.

    Also, it's actually much easier than it might appear to create the track layout. You only need to anchor the layout with one track. Then everything else is connected to another track. There are only two types of tracks - curved and straight. Turnouts and crossovers are drawn as individual straights and curves that just happen to overlap. Also, no need to have the straights and curves match actual tracks on your layout. For example, if you have twelve 9-inch radius curve tracks of 15 degrees each connected to form a semi-circle, you can add that as one 9-inch radius curve if 180 degrees.
     
  14. Scott Eric Catalano

    Scott Eric Catalano TrainBoard Member

    205
    57
    6
    Hello All,

    Wow! I miss one day and a ton of messages show up....Twin Dad....awesome would love to see the plugin...also I just finished coding a bare bones Perl/Tk Throttle to interface to the DCC++ command station....it's based off of a Digitrax controller as I use Digitrax. This GUI interface is based off of the command structure that Gregg has programmed into the DCC++ Base Station. You can find a screen shot here. http://www.cfnet.org/GUITHROTTLEDCC.jpg
     
  15. DJ79

    DJ79 TrainBoard Member

    36
    25
    14
    esfeld, TwinDad,

    It appears that Digitrains is NOT the plug-in that we were talking about, if I understood correctly from a brief visit to the posted link to GooglePlay, This is an (Android only) app that's similar to WiThrottle and EngineDriver. In other words, it's a downstream interface to JMRI, independent of the actual hardware plugged into JMRI. It can work with any hardware currently supported, which DCC++, at this point, is not. What we need is an upstream interface from JMRI to this specific hardware (DCC++ base station) running its specific protocol -- not unlike a device driver. Once this is in place, we can use any downstream component through JMRI, including this Digitrains client.

    On that note, I've set up my other computer (a Mac) for Java development (NetBeans) and downloaded JMRI source code. After some versioning snafus, I finally got the thing to compile tonight after reinstalling NetBeans, so I'll be looking into what need to be done some other time. If you, TwinDad, or anyone else, have experience with Java, or have contributed to JMRI, you'll probably do it a lot quicker and easier, if you haven't done so already, but I'll play some more with it just to see how it goes.

    But on another note, why not expand the GUI to talk to JMRI as well, so that it can be used with any other supported hardware like Digitrax? It sure would look (and probably work) better than what's built into JMRI itself. I would love to have a control panel with this GUI running on a tablet (or two) in addition to, not instead of my WiThrottles, operations, and everything else. Here we have two amazing components (the base station and the GUI) -- why limit them to work only with each other? Why not allow them to play with other components, as well?
     
  16. Scott Eric Catalano

    Scott Eric Catalano TrainBoard Member

    205
    57
    6
    Hello DJ79,

    Exactly! A friend of mine asked me if my GUI will work with other DCC systems and I said yes (eventually)....that is what it will be geared towards and as it is many of the sound decoder manufacturers are not consistent in their sound mappings....let me explain....the normal F1, F2, F3, F0 are all standard sounds options on everyones decoders...lights, bell, horn, coupler....where it gets proprietary or different is QSI, MTH, LokSound etc everything after F3 is different....what I am aiming towards is standardization.....for example F8 on digitrax is used as a mute button to turn sounds off.....not all sound decoders are set that way.....what I am doing right now is checking which sound decoders use what function as a mute button and mapping them all so that F8 on my GUI is used to turn the sound off as an example no matter which decoder is in that locomotive.
     
    KC Smith likes this.
  17. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    I'm already fairly deep into implementing a DCC++ "driver" for JMRI.

    Give me a bit of time and I'll see how it goes. So far it is pretty straightforward. I'm doing the basic "boilerplate" code right now. I will have a few questions about how the throttle registers are supposed to work and the programming modes that are (or are not) supported by DCC++ ...

    I don't anticipate it will take very long, assuming I don't get derailed by "life" ...
     
  18. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    DJ79, I think that's a great idea. When I first created DCC++ Base Station I had expected that a variety of interfaces could be used to operate the system. My own goal was to develop a native iPad interface using Apple's Swift language. But I needed something quick and easy to test out the Base Station while under development and started to use the Processing IDE to create a few lightweight components. Of course the more I tinkered, the more complicated things got and before I knew it, I had a reasonably complete interface. I had never thought about using the interface to control a different DCC base station, but there's no reason why it couldn't. I'm not familiar with JMRI but it would seem that whatever protocol it uses to communicate with commercial DCC base stations could also be incorporated into the DCC++ Controller.

    The one aspect of the software I have to still release is the expanded code set for using an Arduino Mega. Embedded in this code is yet another way of operating a railroad --- using complete automation without any connectivity to a computer. The Uno does not have enough memory to hold these routines but the Mega has more than enough. Again, this started out as an experiment in maximizing the use of the Arduino, mostly because I was tired of waiting for my PC to boot when friends were visiting and wanted to "see" the trains run. Now I just press a single button and everything fires up on its own.

    I hope to post these additional Arduino Mega routines sometime before Xmas.
     
  19. Scott Eric Catalano

    Scott Eric Catalano TrainBoard Member

    205
    57
    6
    Gregg,

    That sounds great...and of course you can daisy chain Arduino Unos together....I've done this before...one uses a "signal" driver and the other used the "motor" shield....the small one from Adafruit....I did this for the christmas train show to automate a few hi-rail vehicles around a few loops of track....smaller motors about the size of N Scale motors.....and it worked great....the Mega would be an upgrade I will have to look into....and besides...one can make a DIY Arduino of any size....just need a Mhz crystal and the Atmel chip and you can create your own!
     
  20. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    OK, first question... there's this concept of "Service Mode" ... which is essentially (as I understand it) Programming Track mode... on at least some systems, there is the concept of "entering" or "leaving" service mode...

    It appears that the DCC++ base station is essentially always in Service Mode, in the sense that programming track commands are accepted and directed to the programming track outputs all the time, is this correct?

    I'm inferring this from the presence of separate Main and Programming track outputs, and the lack of explicit commands to enter and exit Service Mode or to change Programming Mode in general...

    Second question... among the various canonical modes of programming decoders (Register, Direct, Paged, etc...) which does the DCC++ base station support?
     

Share This Page