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

Gregg Aug 25, 2015

  1. esfeld

    esfeld TrainBoard Member

    443
    382
    17
    Gregg
    Thank you for your response. Instead of putting you thru the added burden of new code, I will wait until my Ethernet shield arrives and continue from there. As I stated earlier it is easier for me to conform the what the group seems to be using rather than the other way around ........ but will be defiant and stick with the Arduino Motor Shield rather than go Pololu :) :) :)
    Steve
     
    Scott Eric Catalano likes this.
  2. mikegillow

    mikegillow TrainBoard Member

    116
    117
    13
    After my short circuit tests with the Pololu, I just ordered an Arduino Motor Shield clone to test with. If an AR1 can't trip faster than a Pololu I will need a different option for servicing my turntable. I'm envisioning an UNO+Motor Shield Booster that either has AR built in or more likely is being used to create an engine service power district in conjunction with a commercial AR like the AR1 on the turntable.
     
    Scott Eric Catalano likes this.
  3. HVT

    HVT TrainBoard Member

    74
    93
    15
    I too envision an UNO+Motor Shield Booster/AR. The track plan has two AR sections. In addition to your tests with the AR1 I would be interested to hear from someone who is using a Tam Valley Frog Juicer/Hex Juicer or a Power Shield PSX-AR. I am starting with a Mega/Pololu.
     
    Scott Eric Catalano likes this.
  4. KE4NYV

    KE4NYV TrainBoard Member

    219
    281
    17
    Try Mouser. I deal with them almost exclusively for parts. Usually beats DigiKey prices and if you opt for USPS Priority shipping, they usually get it to my door a couple days earlier than UPS or FedEx.
     
    Scott Eric Catalano likes this.
  5. KE4NYV

    KE4NYV TrainBoard Member

    219
    281
    17
    I want to make it very clear that this is utilizing an RJ45 jack, NOT ETHERNET, just the same connector. I figure that is the most common and easy to terminate these days for most people. Any good ethernet patch cable could be used to tie the throttle to the RS485 DCC++ buss.
     
    Scott Eric Catalano likes this.
  6. mikegillow

    mikegillow TrainBoard Member

    116
    117
    13
    I just set up a reverse loop with an AR1 to test my Mega+Pololu Base Station. Even with the AR1 at its lowest setting (low enough that it was tripping sporadically while the loco was running in the reverse section), the Pololu still reacted faster to the short.
     
    Scott Eric Catalano likes this.
  7. ISCOLD

    ISCOLD TrainBoard Member

    36
    38
    3
    Gregg,
    Great! Now, my Polulo Shield is 100% operational. Main Track and Program Track. Thanks!
     
    Scott Eric Catalano likes this.
  8. mikegillow

    mikegillow TrainBoard Member

    116
    117
    13
    Jason and/or Gregg,
    Am I missing something or do we need to be looking at two RS485 channels: one for a throttle bus for devices to Send commands to the Base Station and one to carry a copy of the DCC signal for use by a Booster Station? After my Pololu short circuit tests I am very interested in how to create a DCC++ Booster Station that isn't dependent on pulling the DCC signal from the main track bus so that I can create independent power districts.
     
    Scott Eric Catalano likes this.
  9. ISCOLD

    ISCOLD TrainBoard Member

    36
    38
    3
    Friends,
    Now, I have my Base Station operational. The last Gregg mapping post was great. I could see my loco running on main track using <D> command in UNO Mega serial monitor.
    Now: I must study Command Base...... or JMRI?, please guys help a beginner on DCC to make a decision. Rsrsrsrsrs

    Regards
     
    Scott Eric Catalano and KC Smith like this.
  10. HVT

    HVT TrainBoard Member

    74
    93
    15
    SUCCESS!!! Just completed a 3 power district test with two Mega/Pololu boards on a test track divided into three electrically isolated blocks.

    Block 1 powered from main output on Master Mega, Blocks 2&3 powered from Mega Board 2 Main and Program. The Pololu boards were set up with the cut traces and jumpers per Gregg's latest revision under GitHub Documentation.
    Board 2 Pins 7&8 were jumpered to Board 1 Pin 12 to provide the DCC signal to all three blocks. Board 1 Pin 9 was jumpered to Pins D2 on both boards. A ground pin on each board was jumpered together. Board 1 was powered via USB and board 2 via the 5 volt input jack.

    Gregg's latest sketch from last night was installed on both Megas. The Master Mega was connected via USB to the laptop running JMRI 4.3.2 and a throttle was opened. Track power on both boards was controlled by the throttle giving the correct green/red track power indications and all four pairs of LEDs on both boards turned on and off. Started the Rio Grande Zephyr F9 in the main block and it ran seamlessly thru each block and complete control was maintained. Launched Engine Driver, connected to JMRI thru the house WiFi and ran the train back and forth several times.

    Gregg, I do have an Adafruit Huzzah CC3000 Wifi shield. Looking at the pinout on the Adafruit site it uses pins 3,4,5,10 and if jumpers are soldered 11,12,13. The jumpers are for MOSI, MISO, SCK which are also available on Mega pins 51,50,52 respectively. Looks like leaving pin 10 open was a smart move. May need some pin mapping and pin assignment changes for our use.

    Thanks to all and let me know how I might be able to help.
    Dave

    PS Mike, your post #748 above just came in while I was typing. These test results may be useful for you.
     
    Last edited: Jan 19, 2016
  11. HVT

    HVT TrainBoard Member

    74
    93
    15
    Iscold,
    JMRI is plug-n-play and is free. It also allows you to connect multiple computers, multiple smartphone throttles, remote control, etc. etc.

    Dave
     
    Scott Eric Catalano likes this.
  12. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Wow - this is terrific! So is the Mega for the second Pololu actually doing anything besides providing 5V to the Pololu (I'm assuming similar to the Arduino Motor Shield that the Pololu still needs external 5V for its on-board logic circuits, even though the H-Bridge gets separate power). Also, how did you control the MAIN ENABLE on the second Pololu? It would need to be driven HIGH, normally by the output of the Mega pin 9. But if you are not controlling the second Mega, the HIGH signal needs to come from somewhere else. Did you retain the jumper from D2 to pin 9 on the second board? That would allow the first board to control the MAIN ENABLE (since you linked the D2s on both boards to pin 9 on the first board). But this could be an issue for the second Mega which, if running DCC++ Base Station, would initialize by setting pin 9 as an output and driving it LOW. One way around this would be to cut the pin-9 connecting trace on the second Pololu and jumper D2/Pin9 on the first board to M1PWM on the second board directly. Regardless, you've clearly demonstrated that the DCC signals can be used to drive multiple Pololus.

    One expansion to this set-up would be to allow each district to have its own short-circuit protection and control. With the Pololu that's not really a need since each board has its own built-in short-circuit protection. But if one of the boards trip, you would need to toggle the MAIN ENABLE on board 1 to reset D2 on the second board. And for the Arduino Motor Shield, the situation would be worse if the MAIN_ENABLE were driven by board 1 -- the Mega on board 2 would have no way of shutting down the power if it detected a short on the tracks being driven by its Motor Shield. As we develop a general method for linking Megas and Unos through the TWI interface we can add logic so that each Arduino would control and monitor its own enable pins, but they can all be controlled centrally from the master Arduino. Lots of food for thought!

    One other question --- you mentioned you have an Adafruit CC33000 WiFi shield. Have you used this with Base Station? From your description above it seems yo used WiFi to connect Engine Driver to JMRI, but still have a wired (USB) connection to the Arduino, correct?
     
    Scott Eric Catalano likes this.
  13. mikegillow

    mikegillow TrainBoard Member

    116
    117
    13
    Dave,
    I understand how you got it to work, but what kind of distance limitation is there when connecting the boards together that way? I would assume inches or maybe a few feet, but I'm only guessing. I might be looking at a 25'+ separation depending on where things land on my planned layout.
    Ultimately I think the Booster Station would need to monitor the Base Station pin 9 as a "master power switch" to control its own pin 9 and have its current monitoring routine altered to automatically turn its pin 9 back on after a brief delay if it detects a short. Otherwise you would have to cycle overall track power to recover from a short in one of the Booster Station districts. In any case, a 3-wire connection to the Booster from the Master pins 12, 9 and digital signal GND.

    (Just saw Gregg's post #752 after I posted.)
     
    Scott Eric Catalano and KC Smith like this.
  14. dcsun

    dcsun TrainBoard Member

    23
    16
    2
    Hello all,

    At the extreme risk of hijacking this thread, can anyone point me to where I might get some assistance tracking down why my new DCC++ Base Station build doesn't seem to be able to read any DCC CV's or control any trains? Should I start a new thread in this board, or is there somewhere specific to DCC++ I should be asking? I didn't see a specific forum or where to ask for help on the GitHub page.

    Many thanks!

    Dave
     
    Scott Eric Catalano likes this.
  15. HVT

    HVT TrainBoard Member

    74
    93
    15
    Gregg,
    This was a proof of concept, one logic level DCC signal, multiple power boosters. Same as using my two Digitrax Zephyrs with one in booster mode.

    Pololu 2 MAIN ENABLE and PROG ENABLE were both left connected to the Mega 2. The only change on Pololu 2 from your diagram was to remove the ends of the jumper wires from pin 2 & 12 and connect them to Pololu 1 pin 12, and to remove the D2 jumper wire from Pololu 2 pin 9 and connect it to Pololu 1 pin 9.

    This is a trial run to see if one DCC signal could comand three power districts, and it works very well. This should evolve into power districts that can be controlled/reset by their respective Mega while using a single, centralized DCC signal. SF and separate resets are future code work. I did note that if the power is off on one district, when the loco enters the district the red/green LEDs dimly light (feed back thru the loco from the adjacent district).

    Correct, WiThrottle was connected thru the home router to JMRI, then thru USB to Master Mega 1. (Thank you TwinDad for all your hard work to make this possible) I ordered that WiFi shield when I read that TwinDad had one, and was pleased that you had tried to purchase the same board last weekend. I am watching to see where you and TwinDad go with this WiFi shield.

    Mike,
    I too am planning a 20'-25' distance between the two boards, but that distance shouldn't affect the timing of the DCC signal, which I believe is the critical thing. It was a 3-wire connection proof of concept. Managing power and resets in the slave Pololu is future code work for someone more skilled than I.

    Edit: I did pay special attention to the phase of each power connection. AR will be a separate issue.

    Thanks again for all those who have put so much into this project.
    A very happy Dave
     
    Last edited: Jan 19, 2016
    Scott Eric Catalano likes this.
  16. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Hi Dave, we don't have a separate thread for different types of questions (which probably would be a good idea). For now, please feel free to post any questions here. Can you describe the setup and issue in detail?

    -Gregg
     
    Scott Eric Catalano likes this.
  17. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    Thanks for the clarification, though I'm not sure I understand how the second motor shield is actually able to produce any output. You've connected the M1DIR and M2DIR pins from the second Pololu to pin 12 of the first Pololu. That makes sense and now the Main DCC signal from the first Mega is driving both H-Bridge direction inputs of the second Pololu. But you still have to enable the H-Bridge outputs by driving pins 11 and 9 High. Issuing a <1> command on the first Mega will turn those pins on the first Pololu. But what causes those pins to go High on the second Pololu? Are you separately issuing a <1> command to the second Mega and then removing the USB? On power-up DCC Base Station sets the enable pins Low until it receives the <1> command.
     
  18. dcsun

    dcsun TrainBoard Member

    23
    16
    2
    Thanks for the reply (and for the DCC++ system, it looks really neat and I'm looking forward to using it and hopefully contributing back to it in some way). I have an Arduino Mega 2560 and Arduino Motor Shield (both rev 3) connected to a PC running Ubuntu Linux (but it could be something else) by USB. I've cut the power jumper on the bottom of the shield and attached a laptop power supply set to 15V / 5A to the shield's input, put a wire from the shield's pin 2 to 13 (number labels, actually the third and 14th pins), and attached the shield's B outputs to a small section of track. The Arduino software seems happy enough compiling and uploading the DCC++ code, and I can send commands to the system through the console window and get the Arduino to respond. 0/1 seems to work okay to turn it on and off, D makes the lights do their alternating blink, and I've gone through the troubleshooting steps on the DCC++ site moving the jumpers around to see that the pins are right (they seem to be), but that's as far as I seem to be able to get. Sending command t returns a <T # #> but doesn't send any voltage to the loco's motor, and R never returns CV values always -1. It's a brand new NCE D13SRJ decoder I've installed in a loco. I don't have any off the shelf DCC locos or controllers, I was hoping to build this all myself, but if I have to go buy something I'm not completely opposed to doing that. Any help narrowing down where my issues are is greatly appreciated! :)

    Dave
     
    Scott Eric Catalano likes this.
  19. TwinDad

    TwinDad TrainBoard Member

    1,844
    551
    34
    OK, I'm looking into it... I'll see what I can find...

    I also *might* start a separate thread for JMRI support here... it's getting pretty noisy in here with all of the activity (which is a good thing, don't get me wrong!) but my ADD kicks in and I want to be able to focus and give good "customer service"...
     
    Scott Eric Catalano likes this.
  20. tz3p9v

    tz3p9v TrainBoard Member

    12
    18
    16
    Dave... I believe the main track power is connected to the "A" output. "B" output is the programming track. Give that a try ... can't hurt. see https://github.com/DccPlusPlus/Documentation/blob/master/Motor Shield Pin Mappings.pdf

    Paul.
     
    dcsun and Scott Eric Catalano like this.

Share This Page