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

Gregg Aug 25, 2015

  1. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    The core DCC++ code does not maintain the status of the engine functions, only the throttle, so at this time it would not be possible to refresh on a continuous basis.

    Do commercial controller refresh? Note that headlight settings are sometimes stored on an engine itself, and for some of my engines the lights will turn on at power-up. But for something like a bell, if the train is removed from the track and replaced with the the bell sounding while utilizing an NCE or Digitrax throttle, does the bell start sounding again?
     
    Scott Eric Catalano likes this.
  2. Dani

    Dani TrainBoard Member

    10
    17
    5
    Hi,

    In case of Uhlenbrock (Intellibox Basic, IBCom) or ESU command stations it refreshes also the function status, I haven't tried others. So a car with interior lighting turned on can be removed from the track and when put again interior lights are lit again. Same happens in the opposite case. I tested to select the locomotive and turn on the lights with the locomotive not on track, and when I put it outputs are refreshed exactly as speed and direction.

    This is at least for the basic first 5 functions (from F0 to F4). If F1 is assigned to the engine sound and is turned on, when placing the locomotive on track the sound starts automatically. And this is done by the command station, not the throttle. In the stack of "alive" locomotives is stored direction, speed, and also state of functions for the regular refresh.

    I think it would be a nice enhancement. Otherwise if a lighted car looses contact with the track and lights are turned off, you have to first turn off the function (all cars turn off the lights) to turn them on again, something that do not happen with the command stations I know.

    Thanks,
    Dani
     
    Scott Eric Catalano likes this.
  3. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    Where can I download the current version?
    Steve F
     
    Scott Eric Catalano likes this.
  4. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Steve
    Where can I download the current version?
    Steve F
     
    Scott Eric Catalano likes this.
  5. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Scott Eric Catalano likes this.
  6. maltux

    maltux TrainBoard Member

    11
    12
    2
    HI Greg;
    I owned the NCE ProCab wireless and Power Cab at one time. I remember that the NCE Pro Cab did not remember Functions assigned to the ditch lights but did resume sound. I think its on the DCC decoder end as to how this functions.
     
    Scott Eric Catalano likes this.
  7. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Dave
    Thanks, but I am looking for the DCC++ Mobile Controller to use with the ESP8266 set up that UK Steve has posted examples of .......
    Steve F
     
    Scott Eric Catalano likes this.
  8. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Scott Eric Catalano likes this.
  9. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi All,

    I keep thinking of little additions to the Mobile Controller code, hoping to enhance the experience.

    To that end, anyone waiting the immanent release of the next version, might like to do a little preparation work beforehand.

    For a better experience of the inbuilt serial monitor I have made some slight additions to the Base Station code. Please note the following is not necessary for the code to work.

    As some of you will know there is no feedback from Base Station when a function <f> instruction is sent. So this is just an attempt to fill that gap.

    Open the sketch in the Arduino IDE then under the
    CaptureB.JPG

    tab paste this code



    Code:
      INTERFACE.print("<F ");
      INTERFACE.print(cab);
      INTERFACE.print(" ");
      if (fByte>=222){
        INTERFACE.print(fByte);
        INTERFACE.print(" ");
        INTERFACE.print(eByte);
        INTERFACE.print(">");
      } else {
      INTERFACE.print(fByte);    
      INTERFACE.print(">");
    
      }
      
    in this position

    CaptureA.JPG

    so we get

    CaptureC.JPG

    make sure the {} are all correct. Then under the

    CaptureD.JPG

    tab. Find this part (see line numbers) and make the additions shown

    . CaptureE.JPG

    The last bit is for use of a new <s> button and just slows things down a bit.
    CaptureF.JPG

    That's it for now the code should be finished for a tomorrow upload to github.

    Of course, compile and upload to your UNO or Mega.

    Steve.
     
    HVT, Scott Eric Catalano and FStop8 like this.
  10. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    All,


    The new Mobile Controller page and server sketch are now available on Github. https://github.com/indev2/DCCpp-WebSocket

    New additions are 2 full sets of cab Function switches, they are arranged into logical sections according to Gregg's specifications here https://github.com/DccPlusPlus/BaseStation/wiki/Commands-for-DCCpp-BaseStation

    I understand that there are many commercial controllers on the market with different ways of doing this, and with what limited knowledge I have in this area. As I neither own any of this equipment nor any high spec DCC sound decoders and the like.

    Please don't trouble me because it doesn't work on 'your' setup. I have attempted to give you a very simple logic that you can customise yourselves. That will mean spending around 10 minutes familiarising with the
    Html in a Text editor. You have a few options to consider....By default every latching switch will trigger an output when moved on or off. The Dark blue buttons that complement each array, are single trigger resend of the array
    set state. Great for when you have to pull a loco off the track then want to reinstate the functions on return.
    If you want to disable the triggering on the switches until they are all set.- And you can do as many or as few in any combination as you like. - Then just simply delete the function call on its entry in the Html. Those switches
    then become pre-sets whose state is sent only when you hit the Dark blue button for that array. All this can also be seen acknowledged in the new on-screen serial monitor.

    Here's the Html for the top Row. If you simply delete the code in the red boxes then the switch becomes a pre-set. Below that is the Javascript that calculates and sends the command for the top array in column 1 (T1).
    I hope you'll agree it looks pretty simple. I'm not a very high level programmer :).


    CaptureH.JPG


    CaptureI.JPG

    Of course I'll help with the usual teething problems. Hope you find it useful.

    Steve.

    Oh forgot to mention, there is an example ws://IP address hard coded into the entry field.
    If you change that to your own it will save a lot of time typing in when you open the page. By that I mean changing it and save in a text editor.

    <input type="text" class="form-control" id="server" value="ws://192.168.11.19:81" placeholder="Server 'IP Address'" style="width:150px;height:35px;">

    Change the value entry to value="" if you would rather the field starts blank.
     
    Last edited: Apr 2, 2016
    KC Smith, Scott Eric Catalano and HVT like this.
  11. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    All,

    I'm developing a Loco picker to add to the foot of the page. It's hoped this will be enhanced by adding your own Picture Icons and the like in future versions.

    Let me know if you would like the code for this, it seems to work well just now. You first make sure you're connected to the server, then just click your throttle choice to register the Loco.

    CaptureK.JPG

    Steve.
     
    KC Smith, Scott Eric Catalano and HVT like this.
  12. maltux

    maltux TrainBoard Member

    11
    12
    2
    FYI to all:

    Raspberry Pi3 running JMRI on Raspian using DCC++ working well. Issue with wifi Wii Throttle. and iPhone connecting. I will need to play around more.
     
    Scott Eric Catalano likes this.
  13. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Steve - I finally had time to try out your new files and have it working.... Congratulations on a job well done!

    I have not done extensive testing but all appears to be in order. I'll give it a workout the next time we set up our modular layout

    thanks again!

    dave
     
    Scott Eric Catalano likes this.
  14. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
  15. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Dave,

    Thank You. Your dedication to testing this project and hosting the files is very much appreciated.

    In the last few days I've made more progress in implementing a proper logon and exit procedure. This will cover instances where a connection is lost or you just want to resume your session info.

    So by default your device will synchronise with the data on the ESP server and set the details accordingly. All confirmed on the serial display. It's pretty neat if I do say so myself.

    I've also taken the shackles off the server code and tested it with no inbuilt delays. It seems to work flawlessly.

    Steve.
     
    Last edited: Apr 5, 2016
    Scott Eric Catalano likes this.
  16. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    lnxlnx and Scott Eric Catalano like this.
  17. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi Dave,

    I'm a little concerned with the amount of junk data showing up in your serial monitor screen shot.

    Past experience during my tests found this to be a poor RX TX configuration. And now we have a serial window on the front page it could be a nuisance to you if it starts showing up there.

    Hats off for your new testing shield. However, people have had issues with powering an ESP from the Arduino's 3v3 supply as there is not enough current available when the WiFi
    section goes on high demand, up to 400mA if I remember correctly. This can lead to unwanted errors and such.

    For a trouble free experience you might want to provide the 3v3 line from a separate source and revisit your serial connection. Give me a shout if I can help in any way.

    On a side note, would you be interested in testing the latest experimental code versions? I could maybe post these along side the other on Github.

    Steve.
     
    lnxlnx and Scott Eric Catalano like this.
  18. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Steve - the garbage on the terminal only shows up at initialization and never shows up again. Will keep an eye out for it.

    Agreed on adding a 3.3 regulator and tapping into the main power feed - easy stuff to add. For what it is worth I had no trouble using the ESP8266 with the on-board 3.3 volts.

    Please post the update and I'll have a look - may be a few days till I clear the other things off of my bench!

    thanks

    dave
     
    Scott Eric Catalano likes this.
  19. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Yes for the most part you're probably OK using the Arduino supply. Just so you know demand can get beyond supply and resulting errors would probably be down to that.

    On the serial side, you might be interested in a little project I found on github that gave me the basis of the serial monitor.

    I modified it a bit and came up with this, which you can connect simultaneously over wifi (on a remote device if you like) and get all the return serial data in a nice big window whilst testing the set-up.


    . CaptureL.JPG

    It's all in one html file no dependencies. Let me know if you'd like a copy. Credit to original developer.

    Steve.
     
    lnxlnx and Scott Eric Catalano like this.
  20. David Bodnar

    David Bodnar TrainBoard Member

    264
    481
    13
    Steve - yes, please send along the link
    thanks
    dave
     
    Scott Eric Catalano likes this.

Share This Page