DCC++ non-Arduino decoder

Ed K Feb 28, 2019

  1. Ed K

    Ed K New Member

    2
    0
    1
    Hi All, new here and glad to be here.
    Im building my layout and have the NCE Procab and couple of QSnaps and a BDL168 all playing happily with JMRI.
    What Im looking for is some protocol help.
    Im Frankensteining some decoders. Since the turnouts I have are kinda old, rough and crusty, the QSnap cant always throw them and since I dont have any budget to upgrade I have to find alternatives.
    I have access to hardware I/O boards that have their own proprietary protocol - I promised I wouldnt but I did wind up deciphering how these things speak. I now have free hardware.
    I have an intermediary PC that I want to connect these boards to as well as JMRI, a sort of protocol translator. The boards communicate via 2-wire 485, I can connect to JMRI via plain old RS232 with this PC right in the middle.
    DCC++ gets a lot of attention while I was researching for this project, and there is tons of support for the Arduino as a command station, but I have a PC and want to listen to the sensors. Im learning Python due to my Raspberry Pi projects, so this will probably wind up being written in that.
    Im searching for how DCC++ operates. I want to have sensors along my layout, maybe near a platform or station or somewhere that can tell JMRI that "hey - Ive got a hit on my sensor!" as well as controlling turnouts, lighting etc..
    I work with coders, so they can (and are willing) to help me with this, but without any idea of how DCC++ 'listens' I wont be able to go too far. Im actually rather surprised that this isnt a common thing. There are millions of talented people out there and I cant find one who has posted something even similar. Ive got all this hardware and I want to use it. If someone would post or point me towards how DCC++ interacts with (especially) incoming signals, so I can begin my translations to the protocol Im working with on the other side.

    Thanks!
    Ed
     
  2. William E Van Buskirk

    William E Van Buskirk TrainBoard Member

    40
    22
    3
    Hi Ed, I'm no expert but will throw out what (I think) I know. First off DCC, in general, is a one way communications channel. It was designed to talk to locos and as such the feedback is the operator's eyes. I think there is limited code within DCC++ to use the extra Arduino port pins as Inputs or Outputs for JMRI (but not too sure on this).

    The good news is there are other systems that offer digital control and feedback in parallel with DCC. Some are proprietary such as Digitrax's Loconet and some are open source such as CMRI or LCC.

    I would suggest checking out Dr Bunza's blog postings SMA28 and SMA29, https://model-railroad-hobbyist.com/blog/geoff-bunza These two posts discuss directly connecting Arduinos to JMRI tables. For your plan you would need to mimic the Arduino's sketch on the second PC.
    Dr Bunza also has other blog posting regarding DCC decoders you could research.

    You mentioned that the IO boards you have use RS485, which is the same technology used with CMRI. If you can program the boards, you might be able to use them in JMRI directly as a CMRI net but there are alot of IFs involved.

    The NMRA has the DCC protocol on line (somewhere) for your research. Also research the Arduino projects source code, including the relevant libraries. The biggest problem you face is the fact that you are planning a very custom system and the user base is only one person. So no one else will have a simple answer for setting up your system.
    Good luck,
    Bill
     
  3. Ed K

    Ed K New Member

    2
    0
    1
    Hi Bill and thanks.
    I completely understand I am trudging down this path alone, but hopefully only on one side of my project.
    The translation part for my hardware is entirely on me, but what Im looking for really is a published DCC++ protocol, I think, unless theres a better communication path I could be using.
    Thanks for mentioning CMRI and LCC, Ill certainly give them a look over.
    I only started knocking on DCC++'s door once I found out it possibly offered what I need for this, it can create input and output points within JMRI and this is my goal.
    The medium isnt important, TCP, serial, 485 - I can get data across them all, I just need to know how to speak something that JMRI understands.
    Unfortunately I don't think Ill be able to re-flash these boards, so the next best thing for me would be to is translate for them, this is where I'm alone and I'm not asking for any help with this task, actually I enjoy the challenge.
    Since people have already published Arduino programs for this, they must be getting the DCC++ information from somewhere, thats my question, where is it published?
    I get long winded when trying to explain my things, so sorry if I bloat the page, im just trying to best explain what I really want in a way that wont leave any questions behind.
    Ive never played with the Arduino, so I dont know how to program one, so I dont know how to reverse engineer its software, not something I want to take on, but I do want to use the hardware I have. I just need to know how to speak JMRI.
    If anyone can drop a hint of something Im not yet aware of communication wise within JMRI, please chime in. It seems theres a whole lot of people contributing to the entirety of the model railroad hobby, I really thought someone else would have ventured into this arena, with so much of this hobby being open source why keep this end of it under wraps?
     
  4. William E Van Buskirk

    William E Van Buskirk TrainBoard Member

    40
    22
    3
    First stop should be https://www.nmra.org/dcc-working-group This is the DCC standards home. From there read all you can at the JMRI site. Google is your friend.

    Again DCC is a output only protocol so to read sensors you will need to use one of the other systems supported by JMRI for input.
    Bill
     
  5. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Hi Ed

    I don't know if you've seen this page which lists the DCC++ commands syntax?

    https://github.com/DccPlusPlus/BaseStation/wiki/Commands-for-DCCpp-BaseStation

    Look specifically at the 'Sensors' and 'Arduino output pins' sections.

    I'm not sure exactly what your requirements are e.g. how many inputs/outputs you will need. I don't use JMRI myself, but I'm sure it does support these specific DCC++ functions.

    Any spare Arduino i/o pins may be used for DCC++ input detection or output control on the BaseStation. There are more available pins if you use an Arduino Mega, or it is possible to create more inputs/outputs by using for example a suitable multiplex or shift register chip, though you will have to modify the Basestation code in order to support the added hardware.

    Jim
     

Share This Page