Modifying DCC++ for multiple power districts

crusader27529 Aug 19, 2016

  1. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    I've been remiss with this topic, and just now saw your work........don't know when I'll be able to test it, but I will definitely dopwload and use it......

    It works on a standard NANO, right? I don't need a MEGA, do I???
     
    Scott Eric Catalano likes this.
  2. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    no idea on the nano, as i don't have one to test it with... :unsure:

    ~Travis
     
    Scott Eric Catalano likes this.
  3. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Just saw your updates.....should have been monitoring the thread, but I screwed up......

    Went to your github, don't know what to download.......also, t'll work on a NANO, right?
     
    Scott Eric Catalano likes this.
  4. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    I'll figuire out how to make it work on the NANO, but is the code for a MEGA or UNO?
     
    Scott Eric Catalano likes this.
  5. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    I figured out whick code is correct, but I have no idea how to download it......I tried to use github before, and found it impossible......HELP!
     
    Scott Eric Catalano likes this.
  6. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Changed my mind.....not sure which code to download, IF I could figure out how tyo download it.......there's got to be a better/easier way.
     
    Scott Eric Catalano likes this.
  7. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    it was designed on a MEGA 2560.
    as for what to download...
    https://github.com/travisfarmer/DCCpp/archive/master.zip
    ...should zip up and download a complete copy for you (may want to keep it separate from the regular DCC++ code on your computer, just in case). it has been a while, but the ReadMe describes my hardware used. the PDF file is the schematic of the connections i used.
    i wasn't saying you had to use it ;) i was really just wondering it it ever got used.

    ~Travis
     
    Scott Eric Catalano likes this.
  8. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    sorry, the better copy is in the development branch:
    https://github.com/travisfarmer/DCCpp/archive/Development.zip
    ~Travis
     
    EssexDan and Scott Eric Catalano like this.
  9. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Got it.....I'll go through the code to see where it needs to change pin assignments for the NANO vs MEGA......I have a MEGA, but don't use it for DCC++.

    I was designing a PCB with multiple connectors for use with IBT_2 (BTS7960) motor drivers (6 of them), all controlled by one NANO. I plan on releasing the necessary files for PCB manufacture to anyone who wants it.......
     
    Scott Eric Catalano likes this.
  10. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    I used some of it in my updated base station code, I will be pushing a more extensive rewrite of the CurrentMonitor code to support as many power districts as the Arudino has analog pins.
     
    EssexDan and Scott Eric Catalano like this.
  11. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Timeframe??

    Uno or NANO or MEGA???
     
    Scott Eric Catalano likes this.
  12. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    Just looked and the code is up on github already. It will work with both any Arduino board. I don't have accurate numbers for the BTS board (yet) since I need to adjust things a bit but send me a diff if you adjust it to work for you. I am looking to have it cut out at ~5A and ~10A by default.
     
    Scott Eric Catalano likes this.
  13. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    personally, i have my over-current cutouts set to the limit of my power supply. my plan was to use automotive style fuses at the track feeders. though in thinking about it, that would be a pain in the ***, finding the correct fuse that had blown. though, an indicator for the fuse could be fashioned with a correct-valued current limiting resistor, and an LED that shunts over the fuse. when the fuse is good, it shorts the LED, so it won't light. when the fuse blows, it will allow a small current through the limiting resistor, and light the LED. though the LED will allow power to the track, the current will be very small.

    ~Travis
     
    Scott Eric Catalano and Atani like this.
  14. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    Atani,
    just curious, was the auto reset on track short used? i didn't find it in the source, that i noticed anyway. I was rather fond of that feature. ;)

    Still studying the code, trying to figure it all out.
    to use an analogy, i kind of feel like a designed a car, but it was later converted to a sports car. just trying to find my legacy. ;)

    ~Travis
     
    Scott Eric Catalano likes this.
  15. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    It should be there. It should be brought back if it is missing and we can add per power monitor a reset timeout.

    Sent from my ONE E1005 using Tapatalk
     
    Scott Eric Catalano likes this.
  16. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    Sorry for my late response, i have been neck deep in DIY CNC machine research (trying to branch out my knowledge). I haven't fully digested the code yet, but as i suspect i will have a few days off from work for some minor surgery (nothing life threatening), i will have plenty of time to finish digestion.

    As i am still interested in drafting up a all-inclusive DCC++ documentation, it will be helpful to have fully read through the code.

    ~Travis
     
    Scott Eric Catalano likes this.
  17. brendanf

    brendanf TrainBoard Member

    62
    54
    8
    Hey guys it's been awhile for me too.. I have been working on my own version of the multiple power districts each with its own current sensing, shutdown, and auto-restart.. For the life of me I cannot find in the code though is how the total current (for both the PROG and MAIN) is calculated.

    I see the routine in CurrentMonitor.cpp where it calculates each current, but are they added together somewhere before being sent to JMRI?

    My setup is using 3 Arduino shields stacked for a total of 6 zones (including the PROG). I am cutting some of the leads on each shield and using jumpers for the A0-A5 inputs (current sense) and also using 4 extra outputs from the Mega as Enable pins (3&11) on the other 2 shields..
     
    Scott Eric Catalano likes this.
  18. Atani

    Atani TrainBoard Member

    1,469
    1,756
    37
    DCC++ does not add up the power districts today. Each one is reported individually to JMRI. There is an update to JMRI in the works to support interpretation of this as well.
     
    Scott Eric Catalano likes this.
  19. brendanf

    brendanf TrainBoard Member

    62
    54
    8
    Ah, that would be why I could not find it then.. Good to know.
     
    Scott Eric Catalano likes this.
  20. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Just to get this correct......there are several sets of code around for multiple power district use, and I'd like to know some details of the current state of things.

    Concerning MD boards, what needs to be configured in order to adjust the Arduino to correctly sense over-current? Also, what Arduyino modules are used? How many power districts are supported? Is there an easy way for someone (me!!??) to configure it all? I have a decent history in C code, but nothing in C++. I don't require anything beyond train control.

    Has the number of registers(?) been increased beyond the original design of 12 in order to now control more trains now that the system would logically be connected to a larger layout that you'd expect to run more trains?

    There were 2 different proposals on how to respond to over-current detection......one was to delay restoring power, and looping several times, and then leaving power off until manually commanded to restore it. The other was to loop forever, and not 'give up'. Because of the way JMRI operates, it'd make more sense to me for the second implementation.

    Ideally, what would be perfect would be a relatively simple table that could be edited before compiling the sketch that could set the number of locos allowed, the number of power districts, and the sense parameters for each MD attached to the system. That's what I'd do if I could program in C++.......

    Can we coordinate this effort some??
     
    Scott Eric Catalano likes this.

Share This Page