DCC++ track power

sachsr1 Jul 13, 2016

  1. Quax

    Quax TrainBoard Member

    27
    5
    8
    Hi!
    I suggest to leave the BRAKE traces uncut (if you don’t really need these pins) as this gives you the option to generate a (BiDiB/Railcom) cutout by some modifications inside the ISR routine. I‘m experimenting with DCC++ using the Arduino DUE (ARM) hardware platform and it looks like I‘m getting a response from the decoder...

    upload_2019-9-9_22-22-19.jpeg
     
    Atani likes this.
  2. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    It definitely looks like you are getting something back from the decoder, both channels of data even possibly.

    I'd exercise caution on the L298 brake pin being used to short the rails together to read the data though.
     
  3. Quax

    Quax TrainBoard Member

    27
    5
    8
    Of course, this is highly experimental stuff. I will report on this project in a separate thread. The basic idea was to add the DUE as a target platform to the original DCC++ project and then going further from there.
     
    Atani likes this.
  4. divad

    divad New Member

    4
    1
    1
    Hey everybody,

    I'm new here and I have some questions about the dcc project I started this weekend.
    I am dutch so I apologise in advanced if my englisch is not correct.

    The problem I have with the dcc++ basestation is dat my programming track is not working correctly.
    I have setup the basestation with a chinese arduino uno and the chinese l289p motorshield. The vin and brake traces are cut correctly.
    The connection with the dcc++ software is good and I can controle the basestation. I noticed that not all lights turn on when I enable power. Channel B gives only one light, channel A turns both lights on.

    With the loco on the main tracks I can controle it perfectly. but when i put it on the programming tracks to change the cv settings the loco just takes off full throttle and all cv readings are 255.

    Also I tried with Rocrail wich gives the same problem.

    When I disconnect the jumper from pin 5 the two lights of channel B reverses.
    To me it looks like that pin 5 is not working correctly so i replaced the uno with a mega but this gives the same problem only other pins.

    Am I missing any configuration of the programming track? or do I have two arduino's wich the timers are not working correct?

    I hope someone can help me with this since I couldn't find anybody with the same problem.

    With kind regards,
    David from the netherlands.
     
  5. H0Guy

    H0Guy TrainBoard Member

    25
    6
    3
    Mr Chuck: I too am looking for the latest source code and instructions and am coming to the same conclusion that no one is maintaining Gregg's original source code.

    The instructions and material on GitHub and on the DCC++ Wiki work well as long as you are using a genuine Arduino Uno or Mega and Arduino Motor Shield. I have both a Uno and Mega with he Arduino Motor Shield and everything works great including getting feedback on my Program Track.

    I have been looking over Gregg's original source codes and believe there are a few "bugs" if you use any motor shield other than the Arduino. Although Gregg has code for the Pololu Motor Shield, I believe that it is an incomplete implementation and you will be get "308 - Engine Not Responding" errors when you program on the Program Track. In addition, Auto Reversing devices, like the Tam Valley Dual Frog Juicer will not work properly with some non-arduino motor shields. And the problem is not due to incorrect jumpers of low voltages.

    I plan to look over some of the other DCC++ implementations and try to decide how to proceed: Use one of these other solutions or update v1.2.1 of Gregg's original code.

    I do not know how much time I can devote to this, so my timeframe is a little sketchy.

    Regards,
    Larry, a.k.a. HOGuy
     
  6. divad

    divad New Member

    4
    1
    1
    Thanks for you reply. I look forward to the solution you will find.
    I believe the deek-robot motorshield works identical to the arduino version and think the problem is in the Chinese arduino uno/mega.
    Unfortunly i can't find a datasheet of the chinese arduino to see where the difference is but i would search it around the counters that could be on other pins then the original or maybe the name of the counter register is different.

    I will contact a chinese supplyer to ask him about the datasheet and maybe some little differences in the chip they use.

    Just to get started with dcc I will buy the original parts.

    Regards,
    David
     
  7. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    The problem you are facing is likely a missing jumper to connect the motor shield's B direction pin to the corresponding pin on the Uno. The Uno requires two such jumpers IIRC.

    Yes, the board is a near identical clone to the original arduino motor shield. I've used it with great success across multiple Mega/Uno boards with the correct jumps in place for the board. I should also note it works well with the Uno form factor ESP32 boards.

    I'd advise against Gregg's code as there are definitely a few bugs in it. @Trusty has created a great rework of it as a library and I've created a more up-to-date version of the Arduino code which added WiFi support via an external ESP8266 (it should work with the Uno/Mega+WiFi boards that are out there now though). I no longer maintain my fork of the Arduino AVR code and instead maintain a compatible but rewritten from scratch CommandStation for the ESP32 (@Trusty I'd recommend dropping the hardware timer code you copied if you still have it in your library, it is buggy and will break under certain circumstances. We should discuss a better approach for your library instead)
     
  8. divad

    divad New Member

    4
    1
    1
    I have made the base station with a (chinese) nano and that is working correct.
    only one thing, cv reading on programming track gives me random results but writing cv values is working properly.
    I think my powersupply is not powerfull enough because I can see the lights flicker when the loco responds to the cv reading.

    so far i am happy and I will let you know when i have a more powerfull powersupply.

    With kind regards.
    David
     
  9. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    Under normal operations the lights should be virtually a constant "ON" unless you slow down the AVR ISR clock cycle (send <D>). Otherwise, there are only a few possible causes but the most likely is power related. Make sure you are providing sufficient power for the Nano *AND* the motor shield. A ~6-7VDC 2A power supply should be sufficient.
     
  10. H0Guy

    H0Guy TrainBoard Member

    25
    6
    3
    If you can successfully write to the locomotive, but only randomly read from it on the program track implies that either your non-Genuine Arduino Motor Shield lacks current sensing, or its current sensing is calibrated differently than the Genuine Arduino Motor Shield.

    A lot of people think voltage is the issue and increase voltage, but when they increase voltage and the track resistance is constant, they are also increasing track current which sometimes corrects for different current sensing calibration issues.

    I believe that the DCC++ coded was designed to only work with “Genuine Arduino and Genuine Motor Shields” and any clone that exactly confirms to their specifications. Many clones do not conform on some aspect of the specification, especially current sensing and as a result don’t work at al or work randomly as your situation.
    HOGuy
     
  11. Trusty

    Trusty TrainBoard Member

    52
    33
    6
    I just wrote a new ESP32 version of the timer code to replace the one provided for AVR DCC++. I just keep the bits extraction macro and replace all the timer logic by a fork of yours. But my version works with only one hardware timer by track. Did you have a good reason to use two timers instead of only one ? Probably i missed something...
     

    Attached Files:

  12. Atani

    Atani TrainBoard Member

    1,460
    1,697
    36
    Ease of coding at the time. I did shift to a single timer in a later version of the code. But I've since replaced the usages of timers with the RMT module since timer ISRs are troublesome on the esp32 with SPIFFS/flash access. The RMT generates a consistent signal but there may be a subtle issue with the high side of the signal which I haven't narrowed down yet, specifically the L298 does not seem to handle the high/low transition on the direction pin. If it does then the signal appears very weak or unusable on the track. I'm still investigating this further.

    Sent from my ONEPLUS A5010 using Tapatalk
     
  13. Travis Farmer

    Travis Farmer TrainBoard Member

    352
    320
    14
    no, actually it was not designed to ONLY work with genuine Arduino hardware.
    right off the official GitHub for DCC++, the config.h file, here https://github.com/DccPlusPlus/BaseStation/blob/master/DCCpp_Uno/Config.h , you can clearly see options for both the official Arduino motor shield, and the other shield known at the time to work, the POLOLU shield (which does not conform exactly with the Arduino motor shield specs).

    DCC++, like Arduino, is open source. it is designed to be adaptable as technology gets upgraded. failure of this ability, and you may as well sweep DCC++ under the rug when the "genuine" hardware eventually becomes obsolete.

    take my variation of the software for example. it adds some new features, and works with a different set of hardware. i haven't had it running for a while, due to lack of space (that i am in the process of solving), but when i used it, it worked quite well, by my testing, and not "randomly" either.

    ~Travis
     
  14. Barry Gordon

    Barry Gordon TrainBoard Member

    23
    6
    2
    What is the recommended power supply voltage for the motor shield? I have both 12 volts and 15 volts available. They are both regulated, and the 15 volt supply is adjustable between 14.4 and 16.8. On my motor shield the Vin trace is cut but not the Brake trace. The only jumper in the shield is 2 to 13

    TIA
     

Share This Page