Arduino/Motorshield/JMRI Wiring Question

JohnForsythe Aug 24, 2022

  1. JohnForsythe

    JohnForsythe TrainBoard Member

    Hello, all.

    I've got a functioning Arduino/Motorshield combo running JMRI. I am in no way an expert in this, having watched a tutorial on how to load and compile the software on the arduino.

    An annoyance: If I want to program in a new decoder, or read from an existing decoder, I must be on the programming circuit. If I want to POM and run the loco, etc, its the other circuit. I know this is by design. My issue is that I can't have both plugged into the single test track that I use at home. I know that using JMRI with a PR3 or 4 allows you to have a single set of conductors connected to a test track. Switching between programing and POM is accomplished by powering off the track in JMRI, switching from one to the other and then powering back on.

    With my current setup (no pun intended!) if I run both sets of wires in a Y harness for positive and negative each, I can't turn on track power. The board detects a fault and turns off the power.

    I thought of perhaps running a diode on one leg of the harness, but I'm not sure how the communication between the decoder and the command station works and I don't really want to break anything.

    Anyone else seeing this and/or have an idea on how to address short of having a zillion toggle switches to isolate the two circuits or having to run two tracks?

  2. Sumner

    Sumner TrainBoard Member

    Are you running the older DCC++ or the new rewritten DCC++EX?

    When I started I was using the older DCC++ and...


    .... had two short sections of track as shown above, one program track and the other main. That worked and I also had a DPDT toggle switch that I could use to switch the main track between DCC and DC so I could do limited testing on a DC loco I'd just bought before converting it to DCC.

    Now I have a test track with a siding that I can switch back and forth between program and main track. You could do that with one DPDT center off toggle switch now with your single track.

    If you are running DCC++EX they now have a 'join' command that you can use.

    "The use of the JOIN function ensures that the DCC signal for the MAIN track is also sent to the PROG track."

    ... see 'Track Power Commands' ( HERE ).

    If you aren't using DCC++EX you should convert as it is way better at everything than the original DCC++ ....

    Mark Ricci likes this.
  3. CSX Robert

    CSX Robert TrainBoard Member

    It would only take a single DPDT switch to isolate them - main output to one outer pair of terminals. programing output to the other outer pair of terminals, and track to the inner pair of terminals.
  4. sidney

    sidney TrainBoard Member

    when i use the JMRI with the Arduino i just unplug the main track and plug that wire into a program track and program what i need then when im done i just unplug the track and plug it back into the main again works great. ive had problem using the program track side of the Arduino setup . so now i dont use that part.......
  5. JohnForsythe

    JohnForsythe TrainBoard Member

    Thanks for all the responses guys.

    I've tried the DPDT method and was getting the same results. Could be I wired it wrong though.

    I downloaded, compiled and loaded the new DCC++EX code to my Arduino. Works from what I can tell. However, I'm looking through the documentation as well as in the battery of config files in the software folder on my PC and can't determine where to actually make the edits noted above and in the documentation on the DCC++EX web site. Help?
  6. Mark Ricci

    Mark Ricci TrainBoard Member

    It sounds like an direct short ... Without seeing a picture of the wiring and test layout....
    Ensure isolation between the OPS (A Channel) and PROG (B Channel). Shut down system and disconnect wires from motor shield A and b channels to tracks and check isolating track with a continuity tester or ohmmeter across the ends of each rail as well as across the rails. Confirm phase (maybe a rail pair was swapped in wiring) and no shorts exist especially if one is using a number of track feeders.


    There are a number of ways for Prog track switch.... .
    Use of a center off 4PDT switch is another.


    From the DCC wiki...additional Prog track wiring info can be found here...

    Wiring a Programming Track for DCC (

    The DCC EX commands, eg. OPS track power <1 MAIN> on or JOIN <1 JOIN> are typically in mySetup.h It needs to be created since no default exists. In IDE, near top, look across the tabs and on far right, a down arrow is there. Click and create a new tab called mySetup.h to configure. When exploring, and possibly as an interim step, commands can be sequentially entered via the IDE serial monitor to help evaluate what happens as each command is executed before creating mySetup.h

    The Join command places OPS DCC signal on B channel (PROG ) output which enables one to drive in to or out of the isolated programming track per following excerpt from DCC EX site.

    The use of the JOIN function ensures that the DCC signal for the MAIN track is also sent to the PROG track. This allows the prog track to act as a siding (or similar) in the main layout even though it is isolated electrically and connected to the programming track output. However, it is important that the prog track wiring be in the same phase as the main track i.e. when the left rail is high on MAIN, it is also high on PROG. You may have to swap the wires to your prog track to make this work. If you drive onto a programming track that is “joined” and enter a programming command, the track will automatically switch to a programming track. If you use a compatible Throttle, you can then send the join command again and drive off the track onto the rest of your layout!

    Hope this helps...

    Attached Files:

    Sumner likes this.
  7. Sumner

    Sumner TrainBoard Member

    Here is a video also using a DPDT switch like what CSX Robert and I were suggesting. It shows a Digitrax command station but your DCC++EX command station is similar with one set of outputs for the main and another for the program track. This is how I have a siding wired on my test track. In your case you don't need the main, just wire the DPDT as if it is there. As Mark said if you have it wired like this and still have a problem then you have something else going on that needs to be corrected...

    I'd use the switch first and make sure things are working before going onto using the 'join' command as there are more software steps there and one could not get one of those right and not find it as easy as using the mechanical switch. Once working then I'd experiment with the 'join' command and see which I liked better.

    Mark Ricci likes this.

Share This Page