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

Gregg Aug 25, 2015

  1. VaBEast

    VaBEast TrainBoard Member

    31
    5
    8
    Thank you all for the hard work done here to make DCC++ possible!
    I have an Osoyoo Mega 2560 that I have succesfully loaded base onto. I am waiting on a genuine Arduino motor shield r3. I can connect to it through the control and JMRI programs. I can connect Engine Driver to JMRI from my Nexus 6 Android phone. None of the commands from Engine Driver are reaching the Arduino. I can see the lights flash and can monitor the traffic from the control and JMRI programs directly. No traffic when using Engine driver. I am using the latest versions of all of the software as of Feb. 1st. Any guidance to resolve this would be appreciated.

    I would like to add a WiFi shield to communicate over TCP/IP, but don't really know what to choose. The ESP8266 looks nice but I don't need to serve a web page off of it. I have no problem leaving JMRI running on a spare laptop. I just want to connect the base to my home WiFi network. Any recommendations? If I do get an ESP8266, should I get the small serial board or a full shield?
     
    Scott Eric Catalano likes this.
  2. henrybstinson

    henrybstinson New Member

    2
    2
    5
    I, too, am a long time programmer (VB V2.0 through VB6 but also know and understand C# and VB.Net). I can understand most java code and very much understand object oriented design and progamming -- and design patterns. (I'd be interested if your java code uses any design patterns. "Interface" pattern comes to mind.)

    I am not anxious to start tinkering with your code (once you publish it), so I was wondering it your system, as it is, can handle this:
    I am modifying my N-scale DCC system (currently with no layout control nor tortoises to control turnouts) to use an Arduino board to control turnouts using the miniature servos. In other words, not using DCC tortoises. (I do plan on putting in block detectors.) Can DCC++ send serial commands to another Arduino board that is programmed to control turnouts using servos? The Arduino board would not use DCC addresses, just simple commands like throw switch <N> right or left. I plan to use the power routed from the points to power LEDs to indicate visually whether a turnout is thrown or not -- and this simple system could also be used to send feedback signals to a controller. (I would love to be able to display turnout position and power routing on a computer screen.

    I hope to use JMRI to control the system.

    I would share with you anything I develop that applies to DCC and is not proprietary.
     
    Scott Eric Catalano likes this.
  3. Atani

    Atani TrainBoard Member

    1,335
    1,030
    27
    Yes this is doable. On the MRH forums you can find a stationary decoder approach if you want to expose them via standard DCC. You could also control the turnouts via outputs from DCC++ if you want as an option.

    out-of-box no but it is pretty easily doable. Others on this forum have hijacked certain commands like <t XXX> and routed them via serial connections to secondary Arduino boards to process them.

    JMRI can handle turnouts with visual displays via both DCC stationary decoders and DCC++ <t XXX> commands.
     
    Scott Eric Catalano likes this.
  4. henrybstinson

    henrybstinson New Member

    2
    2
    5
    One more thing: I have a large, complex layout, 20 ft long, with more than 40 turnouts (and will have possibly 50 to 60 once I am finished extending it around the room). I will be using an Arduino Uno R3 Mega 2560 board, but that board will not control that many servos. So I will be using two (possibly 3, but probably not) 32-bit servo controller boards (from China), listed as being for an "Arduino Biped Robot". Each of those boards can control 32 servos and can be daisy chained together, and would be connected to the Arduino board through one of the auxiliary serial connections (an Rx/Tx pair of pins -- not the ones connected to the USB jack).

    A few turnouts I will use relays to control under-servo solenoids, which I have several of for the Peco turnouts. (I will be using exclusively Peco turnouts, except for a few of the Kato double-crossovers, which have their own internal solenoids and can also be controlled by relays.) The Arduino Mega 2560 board can control the few relays needed.

    That 32-bit servo controller is an interesting piece of electronics, but it is very hard to find any documentation on it, and almost impossibly to find any blogs saying how it can be used. But I found a manual for it at:
    http://www.elechouse.com/elechouse/... Controller V2/32 Servo Controller Manual.pdf
    Information on that board is at:
    http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=100_146&products_id=1883

    This is not the only 32-bit servo controller, and I found another one that is a shield for Arduino, but there are so many connections, that the board does not need to mounted on top of an Arduino board (and especially if one daisy chains a second 32 bit controller).
     
    Scott Eric Catalano likes this.
  5. KC Smith

    KC Smith TrainBoard Member

    102
    102
    10
    Hi Steve (s)

    I'm looking forward to testing a DCC++ Wifi connection along with JMRI Decoder Pro and WiThrottle/Engine Driver phone and dropping the USB cable connection requirement, but I'm not sure which DCC++ Wifi Thread and software to start with. I think it's UK Steve's version on Dave Bodnar's Site http://trainelectronics.com/WiFi-esp8266/Setup/ Is that correct?

    Board;
    I have the Wangtongze ESP8266 1.0 you show at the bottom, which you say may be a problem.
    Mine has a bright Red led, however, it has the stamp misspelled 'Moer info $ tech...' instead of More info & tech....

    I found this blog which describes a possible fix .... see the last comment by Andreas on the following thread.
    http://arduino.stackexchange.com/qu...t-wifi-wireless-shield-with-ardui/33604#33604

    Steve, does Andreas' comment in the blog make sense to you?

    Thanks Kevin
     
    Last edited: Feb 8, 2017
    Scott Eric Catalano likes this.
  6. crusader27529

    crusader27529 TrainBoard Member

    247
    166
    10
    Trying to make sense out of this HUGE thread is getting really hard.

    I think it'd make sense to add multiple sub-threads to the DCC++ thread, but it's just a suggestion........a good suggestion, but nevertheless just a suggestion.
     
    KC Smith and Scott Eric Catalano like this.
  7. UK Steve

    UK Steve TrainBoard Member

    453
    683
    12
    Hi Kevin

    The thread you quote over on Dave Bodnar's site is a great starting point, before you start working with ESP in Arduino IDE there are some prerequisites, and that thread describes one route of installation.
    The installation of Python 2.7 https://www.python.org/download/releases/2.7/ is important for some of the ESP toolchain apps, so make sure you do that first.
    If you prefer a pictorial, I recommend this one http://henrysbench.capnfatz.com/hen...rduino-esp8266-lolin-nodemcu-getting-started/

    The current issues with the cloned Wang Tongze shields has turned into an unholy mess, I'm in a bad position of not being able to advise on your particular circumstance. It seems the level shifting transistor circuitry is not working, so even if you can program your shield (likely) you will not get the expected connection in an out of your Arduino board.
    Expressif did release a statement last year suggesting the IO's on the ESP are 5v tolerant, and I've been using mine, RX TX connected directly with no adverse effects to date. A crude rewiring hack of a bad board would seem feasible, I can't give explicit instructions for that however.

    Basically ESP's TX needs a connection to pin 0 on Arduino, and RX to pin 1.

    On firmware, the sketch on Dave's site is long since depreciated. If you can get your shield working we'll discuss your options in another post.

    Steve.
     
    Last edited: Feb 9, 2017
  8. TexasRailroader

    TexasRailroader TrainBoard Member

    90
    26
    7

    Had a programming fail on a Bachmann GP40 when trying to set a long address CAB number. Bachmann uses a Soundtraxx Sound Value decoder.
     
    Scott Eric Catalano likes this.
  9. french_guy

    french_guy TrainBoard Member

    486
    160
    19
    How do I install the Base software into the Aurduino? I took a look at Github website, but I can't find where to download the whole zip file...
     
    Scott Eric Catalano likes this.
  10. lnxlnx

    lnxlnx TrainBoard Member

    24
    20
    7
    Scott Eric Catalano likes this.
  11. french_guy

    french_guy TrainBoard Member

    486
    160
    19
    Scott Eric Catalano and KC Smith like this.
  12. esfeld

    esfeld TrainBoard Member

    420
    374
    14
    Kevin, sorry for the late reply, I'm out of the country for another two weeks. Do not concern about the power LED color as I have gotten both (red & green) to work successfully. To answer your question, no , that description does not make sense to me but I haven't played around with any rewiring on my boards. It seems to be an issue with the positioning of the toggles for uploading a sketch and then putting it into an operatoonal mode. When I get back I will revisit the issue and see if I can help you further.
    Steve F
     
    Scott Eric Catalano and KC Smith like this.
  13. Ivan Strom

    Ivan Strom New Member

    8
    9
    1
    I'm not sure if I needed to start a new thread - thought I'd reply here.

    I put together a base station with an Arduino Mega2560 and Arduino Motor shield and got everything hooked up (with the Vin trace cut and connecting pins 2 and 13 on the Mega). I ran the <D> diagnostics and all appears fine. DC voltage is 17.4V (from batteries for testing purposes).

    I have one cab that correctly accepts throttle commands. My other 3 cabs do not. Also, neither DCCpp_Controller nor JRMI can read information from any of the decoders.

    Any suggestions how to further debug this issue? I'm wondering if pulse width timing might be off, but there may be other factors I need to look at.
     
    Scott Eric Catalano likes this.
  14. Atani

    Atani TrainBoard Member

    1,335
    1,030
    27
    What sort of decoders and how did you wire the track? on the motor board A is MAIN and B is PROG. DCC++ (and JMRI by extension) will only be able to read CVs on PROG.
     
    Scott Eric Catalano likes this.
  15. TwinDad

    TwinDad TrainBoard Member

    1,844
    548
    34
    And for thoroughness... have you tested all of those locos on a known good system? Eliminated the possibility that the problem is in the decoder, not the base station?

    If neither JMRI nor DCCppController are working, then the problem is most likely (though not certainly) in the Base Station, the track, or the decoder.
     
    Scott Eric Catalano likes this.
  16. Ivan Strom

    Ivan Strom New Member

    8
    9
    1
    Thanks for the quick replies. The one decoder that did accept throttle commands (but didn't return results on a CV read on the programming track) was a DH121. My other decoders are TTX RS/2, LE102XF-JST, MRC AC310, but I can neither send throttle commands to them nor read CVs. All the decoders work fine on my existing layout (powered by an old MRC2000).

    Given that the base controller was having problems both with the operations track (only 1 decoder responded to <t> commands) and with the programming track (I couldn't get this to work at all) my thoughts go to power and pulse width, which would affect both. Power is applied via battery (two 9 volt cells for testing), so the only other thing I can think of is pulse width, but perhaps there are other potential problems that you might have encountered.
     
    Scott Eric Catalano likes this.
  17. KC Smith

    KC Smith TrainBoard Member

    102
    102
    10
    I'm betting its the older pre 2001 decoders.
    I had the same problem with the MRC AD310 decoder it worked on the MRC2000 command station but not DCC++. swapt out the decoder with a slightly newer NCE-P2K decoder and it worked just fine.

    Also try using a 15-18vdc 2 amp or better laptop power supply instead of the battery.

    Kevin
     
    Last edited: Feb 27, 2017
    Scott Eric Catalano likes this.
  18. Ivan Strom

    Ivan Strom New Member

    8
    9
    1
    Thanks Kevin. I did some more testing, and two of my newer cabs worked fine on both the programming and operations tracks. Unfortunately replacing decoders is going to add to the cost of the system.

    The battery was only for testing purposes. I wanted to make sure that ripple from my power supply wasn't part of the problem.
     
    Scott Eric Catalano and sboyer2 like this.
  19. TIm Jones

    TIm Jones New Member

    2
    4
    1
    Hi Folks,

    My Arduino UNO and MEGA2560's are on the way along with a few Motor Control Shields (found all on eBay for a great price, so I ordered multiple so I can "break" things to find out how they work).

    I have two questions that are aimed at both Gregg and others:

    Is the JMRI software required for using DCC++ as described in Gregg's Youtube Videos?
    Has any further progress been made using the Wifi sheild with the MEGA?​

    Thanks for all of this and helping me to jump back into the hobby in a modern way!

    Tim
     
    Scott Eric Catalano likes this.
  20. Atani

    Atani TrainBoard Member

    1,335
    1,030
    27
    No it is not required but it does help if you want to program decoders etc.

    I have an ESP based "shield" with limited wires going to the Mega (or Uno) and customized software for both the ESP and Mega (or Uno). Others have opted for a simpler solution of the ESP being a basic bridge device to expose the base station's serial port via WiFi. There are a few threads on this forum covering the various aspects of this.
     

Share This Page