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

Gregg Aug 25, 2015

  1. hoyden

    hoyden TrainBoard Supporter

    815
    778
    30
    I am currently running 4.1.4 and will update to 4.1.5 this evening. Thank you for the pointer.
     
    Scott Eric Catalano likes this.
  2. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    All,

    Since the Master branch of the DCC++ Base Station has been stable over the past week I published it as Release 1.2.1 (https://github.com/DccPlusPlus/BaseStation/releases/tag/1.2.1) to reflect the most recent bug fixes, the new CV-reading logic, and some other improvements. This version is now feature-complete and can be used as the baseline for building out new functions.

    You'll also notice that I added a Development branch to the repository. This branch is an identical superset of the Master branch but includes three additional sets of *.cpp/*.h files representing three extended features:
    1. Commands and code to control an RGB LED Light Strip if connected to PWM pins 44, 45, and 46 of an Arduino Mega;
    2. A generalized Egg Timer module that allows you to create, set, and reset multiple countdown timers within the code that call other functions whenever their respective counters reach zero. The repeated calling of various functions by one or more Egg Timers is an excellent way of creating automated and timed operations sequences (note you can't simply add delay() commands into the code to accomplish timing sequences since you'll wind up blocking the execution of the rest of the program during the delay); and
    3. A complete AutoPilot routine that utilizes the above Egg Timer functionality in conjunction with "hooks" into the existing Sensor code to create a fully automated sequence of out-and-backs for each of my trains. This is the code that drives the automated single-train operations routine shown on the DCC++ YouTube channel. Note this standalone routine does not require the use of DCC++ Controller.
    I had originally thought I would create these three new modules as Arduino libraries that users could optionally add into the Master branch as needed. However, I found that there were too many hooks needed into different parts of the code to establish these modules on a standalone basis. I also don't want to add them directly into the Master branch since they are very specific to my layout (especially the AutoPilot routines) and would need significant modification for anyone else to use. So for now, please feel free to download or peruse the Development branch to see how the code works for these new modules, and copy, edit, paste any sections you may want into your own local version of the Master branch.

    If anyone has any ideas for better ways of providing these additional modules, please let me know -- using a second branch seems a bit clunky to me.

    With the establishment of Master branch Release 1.2.1 and the new Development branch, DCC++ Base Station now includes everything in my original code base (I'm currently using an exact copy of the Development branch in operations on my own layout). Plus, it includes a lot of new features developed over the past few months based on all of your excellent feedback (THANK YOU!). So from here on in, it's blue-sky for new features and functions.

    Over the next few weeks I will likely focus on releasing some new videos, especially an overview video since we are getting more visitors to the DCC++ YouTube channel (100+ subscribers!) and not everyone has DCC experience (which makes understanding DCC++ a bit more complicated).

    Also, I have some ideas to make DCC++ Controller a lot more generic so you can create throttles and layouts without needing to touch the code.

    Have great New Year and thanks very much for all the superb suggestions, robust discussions, and terrific support of DCC++ --- and please keep those questions and ideas coming!

    -Gregg
     
  3. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Taking a short break from writing software, I'm working on a web page for DCC++ ... it will provide links and (eventually) text-based instructions for folks who prefer a page reference to the videos... I hope it is useful.

    I want to add step-by-step instructions for setting up the hardware and installing the software, and documentation of the communications protocol, plus links to the YouTube videos and to this thread, as well as other relevant sites (Arduino, Pololu, JMRI, etc.).

    It's still very much under construction, really just a skeleton. At some point I will work up a unique look & feel but for now it borrows the "skin" from the rest of my site.

    Have a look, but remember, it's really just a skeleton for now... I don't even have the page linked from my own site yet.
     
  4. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Having started this... it might actually better simply to expand the Wiki on Github... I guess we'll see...
     
    Scott Eric Catalano likes this.
  5. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    TwinDad - quick question. You are using an Ethernet Shield with the Mega, correct? Not with the Uno (since we would get a conflict on pin 10)? Is that right, or have you figured out some way around the Uno conflict?

    -Gregg
     
    Scott Eric Catalano likes this.
  6. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    Yes, I have a Mega. Not only is there a conflict on Pin 10, but the Uno really doesn't have enough code store or RAM to support Ethernet.

    Having said that, I haven't actually gotten it to work because I (still) don't have a power supply with enough juice to drive the Ethernet shield.
     
    Scott Eric Catalano likes this.
  7. HVT

    HVT TrainBoard Member

    74
    93
    15
    Gregg, TwinDad, et al,
    Thank you for sharing your talents with this wonderful project. Due to a recent job transfer (now in the home where we will retire) I am starting over with a new 31 ft along the wall layout with a helix down to lower staging and have begun the benchwork. It will require several more Tortoises/BDL168/DS64/SE8c than the previous 5 x 16 island layout. I am already planning Arduino for the 6 Faller cars on the roadway and have considered Arduino for the track, but I hesitate because of the difficulty with consistent switch and detection feedback via LocoNet.

    I/O requirements:
    48 servos
    48 push switches for local panels
    64 detection blocks (STRONGLY prefer coils to sense when a block is occupied as opposed to IR)
    35 3-LED signal heads (105 I/O pins)
    14 2-LED dwarf signals (14 I/O pins - one LED High, one LED LOW)
    That makes 279 total I/O pins or 5 Arduino Mega boards.

    Questions:
    How feasible is a project of this scope using DCC++?
    How would 5 Mega boards be set up to make this work and share required info?
    Has anyone used current transformer coils with Arduino for detection?
    Can 3-LED signal heads be done with less than 3 I/O pins per head?
    What else have I not considered?

    Answers to these question will help me decide whether to make the jump to DCC++ or buy more Digitrax components and Tortoises.

    I have been using JMRI for several years including remote operating over the internet and was extremely excited reading through this thread when I found out that TwinDad was working on the JMRI interface. He has helped me with some sound experiments in the past.

    Thanks again to each of you who have helped make this possible.

    Warmest Regards,
    Dave Merrill
     
    Last edited: Dec 29, 2015
  8. w8one

    w8one TrainBoard Member

    89
    109
    5
    As long as you don't mind soldering, here is a list of some of the stuff i have ordered for mine. Look at your favorite online retailer for them.

    20A range Current Sensor Module ACS712.jpg 20A range Current Sensor Module ACS712 Hall effect current sensor Somewhere around $1.50 - 5.00 ea They come in 5a 20a or 30a sizes.
    MCP23017-ESP  DIP-28 16-Bit IO Expander With I2C Interface IC.jpg MCP23017-ESP DIP-28 16-Bit IO Expander With I2C Interface 16 digital I/O pins per chip (set in banks of 8 as either in's or out's) 8 can be hooked together for a total of 128 digital I/O's Cost around $ 1.00 ea bought in set of 10
    PCA9685 16-Channel 12-bit PWM Servo motor Driver I2C Module.jpg PCA9685 16-Channel 12-bit PWM Servo motor Driver I2C Module 16 pwm out's per board you can hook up 62 of these together for 992 pwm outputs Cost $ 6-15 ea
    SG9 Mini Gear Micro 9g Servo.jpg SG9 Mini Gear Micro 9g Servo $1.75 ea

    There are libraries for all of these for the Arduino
    I'm planning to use these with a Arduino micro or mini (same as uno only smaller) in the area they are needed. Using the DCC++ signal and separate power. I also ordered some rfid stuff to play with. For the 3 led's search for multiplexing rgb led matrix, I have some smd5050 ws 2812 leds im going to try to use.
    willy - w8one
     
    Last edited: Dec 29, 2015
    Scott Eric Catalano likes this.
  9. w8one

    w8one TrainBoard Member

    89
    109
    5
    My bench power supply is a 200w atx computer power supply comes with 3.3v 5v and 12v for free out of a old pc.
     
    Scott Eric Catalano likes this.
  10. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    wBone do you have a link to the actual current sensor module? The link in your post appears to be only to the image.
     
    Scott Eric Catalano likes this.
  11. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    I have that on my "to do" list, but it hasn't bubbled up yet... oh wait... I think it just did... :)
     
    Scott Eric Catalano likes this.
  12. w8one

    w8one TrainBoard Member

    89
    109
    5
    Scott Eric Catalano likes this.
  13. w8one

    w8one TrainBoard Member

    89
    109
    5
    These apa-106 led's are shift register RGB led's less than $20 for 50 of them comes in 5mm or 8mm use only 1 Arduino pin. Search ebay or amazon for them. There are Arduino libraries for these also.
    apa-106-f5.jpg
     
    Scott Eric Catalano likes this.
  14. HVT

    HVT TrainBoard Member

    74
    93
    15
    w8one, thank you for outlining those components. After doing a bit of searching and reading it appears doable. I suspect that the Arduino sketch would be quite complex. It would certainly take some hand-holding to put it all together.

    Dave
     
    Scott Eric Catalano likes this.
  15. KE4NYV

    KE4NYV TrainBoard Member

    219
    281
    17
    W8ONE, I can only assume also amateur radio. KE4NYV here :)

    Anyways, you probably don't need it, but for those interested in utilizing an ATX supply for their setup, we have an ATX breakout box that we produce for such applications. Breaks all of the voltages out to standard PowerPole connectors:

    (First item on the page)
    http://www.rpc-electronics.com/ps.php

    [​IMG]

    [​IMG]
     
    Scott Eric Catalano likes this.
  16. w8one

    w8one TrainBoard Member

    89
    109
    5
    I did mine the hard way, cut solder add leds ect.. this would have been faster and reusable if you change to a different power supply. Most diy electronics use binding posts instead of power poles thou.
     
    Last edited: Dec 29, 2015
    Scott Eric Catalano likes this.
  17. w8one

    w8one TrainBoard Member

    89
    109
    5
    I havent got that far yet I'm still waiting on parts to come in, Look in to Geoff Bunza's decoder http://model-railroad-hobbyist.com/node/24316
     
    Scott Eric Catalano likes this.
  18. HVT

    HVT TrainBoard Member

    74
    93
    15
    W8ONE, Gregg and TwinDad,

    Spent some more time studying the suggested components as they relate to my planned layout and have a few more questions:

    How well will the processor on one Mega 2560 handle this load of components?
    1-Pololu Dual MC33926 shield providing the powered DCC signal
    8-MCP23017 16 Bit I/O expanders on one i2c bus
    4-PCA968516 servo drivers on a second i2c bus
    9-74HC595 shift register boards for multiplexing LEDS

    Is there any problem using two i2c busses?

    How do you label/name all the I/Os on all those boards/chips so that JMRI knows what's what?

    Would the 12 amp Pololu VHN5019 Motor Driver Shield work with the Mega and DCC++?

    Thanks for all your help.
    Dave
     
    Scott Eric Catalano likes this.
  19. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    I think you'd have no problem there, though you might have to be a bit clever with memory allocation.

    Probably not, though others will have more experience with this specific hardware...

    To JMRI, all outputs are "Turnouts" ... the way I did the DCC++ stuff, the numeric part of the JMRI "system name" directly corresponds to the pin number of the DCC++ base station output (Arduino Pin).

    In your application, I think I would build a look-up table in the Arduino that maps the "turnout address" used by JMRI to the chip-and-pin combination that gets you to the specific IO being addressed. It wouldn't take up much space in memory, if done carefully. This way you could choose any turnout number you want that doesn't conflict with other "turnouts" in the system. Of course, JMRI uses the whole system name to differentiate, so pin 3 on the DCC++ base station is DCCPP3, while address 3 on LocoNet is L3, which are different, so you should have plenty of address space to play with.

    You could also just "encode" the chip and pin into the "address" used by JMRI... so 13 is bit 3 of IO chip 1 and 23 is bit 3 of IO chip 2 and so on.

    There's plenty of ways to skin that cat.
     
    Scott Eric Catalano likes this.
  20. HVT

    HVT TrainBoard Member

    74
    93
    15
    TwinDad,
    Thanks for the informative answers.
    Dave
     
    Scott Eric Catalano likes this.

Share This Page