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

Gregg Aug 25, 2015

  1. Ravindra

    Ravindra TrainBoard Member

    56
    76
    5
    Thanks for your answer. No I am not powering the decoder from track but powering it separately from 5A power supply. Is there any other thing that can cause it?
     
  2. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    I can't think of anything specific that might lead to that sort of behavior. It could very well be a bug in the base station code or it could be on the JMRI side. There are a lot of factors. From the JMRI side confirm that it is sending the DCC++ command out via the traffic monitor. For the older DCC++ Arduino code there is no easy way to monitor the serial stream without interfering with the operations in JMRI. But if you could monitor the raw bytes being sent/received by the Arduino you could isolate it a bit more if the command is either not arriving or is being rejected for some reason.
     
  3. Ravindra

    Ravindra TrainBoard Member

    56
    76
    5
    When I send any command from JMRI I get the RX light to blink on the arduino stationary decode . but when the train runs fast this also not respond or blink consistently. do you think it has anything to do with serial communication speed? its set to Serial.begin(9600); is incresing it to Serial.begin(15200); help?
     
  4. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    It could be but I don't know for certain, I'd suggest 115200 as the speed as it should be capable of supporting that as well a the DCC signal generation without issues.
     
  5. Ravindra

    Ravindra TrainBoard Member

    56
    76
    5
    Thanks I will try changing the serial communication speed and will let you know if that solves the problem.


    on other note can you please tell me how to connect sensor to arduino using dcc++ and then how to configure the address inside the arduino? its very unclear to me. I want to use hall effects sensor for block detection but don't know which pin I have to connect on arduino and how to tell dcc++ sketch to add those sensors.
     
  6. Atani

    Atani TrainBoard Member

    1,331
    1,028
    27
    I don't know for sure as I don't use the Arduino for that at this point. I only use them as stationary decoders for switches. For block detection I'm using current transformers via an I2C ADC board and that information is sent via LCC to any consumers of that data (signals, etc). I also don't use an Arduino AVR board for the base station, I'm fully over to the ESP32 with my CS code.
     
    Ravindra likes this.
  7. Barry Gordon

    Barry Gordon TrainBoard Member

    23
    6
    2
    I am a returnee to model railroading having been gone for about 60 years (I am 80). I am an electrical engineer/programmer (retired) so I can figure most things out. Right now I am a little stumped and could use some help. I have two test tracks (One PROG (9") and one OPS (27")) set up in my office so I can play and learn what I need to know. I have put together on a breadboard base; a Raspberry Pi, an Arduino Mega, and a motor shield. I have downloaded the Arduino IDE and loaded the Arduino with the latest DCC++ from Github and the RPi with the proper version of JRMI. At the current time, I am just playing with the serial monitor of the IDE at 115000 baud and things seem to be operating. I ran Greg's diagnostics from the IDE serial monitor and everything passes. The commands <s>, <1>, <0>, and diagnostic mode (<D>) all do what appears to be correct (The appropriate LEDs come on and/or flash). I am powering the motor shield with 12 volts at 1.2 amps (regulated) for now.

    I purchased a Paragon 3 Rolling Thunder switcher. If I place that loco on the PROG track and send the command <R 7 0 0 > I get a reply of (r0|0|7 -1>. This reply is returned whenever I try and Query a CV. The command <s> returns <iDCC++ BASE STATION FOR ARDUINO MEGA / ARDUINO MOTOR SHIELD: V-1.2.1+ / Dec 13 2019 13:21:21><N0: SERIAL><X><X> which I believe is correct for my configuration. Interestingly enough of I take the engine off the track so the PROG track is empty, a command of <R 7 0 0> returns the same reply <r0|0|7 -1>.
     
    ghuening and Erik84750 like this.
  8. John W Zerbe

    John W Zerbe TrainBoard Member

    96
    59
    6
    Can you make the loco respond to commands on the default short address of 3?

    Sent from my SM-N975U using Tapatalk
     
  9. RCMan

    RCMan TrainBoard Member

    255
    112
    9
    The Paragon 3 is a difficult decoder to read the CV's. Had the problem at the club and members tried several different Command Stations and could not read the CV's. Members had several engines with factory installed decoders.
    The only command station that could read the CV's with about a 98% readability was the DR5000, but had to adjust the programming parameters some to achieve this. I am seeing more decoders coming out with unique timing and power settings.

    Here are the changes for the DR5000
    The ACK Delta Current down to around 40 - 45 and Programming Track Current to 800. I used ACK Delta Current of 40. Using JMRI.

    This might help you figure out if your command station can be changed.
     
  10. Barry Gordon

    Barry Gordon TrainBoard Member

    23
    6
    2
    Things are moving forward. I now have two command units each being driven by a Raspberry Pi running JMRI. Both command units are now able to control the locomotive. I really am not sure what changed but I never look a gift horse in the mouth. I am not sure I have to change any CV's other than CV#1 but I am sure I will learn if I need to. One command unit is the original I was working with (DCC ++) and the other one is a Pi-SPROG.

    My T&E (Test & Evaluation) system is a very simple switching yard consisting only of straight tracks (except at turnouts) turnouts crossovers and bumpers. All track is KATO N-Gauge uni-track. The layout will be sitting on a shelf below the screen in my Home Theater. The shelf is 10 inches wide and 10 feet long. The screen is approximately 6" above the shelf, but I plan to keep the layout low in height. Eventually, when I am more comfortable I will construct a more complete system. My main interest is in the "control" of things and I am using the IOS app as my throttle. I interface to the RPi (JMRI) using VNC (Virtual Network Control) from my main system; the RPi runs headless (no mouse, keyboard or monitor). I plan to run two or perhaps three locomotives but no more on the T&E

    A couple of questions If I may:

    With this minimal layout do I need a booster? If so how many? I was planning to run the T&E system as a single electrical zone with multiple feed points. I could divide it into blocks without a problem. Here is the original track plan which was in a 12"x 60". I plan to lengthen it by the inclusion of additional straight track. The grey areas are places for structures which I might not include.

    10x60_01-std.png
    The main power source will be 15 volts DC capable of sourcing 7 amps (105 watts).
    Do I need short circuit protection? What would be a recommended circuit breaker?
    The track (KATO Uni-tracK) will be mounted on a 3/4" thick board with 3/4" standoffs from the granite shelf. This will provide room for wiring and terminal blocks. What method is suggested to mount the track to the board? White Glue? Nails?

    I appreciate any and all advice/assistance
     
    Last edited: Dec 16, 2019
  11. RCMan

    RCMan TrainBoard Member

    255
    112
    9
    No additional booster required. you should have enough power in either command station booster to handle that layout.
     
  12. Keith Ledbetter

    Keith Ledbetter TrainBoard Member

    268
    176
    9
    The pisprog and dcc++ both have built in short circuit protection so the short answer is you dont NEED extra. I however still use an additional on to the tracks they act quicker, etc and I dont want to take the chance. I have used NCE in the past. I now use ones built from MERG kits as they are much cheaper and work great.
     
  13. Barry Gordon

    Barry Gordon TrainBoard Member

    23
    6
    2
    Thanks for the reply. I will look into additional short circuit protection
     
  14. rva1945

    rva1945 TrainBoard Member

    111
    39
    7
    I had no problems reading the CVs with JMRI on the Paragon switcher.
     
  15. Robert C

    Robert C New Member

    4
    0
    1
    I've decided to get back into model railroading and being an IT guy I decided to jump right in with putting my own Arduino together and loading up DCC++. My parts arrived today (Arduino Mega 2560 and Motor Shield) and I'm having an issue getting through the diagnostics.

    In the first section: ###Testing the Arduino and Base Station code###
    I cannot get the LED on pin 13 to toggle. The serial monitor is reporting back <p0> or <p1> but the LED just stays lit. It lights up as soon as I upload the compiled DCC++.

    HOWEVER

    I went on to the next section: ###Testing the DCC signal###
    It blinks like it's supposed too for both pins 12 and 2.


    I created a blank sketch and just put digitalWrite(13,LOW) in the setup code and left the loop blank and it shuts off the LED on pin 13. But as soon as a send over the DCC++ it lights up again and will not respond to <0> and <1> in diagnostic mode. I also created the "blinking sketch" and was able to blink the pin 13 LED from pins 12 and 2 (with the jumper connecting them to 13 of course) with no issues.

    Just to see if I could trace through the code (I'm a coder) and troubleshoot it myself I commented everything (except the defines) out of the setup and loop methods so I THINK it should be doing nothing. Then I loaded the LED 13 shutoff sketch to turn it off, then reloaded the DCC++ sketch with the commented out .ino and it STILL turns LED 13 on. I even added digitalWrite(13,LOW) at the start if the setup method in the DCC++ code before all the commented out code and LED 13 still lights up and stays lit after loading the compiled DCC++ sketch.

    The commented out code doesn't respond to any diagnostic commands or send the start up config back when I send the DCC++ over so I know I've turned it off so I'm stumped as to why the LED 13 is coming on and staying on. I even tried putting the blink code into the loop and it blinks OFF once and then stays on. I'm tired and done for the day so I'm going to bed but if anyone has any guidance I would appreciate it.
     
  16. tnt23

    tnt23 TrainBoard Member

    27
    12
    2
    Hi Robert,

    Just a quick thought, could it be hardware issue, like current leak or short circuit between ATmega2560 pin controlling LED on output 13 and the rest of the board, or even to adjacent pin(s) of the micro? I'd suggest inspecting your MEGA with some magnifying glass, cheap Chinese boards are notorious for their sloppy solderwork.
     
    Last edited: Jan 15, 2020
  17. Robert C

    Robert C New Member

    4
    0
    1
    The board has "Assembled in Italy" and the Arduino logo and URL stamped on it and the solder work is remarkably clean. Also I can control the LED output through the bare bones blinking and clearing sketch I wrote and within the second diagnostic routine so I don't think it's a hardware issue.
     
  18. Robert C

    Robert C New Member

    4
    0
    1
    More info:
    Hardware:
    Arduino Mega 2560 Rev3
    Arduino Motorshield Rev3
    Both purchased from Amazon and they came in Arduino branded boxes with the Arduino hologram sticker attached and Arduino package inserts (and stickers!). I paid a little more for them so I don't think they're knockoffs.

    Software:
    I'm using the latest master build from GitHub labeled "Revert "Initial Build of DCC++ Server"" committed Jan 31st 2016/
    I tried using the 1.2.1 release build from Dec 27, 2015 and it gave me the same results but it's 8 commits behind master and doesn't include the diagnostics code.


    This mornings experiments:
    I've created a new project in a new folder labeled "DCCpp_Uno_Remaster" from the latest master build from GitHub labeled "Revert "Initial Build of DCC++ Server"" committed Jan 31st 2016. I had to do it by loading the master project from GitHub and using "Save As" because just copying the folder gave me the "This sketch has to be run from the DCCpp_Uno folder!" annoyance message.

    I changed this line in the <0> <1> command block:
    INTERFACE.print("<p1>");

    to this:
    INTERFACE.print("<p1-PROG:" + String(SIGNAL_ENABLE_PIN_PROG) + "-MAIN:" + String(SIGNAL_ENABLE_PIN_MAIN) + ">");

    And it showed me it was trying to work off pins 3 and 11 as defined in the Arduino motor shield section instead of pins 12 and 2:
    #define SIGNAL_ENABLE_PIN_MAIN 3
    #define SIGNAL_ENABLE_PIN_PROG 11

    I changed those from 3 and 11 to 12 and 2, respectively and now the first part of the diagnostic works, I can turn the power signal on and off. But now the second part of the diagnostic (###Testing the DCC signal###) does not work where it's flashing the LED although it does report back "Entering Diagnostic Mode". Also just to see if it was turning on the power in the motor shield I went ahead and mated it to the Mega 2560 and toggled the power through the pin 12/2 setup and the power LEDs did not come on.

    I have to go do other stuff now but I'll come back to this later, just providing the play-by-play for those interested and possible guidance.

    Updates:
    I reverted back to the original code and was able to run through the diagnostics properly by connecting pin 11 and 3 for the first two tests. Then I plugged in the motor shield and went through it's tests and it worked fine, and the lights on the loco light up when the power is switched on. But it isn't being detected by the JRMI app and it's not responding to the DCC++ Controller app either. But I'm not sure if I've entered the right cab number in the config, I just used the road number on the side of the loco. It's a brand new atlas on brand new track but since I can't seem to get it to respond I'm not sure if I'm referencing it correctly.
     
    Last edited: Jan 15, 2020
  19. Sumner

    Sumner TrainBoard Member

    865
    940
    18
    If it is brand new try address 3,

    Sumner
     
  20. Robert C

    Robert C New Member

    4
    0
    1

    w00t! w00t! Chugga Chugga.... It works!

    Had to move the pin 13 jumper to connect from 3 to 2 and THEN put the loco on the programming track (I know...duh...)

    It detected it automatically and it was address 3 just like you said it would be, so thanks for the tip!

    Looking back it's setup exactly like it's supposed to be but somehow I got my wires crossed (pun intended) and got off on the wrong track (second pun) but now I'm rolling (last one, I promise) !
     

Share This Page