DCC+ Multiple commands

Gary Beard Jan 20, 2022

  1. Gary Beard

    Gary Beard TrainBoard Member

    10
    8
    2
    Hi

    I've extended the excellent DCC+ code such that I can run two trains upon a shuttle type layout. Everything works fine, engines, lights, points except that occasionally an instruction to a point goes AWOL. It appears to be upon a random basis, sometimes the calls function just fine, other times it gets ignored.

    My code does send a number of commands in sequence, turn engines lights on, change signal, switch a point and so I'm wondering if this is somehow overloading DCC+ such that some commands get missed ?

    Is there anyway to bundle a whole load of commands together, perhaps comma separated, such that they can all be sent in one go and then handled in sequence ?

    Many thanks guys
     
  2. Sumner

    Sumner TrainBoard Member

    2,856
    6,034
    63
    Is this the older DCC++ or DCC++EX? If DCC++EX I'd also post this on their Discord site .....

    https://discord.com/invite/PuPnNMp8Qf

    .... as they are looking for people to test various options and what you are doing might be of interest and they might also be able to help you.

    I can't help but I'm interested, did you add to the code to be able to send the commands or are you using something like JMRI?

    Sumner
     
  3. Gary Beard

    Gary Beard TrainBoard Member

    10
    8
    2
    Hi Sumner

    Many thanks for coming back to me.

    Not sure to be honest. The zip file is version 1.2.1 though.

    I will visit the Discord site as you recommend and see is anything arises from that. Fingers crossed ;-)

    I've added additional code to the DCC+ instructions rather than employ JMRI as I wanted to use as little hardware as possible beyond the Arduinos. I use three. Two Uno's work with current detectors (DCC Concepts) to determine the locations of the engines and report back to a master Mega 2560 which hosts the amended DCC+ software. It then controls the trains, signals and these misbehaving points accordingly !

    Happy to give you a sight of the code if you are interested

    Gary
     
  4. Sumner

    Sumner TrainBoard Member

    2,856
    6,034
    63
    Here is a link to DCC++EX....

    https://dcc-ex.com/

    If you aren't using it I would for sure look into it. They have made a ton of improvements to the original DCC++. The one I personally notice the most is that I hardly ever have a problem programming a decoder now. If one does have a problem with a decoder that is out of the required specs they have ways to fix that also.

    Not sure if you could use your code or not with it. This past year I did do some programming with Arduino's ( HERE ) on my turntable project but that was basically add some code to other's code that I found that was close to what I needed. With that in mind and my limited programming abilities with an Arduino I probably wouldn't understand what you have done. Might be that some the guys on the Discord site would like to look at it though and possible someone here. It does sound interesting,

    Sumner
     
  5. Gary Beard

    Gary Beard TrainBoard Member

    10
    8
    2
    Visited Discord and guys there very helpful. I have also now downloaded DCC-EX because, as you say, it is rather impressive. Now going to have a browse through its documentation and then have a play!

    My background is as a software developer so these sorts of things do, thankfully, come naturally to me. Don't under estimate what you have achieved with an Arduino though as that is how we all start, nicking someone else's code and then adapting it. That is a skill in its own right, so don't be afraid to stick at it.

    Thanks again for the assist

    Gary
     
    Sumner likes this.
  6. BigJake

    BigJake TrainBoard Member

    3,339
    6,475
    70
    JMRI runs great on a little Raspberry Pi (I use a Model 4b, but it will run on a Model 3 too). And I wouldn't be without JMRI Decoder Pro when I program locomotives! It also serves Wi Throttles over my home network, so I don't have to switch networks on my phone to run a throttle (or connect my laptop via VNC to access Decoder Pro). And JMRI can do LOTS more...
     
  7. Gary Beard

    Gary Beard TrainBoard Member

    10
    8
    2
    Hi Andy
    Totally agree JMRI is very versatile and useful. However, in this particular instance, I want the trains to run totally independent of any user interface albeit a computer, throttle or phone. My code additions to DCC ++ work 80% of the time but not 100% which is mildly frustrating. However I am now looking at DCC EX with great interest. Indeed I am currently building a small prototype of my shuttle system just so I can see it in action. Hopefully it will up and playing early next week and , certainly going by what I have read, it looks like it really could be the solution to my intermittent problem where a point / switch changes a couple of times as required before then becoming stroppy and so ignoring any future commands to switch over.
     
    BigJake likes this.
  8. Sumner

    Sumner TrainBoard Member

    2,856
    6,034
    63
    Have you seen Greg's automated layout running only on an Arduino (he wrote the original DCC++ code)?



    He also has a 4 part series on doing it that I just found (haven't watched it yet).....

    https://www.youtube.com/channel/UCJmvQx-fe0OMAIH-_g-_rZw/videos

    All way beyond my skills but sound like something you will pull off,

    Sumner
     
    Mark Ricci likes this.
  9. Gary Beard

    Gary Beard TrainBoard Member

    10
    8
    2
    Hi Sumner

    Yes, in fact they were what got me interested in DCC ++ in the first place. The first 4 concentrate upon the hardware and the theory of DCC with the last one showing just what can be achieved using the DCC ++ software. Certainly inspirational and as I was looking to find out how to write my own code to run a DCC engine(s) it not only provided me with a great short cut (He had already done all the tough work) but also a base upon which to add my additional bits and pieces.

    Do have a look at them and I hope you find them both interesting and enjoyable

    Cheers

    Gary
     
    Mark Ricci and Sumner like this.
  10. BigJake

    BigJake TrainBoard Member

    3,339
    6,475
    70
    Gary, JMRI is also completely capable of running your trains automatically, without user input/interface.

    I don't want to sway you from what you are doing (I think it's pretty cool), but it seems you had a misconception of what JMRI, even on a Raspberry Pi, is and can do, that's all.
     
    Mark Ricci likes this.
  11. Gary Beard

    Gary Beard TrainBoard Member

    10
    8
    2
    Hi Andy

    I didn't know that, so many thanks for giving me the heads up on it. I knew JMRI was pretty versatile but I didn't realise that it had this type of capability. Having gone so far down such an enjoyable and interesting DCC++ path, I will stick with it, but you have certainly given me something that I will look into further and have a play with, perhaps for a future project.

    Cheers

    Gary
     
    Mark Ricci likes this.
  12. BigJake

    BigJake TrainBoard Member

    3,339
    6,475
    70
    The JMRI developers are eager for help supporting and expanding JMRI... They support a user group on groups.io that is pretty busy.

    There was a thread there several days ago about the latest JMRI version release, and somebody mentioned running JMRI on a Pi Zero!

    The Pi Zero is said to run Steve Todd's Raspberry Pi OS image and JMRI (pre-installed.) Slower to boot, and may have some limitations, but the Pi Zero family is much smaller physically than the 3 & 4, yet still runs Linux.

    But JMRI works with many DCC systems, including DCC++EX.

    I know it sounds like I'm still pushing... Honest, I'm not; just providing future options for you.

    I don't know whether your SW dev preferences are more bare metal, RTOS or Linux/Windows/etc. The balance between DCC++EX and JMRI lies in doing only those things at a bare metal level that need that fine control (esp. low level IO timing, etc.) while doing higher level things on a higher level system (e.g. Windows/Linux).
     
    Mark Ricci likes this.
  13. Gary Beard

    Gary Beard TrainBoard Member

    10
    8
    2
    Not pushing just providing valuable info ;-)

    I'm much more experienced with software rather than hardware. The Arduino being my only real venture into that realm and then just in the past few years or so. its something I regret because its opened up another world to me and, combining it with my SW know how, has been a lot of fun. I certainly wish now that I had far more attention to my Physics teacher way back then!
     
    BigJake likes this.
  14. BigJake

    BigJake TrainBoard Member

    3,339
    6,475
    70
    As a retired Electrical Engineer (including board level circuit designer and FPGA developer) who worked alongside SW teams on systems using FPGAs and/with processors, I can understand both sides reasonably well, but naturally my HW side is much stronger. I was constantly trying to improve the SW skills of our FPGA developers (especially in design verification, including bug tracking, continuous integration, life cycle management, etc.) It is the rare and valuable bird that can navigate both disciplines effectively.
     
  15. Gary Beard

    Gary Beard TrainBoard Member

    10
    8
    2
    During my S/W career I was privileged to also have the opportunity to teach programming both at a local university and for H.M Customs. A wide cross section of students crossed my path and, very broadly, they fell into two groups. Those who were programmers and those whose skills leant more towards the data analysis side of things. As you say, it was extremely rare to come across someone who was skilled at both disciplines. I guess brains are wired to wander happily down some pathways but find other routes more challenging. For me, coding comes naturally and I can write software across a number of different languages. However getting my head around hardware , although fun, is far more of a challenge. But then possibly thats also why I am finding it interesting and so keep pushing my personnel envelope.
     
    Mark Ricci likes this.
  16. BigJake

    BigJake TrainBoard Member

    3,339
    6,475
    70
    Well said.

    I believe there are different brains among us, wired differently to excel in different disciplines. I say "wired" not necessarily in a biological way, but certainly (also?) in an environmental (experiential and learned) way. Who knows, there may be some biological/genetic factor too. I think it certainly is somewhat due to the people with/around whom we grew up.

    I came from a family of engineers; I'm 3rd generation, and my son is a 4th generation engineer. But I've also worked with many very talented individuals that were the first in their family to become engineers or scientists. Problem solving is a learned skill, no matter what discipline or manner in which those problems are encountered and solved.
     
    Mark Ricci likes this.
  17. Mark Ricci

    Mark Ricci TrainBoard Member

    481
    652
    13
    Discovered DCC ++ EX then watched these last October and shortly after, returned to the hobby after 30 years. Thought they were outstanding! His presentation reminded me of the 80s and 90s when I taught waveform analysis specifically in discussion of pulse width modulation. Great memories and wonderful to see how DCC ++ and DCC EX has progressed and evolved. Highly recommend to watch too!!!
     

Share This Page