DCC++ EX Software Thread

David Cutting Apr 8, 2020

  1. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    That is a very good point for me to put in our notes. The way the engine jumps can effect the CV reading if the track isn't 100% conducting. And yes, you can still adjust the power out.
     
  2. ardsuppi

    ardsuppi TrainBoard Member

    33
    8
    3
    @FlightRisk

    How to adjust the prog power out?
     
  3. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    Ciro, I forgot what I was talking about! What did you think I meant and I can answer that question :) In general, we start with power off, but can change that with a setting to start with power on. We have <1> for all power on like in Classic, and <1 MAIN> and <1 PROG> to turn each track on separately. The program track is limited to 250mA according to the NMRA standard, but we can override that. We also have a new feature with the mySetup.h file. You can put all kinds of settings in there and compile and upload it instead of having to make changes in code. Thinks like ACK duration and the amount of current we respond to, track power, motor driver pins and settings, etc. can all be configured now. You can also enter setup commands at runtime that last until the CS is reset. Rocrail may want to use that feature. I'll send them an email
     
  4. ardsuppi

    ardsuppi TrainBoard Member

    33
    8
    3
    @FlightRisk

    I cannot find the file mySetup.h you talk about in the commandStation-EX zip folder, where do I find it?
     
  5. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    You need version 3.0.3 or later. If you don't have it, you can download and install the "master" branch. The "nanoEvery2" branch is the latest and greatest and will soon be moved to master and then released. If you want that, you can get it here: https://github.com/DCC-EX/CommandStation-EX/tree/nanoEvery2

    The direct link to the zip on that page is: https://github.com/DCC-EX/CommandStation-EX/archive/nanoEvery2.zip

    That file doesn't exist, you have to create it. Make sure you capitalize the "S". Inside that file in a text editor, you can put all sorts of commands. Example:

    SETUP("1 MAIN") // Start with power to the main track on. Just a "1" would turn both tracks on
    SETUP("D ACK MAX 9000") // Set ACK detection to allow pulses up to 9000 microseconds long
    SETUP("1 JOIN") // Start with 2 main power districts instead of a "main" and a "prog"

    We still have to write the documentation on this, hopefully that will be complete by next week. Just compile this and upload it. Here is the command reference: https://dcc-ex.com/reference/software/command-reference.html
     
    KC Smith likes this.
  6. french_guy

    french_guy TrainBoard Member

    628
    374
    28
    You mention V3.0.3, but when I look at the DCC++EX website, I only see V3.0.0...
     
  7. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    You are looking at the official release read the previous message that you copied above where I explain it and provide the links :) You can use the master branch or the nanoEvery2 branch I linked to. That will become the master branch in the next day or so and then the next release shortly after that.
     
  8. french_guy

    french_guy TrainBoard Member

    628
    374
    28
    Well...."master branch" or "nanoevery2 branch" makes me wonder what language you speak.................. (n)(n)(n) lol
    I'm kind of ignorant with all that Linux stuff
     
  9. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    LOL, gothcha! Yes, that language is "Git Stuff" :) Git uses branches of a tree as an analogy for tracking versions of code or documents or a movie script or recipes for that matter. When we create a release, it zips it all up on the releases page and adds the version number. It locks things in place and that is the final version. The fact GitHub renames the zip AND the folder inside it is annoying, so we point to a zip file WE create ourselves that doesn't rename the folder since the .ino file and the folder name both have to be named the same in the Aduino IDE (another annoyance!).

    Anyway, the "Master branch" is the code we are working on that will become the next release. "Feature Branches" that test out new features and ideas can be in lots of other branches while we figure out if they are safe to put in the master branch. "What if I use 10 cloves of garlic? Oops, scrap that idea!" The master branch is the beta version that has passed our tests and doesn't seem to have any major bugs. All the other branches could be in any state :) So if I work on something and you work on something, we can happily change things in our branch and then both of our changes can get "Merged" into the master branch at some point since these trackers only track what things change. So if I add garlic and you add onions, and Ciro thinks we should take out peppers, the master recipe is going to call for garlic and onions and peppers will disappear when all our branches get merged. It's just a way a team of people can all work at the same time on a project without stepping on each other and allow us to go backwards in time to a previous state if we really mess up :) Probably more info that you wanted to hear, but thought I would explain if anyone was interested.
     
    Sumner, french_guy and KC Smith like this.
  10. Kuba

    Kuba TrainBoard Member

    10
    2
    5
    Will you drop support for ATmega2560 and ATmega328? Or will support for other microprocessors be added to the nanoEvery version?
     
  11. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Fred; Just uploaded v3.0.4 love the oled displaying the IP and port! Hopefully fixing the WiFi static IP is next. Well done and thank you.
     
  12. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    You are welcome! Yes, more to come. Lot's of work to do. :)
     
  13. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Fred; While, as I have indicated previously, I have successfully used DCC-EX with Dual Motor Driver Board Module H-bridge DC MOSFET IRF3205 and (MEGA+WiFi R3 ATmega2560+ESP8266) using PWM2-pin 11 .. DIR2-pin 2 .. PWM1-pin 3 .. DIR1-pin 12, I have two new counterfeit boards from China that do not respond with that configuration.
    You mentioned somewhere that you had different pinouts for this combo but I can't seem to find it. I would much appreciate it if you could dredge it up as my attempts to configure these boards have gone nowhere ...... unless, of course, these are just bad boards. Thank you
     
  14. Ash

    Ash TrainBoard Member

    106
    67
    8
    This is a draft document on transition to DCC++EX -- how I have my IRF3205 board setup... Page 3 might help. But you will need to adjust for your current sensing parameters. What are you using for current sensing? This shows ACS724 being used as common current sensor for both main and programming tracks, connected to A3.
     

    Attached Files:

  15. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Thank you, that gives some helpful info to play with.

    I have NCE EB1s on all operational trackage.
     
  16. Ash

    Ash TrainBoard Member

    106
    67
    8
    If you are not using DCC-EX current sensing on the analog input pin as specified in the motor board settings, you will want to connect a resistor from that pin to ground. @FlightRisk

    I have had some success with IRF3205 reading CV's on the programming track, using a common current sensor. The locoduino site shows a board modification and the use of a MAX471 0-3A current sensor, but I wanted to avoid the board modification. Pololu ACS724 (0-10A version) is on order, and should be tested in the next week.

    I am advised that for programming with common current sensing, the main track should be powered off. The program track is automatically powered as needed, or you can use the <1 PROG> command to keep it powered while programming (it might help keep capacitors charged if keep alive exists).
     
    esfeld and FlightRisk like this.
  17. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    I should also have mentioned that I do all CV programming using JMRI on a programming track siding that kills power to the main tracks when in use and only rely on my numerous CS/throttles (DCC-EX .. Mega/Nextion .. ESP32/Nextion .. Wang Tongze/Uno .. NCE Powercab etc etc) for operating. Yeah, I've been doing DCC for a while now through all its iterations. :)
     
    FlightRisk likes this.
  18. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    I think we have things confused about the motor board pins. All the images and advice so far is for DCC++ Classic and Uno vs. Mega. It doesn't work that way anymore. We have in the config.h a "Motor Shield Type" definition. We have STANDARD_MOTOR_SHIELD, POLULO_MOTOR_SHIELD, etc. We need help creating something like an IRF3205_MOTOR_BOARD". The issue is what pins connects where and equally important, what the current sense conversion factor is for how you are using current sense. That board has none, so you would have to figure out the value. So here is the Arduino, Deek-Robot, etc. motor shields:

    motor shield type - There are 2 sets of these values in the definition, one for the Main track output and one for the Program track
    ----------------------
    power_pin - aka enable, aka PWM. Signal is always being sent out the signal pin, this turns on the voltage to the H-Bride to one track.
    signal_pin - aka DIR, aka CW/CCW - The DCC signal. We actually switch what is normally the "direction" pin to make the waveform
    signal_pin2 - For boards that have separate direction pins like the IBT_2
    brake_pin - normally not used but we can use this for a cutout
    current_pin - the analog pin that we will get current sense information
    senseFactor - a calculated multiplier that lets us get current in mA from the analog pin reading in volts
    tripMilliamps - the value in mA we want to consider an overcurrent situation and "trip" the software breaker)
    faultPin - Some boards can generate a special fault condition and we can report that.
    Code:
    The STANDARD_MOTOR_SHIELD type
    ------------------------------------------
    
                        Main(1)     Prog(2)
    PWM/EN               3           11
    Signal1/DIR(a)       12          13
    Signal2/DIR(b)      N/A          N/A ( N/A is actually called UNUSED_PIN)
    brake               N/A          N/A
    current              A0          A1
    sense factor        2.99         2.99
    trip mA             2000         2000(but we limit this to 250mA internally for program track)
    faultPin            N/A          N/A
    
    So from the Bunza diagram with the colored lines going to pins on the IRF board, pins 3 and 11 are correct, but 10 and 5 need to be 12 and 13. OR, you can change the definition to use those signal/direction pins. Bottom line for this board, you want PWM1-3, PWM2-11, DIR1 - 12, DIR2 - 13 if you are going to use both H-Bridges.

    But we have no current sense on this board, so now we get into unlimited combinations. Do you try to use this board to do program and main? Use a motor shield for prog and this for main (our recommendation)? You can use only half of the IRF board (1 of the H-Bridges). That means we really should create a new motor board type in the config.h file. We can use the pins above for both tracks, but you would have to connect some kind of external current sensors to pins A0 and A1 and then use their volts per amp to set the sense factor from 2.99 to whatever we would calculate for that board.

    And this is the exact code (minus the things we don't know yet) you would cut and paste into the config.h file to use this board for both main and prog with main set for 5 Amps.

    You find this line:

    Code:
    #define MOTOR_SHIELD_TYPE STANDARD_MOTOR_SHIELD
    And replace it with this (we have to figure out what to put for "???"):

    Code:
    #define MOTOR_SHIELD_TYPE IRF3205_MOTOR_BOARD
    
    #define IRF3205_MOTOR_BOARD F("IRF3205_MOTOR_BOARD"), \
    new MotorDriver(3, 12, UNUSED_PIN, UNUSED_PIN, A0, ???, 5000, UNUSED_PIN), \
    new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, ???, 2000, UNUSED_PIN)
    
    And here is an Arduino Motor Shield for Program and the IRF for Main:

    Code:
    #define MOTOR_SHIELD_TYPE IRF3205_WITH_ARDUINO_MOTOR
    
    #define IRF3205_WITH_ARDUINO_MOTOR F("IRF3205_WITH_ARDUINO_MOTOR"), \
    new MotorDriver(3, 12, UNUSED_PIN, UNUSED_PIN, A0, ???, 5000, UNUSED_PIN), \
    new MotorDriver(11, 13, UNUSED_PIN, UNUSED_PIN, A1, 2.99, 2000, UNUSED_PIN)
    
    In the first example, you need separate current sense boards for A0 and A1. In the second example, the motor shield is all set and you will just need to connect a current sense board to pin A0. You could just depend on fuses or circuit breakers too. You would get no current output in JMRI.
     
    Last edited: Mar 5, 2021
    KC Smith and esfeld like this.
  19. esfeld

    esfeld TrainBoard Member

    442
    382
    17
    Fred; An excellent clarification .. and yes, the IRF3205 should definitely be a config.h selection albeit with a clarification and description about the current sense issue since this so relevant to how one uses the CS.
     
    FlightRisk likes this.
  20. Sumner

    Sumner TrainBoard Member

    2,798
    5,841
    63
    For anyone reading this thread that is interested in a DCC option for well under $100.00 and is looking into DCC++EX as that option you don't have to understand one word of what these guys have been talking about to make it happen. They are just looking at ways to make it more flexible and take it too new heights in ways incomprehensible to the majority of us.

    Don't let it scare you away. Take a look at it ....

    https://dcc-ex.com/

    ... and ask any questions if you have them. It is a great option for many of us,

    Sumner
     
    Ash and KC Smith like this.

Share This Page