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

Gregg Aug 25, 2015

  1. robteed

    robteed TrainBoard Member

    18
    8
    8
    Hi Guys,
    I'm at an impasse here. I have an Arduino Uno and have tried installing the code and am getting this error. Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Uno"

    Accessories.cpp:66:20: fatal error: EEPROM.h: No such file or directory
    #include <EEPROM.h>
    ^
    compilation terminated.
    Error compiling.

    This report would have more information with
    "Show verbose output during compilation"
    enabled in File > Preferences.
    Any idea what I'm doing wrong here?
     
    Scott Eric Catalano likes this.
  2. mikegillow

    mikegillow TrainBoard Member

    116
    117
    13
    What version of the DCC++ application package are you using? If it is 1.2.1 or 1.2.1+, I believe you need to be using version 1.6.6 or later of the Arduino IDE. (I am using 1.6.7.)
     
    Scott Eric Catalano likes this.
  3. robteed

    robteed TrainBoard Member

    18
    8
    8
    I'm using 1.6.5. I will try to update the IDE
     
    Scott Eric Catalano likes this.
  4. robteed

    robteed TrainBoard Member

    18
    8
    8
    I think my problem is due to having a previous version of the IDE made for the Intel Galileo board. Will try it on another computer.
     
    Scott Eric Catalano likes this.
  5. dcsun

    dcsun TrainBoard Member

    23
    16
    2
    I had pretty much the same problem, for me it was an outdated version of the Arduino IDE that my system installed from the repository. Updating to the latest one from the Arduino site solved it.

    Dave
     
    Scott Eric Catalano likes this.
  6. KC Smith

    KC Smith TrainBoard Member

    109
    111
    12
    removed.... Jason mentioned Uno+wifi info earlier
     
    Last edited: Jan 24, 2016
  7. RBrodzinsky

    RBrodzinsky November 18, 2022 Staff Member TrainBoard Supporter In Memoriam

    5,685
    2,786
    98
    There is now a DCC++ subforum open for the discussions about this. Hope to see lots of good discussion topics there.

    If there are any sub-threads of posts here that folks feel should be copied into their own distinct thread within the sub-forum, please let me know via PM, and I can help copy them.
     
  8. KC Smith

    KC Smith TrainBoard Member

    109
    111
    12
    Scott Eric Catalano likes this.
  9. Jean-Eric

    Jean-Eric TrainBoard Member

    25
    24
    8
    Hello Greg,

    First let me thank you for all the work you accomplished!
    Specially that you are the only one who delivered a DCC controller using something else than LMD18200T as a booster.

    I am using an Arduino Uno R3 with an Arduino Motor Shield
    As I am in Z scale and using a 12V in Vin I did not cut and scratch a thing under the motor shield.
    I made a bridge between pin 5&13 and 10&12

    I compiled & loaded the BaseStation (I tried the official & developper on your sites.google.com and the version from GitHub today the 24th of January) on my Arduino with Arduino 1.6.7

    My loco is an AZL GP38-2 with DZ123Z0

    Everything is working well and I even had a run with JMRI.

    I can program from main or prog track. But sadly in all cases I have a read fail.
    I did all the tests suggested including the CV105 with 254. The Loco is doing short bursts.
    I tried in 9V and 12V. Can't try in 15V as in Z scale.

    Kind regards from Paris

    P.S. Reading through the post I realize that as I am in Z scale with a DC not exceeding 12 v I did not cut the Vin. Could it be the reason??

    P.S2 I bend the pin of the Vin motor shield in order not to plug into the Vin on the UNO (but did not cut true trace), nothing changed
     
    Last edited: Jan 24, 2016
    Scott Eric Catalano likes this.
  10. hoyden

    hoyden TrainBoard Supporter

    815
    778
    30
    I tested out my dual motor shield configuration with both channels on the second shield wired in parallel and then wired to the A channel on the first shield. All worked without issue with the Arduino Mega driving both shields.

    The picture shows the pins on the second shield bent out and wired up to to lower motor shield. The two light bulbs are loads; one on each motor shield. I can't parallel the output of the first shield with the second shield until I sort out how to handle the current sense. The Seeed shield has provisions for current sense but the default jumper grounds the pins and there is no current sense capability implemented. I am considering using a Hall sensor but ultimately would like to parallel the second shield with the first.
    arduino.jpg
     
    KC Smith and Scott Eric Catalano like this.
  11. tz3p9v

    tz3p9v TrainBoard Member

    12
    18
    16
    Gregg,

    If you car considering the RS485 solution, may I suggest using a CMRInet compatible syntax for you control message from the master to the booster. While the a user may not combine the two, with a little planning, if the two were combined the messages may not interfere. .. for example if you were to prepend you current syntax with a given character sequence that is not used by CMRInet currently (same with the response) the two worlds could co-exist.

    Just a thought, while you are researching possible solutions.

    Thanks again for all your effort with DCC++
    Paul.
     
    Scott Eric Catalano likes this.
  12. tz3p9v

    tz3p9v TrainBoard Member

    12
    18
    16
    On further consideration (and read some previous posts).... CMRInet uses a PC program to be the master ... this would then be problematic is the Base Station was the master. However, if the serial message now passed to along the Base Controller and Boosters was just echoed over the RS485 line would not this be the same.... single master in the PC ... Base station as slave ... multiple base stations that are basically boosters ( or Base Controller for a portion of the track)

    On other issue to "add" or consider would be a way of "ID"ing the Base Controllers... possible just read 3 pins from the available pins to provide an ID from 0 to 7... (or more is appropriate)

    Paul.
     
    Last edited: Jan 24, 2016
    Scott Eric Catalano likes this.
  13. KC Smith

    KC Smith TrainBoard Member

    109
    111
    12

    Jean-Eric

    I have the same set of boards that you have but I use 15V for HO.
    I too have had problems reading CV on some older decoders on the programming track.
    I have two exact same Bachmann Steam Engines(motor) 2-8-4 with two different Tsunami decoders ,one sound , one motor only, they act completely different in motor start up. 1 click for the sound decoder moves the engine, were 10 clicks is needed to start the second engine without sound.

    First be sure to use only the Programming track to read/write as the Main track can only write.
    Second check to see that the 12 volt power has more than 500ma, better 1 amp of current.
    Third check the Voltage on the Track with the engine (load) on it make sure its around 12vAC.
    Fourth check the age of the decoder. I have a MRC AD310 motor only decoder from the 90's that would Program Fail error 306 every time. Changed it out with a 2003 NCE P2KSR motor only decoder and haven't had a problem.

    The Uno is rated for 7-12vdc input and even if you passed through from the Motor shield to the Uno the 12v should be fine. Its the Higher 15-18vdc power into the Motor shield to for N and HO scale that we want to prevent flowing to the UNO, thats why we cut the Vin on the Motor Shield.
    TD, correct me if I'm misstaken.

    After you check these we can look at the CV settings.

    Let us know and we'll go from there.
    Kevin

    P.S. If you haven't already done so, Click 0n Page 23 and scroll to post #455 "diagnostics".
    Folllow Greggs directions on using the <D> diagnostics command in the monitor to test the signal from the boards.
     
    Last edited: Jan 25, 2016
    Scott Eric Catalano likes this.
  14. Jean-Eric

    Jean-Eric TrainBoard Member

    25
    24
    8

    Kevin,

    Thank you for your quick reply. I will do all this as soon as I got my new Arduino Mega and new Motor Shield.
    Yesterday, just after writting my first post I Burnt my Motorshield :-(

    So far
    1- I did use only the programming track
    2- My DC power is 12V/3amp (in theory but I will mesure real value)
    3- I checked voltage on Main Track (it was 11,8V) but not on the Programming Track (I will)
    4- My Decoder is the last one available from Digitrax for AZL GP38-2. I have another one from Digitrax that I will try once my DC marklin BR24 will be digitalized by mself.


    Kind regards

    Jean-Eric
     
    Scott Eric Catalano likes this.
  15. mikegillow

    mikegillow TrainBoard Member

    116
    117
    13
    Jean-Eric,
    Do I understand correctly that you were able to write CV values to your loco and the loco motor pulsed in response, but you are unable to successfully read CV values? Is this only through JMRI or did you also try sending commands through the Serial Monitor? If JMRI only, are you using 4.3.2 or later? If Serial Monitor, I would suspect the root issue is the current sensing. I know that Gregg had to make adjustments to the current sensing for programming HO locos.
     
    Scott Eric Catalano likes this.
  16. Gregg

    Gregg TrainBoard Member

    237
    311
    18

    Jean-Eric,

    Sorry to hear about the burnt-out motor shield, but glad that you were able to get the system otherwise mostly up-and-running before the issue.

    Regarding reading the CVs on the programming track, if when you try to read the CV the loco moves in short bursts then everything is wired correctly and the read-request is being properly received by the loco. If the system is responding with a fail (i.e. read value returned = -1), then that implies the logic in the code to interpret current change on the programing track is not able to detect the spikes resulting from the loco moving. A few months back I updated the logic to make it more robust, but apparently it's not perfect :).

    My initial guess is that the read-problem is because of the low current used by Z-scale locos -- the current sensing logic may not be able to detect these smaller spikes. One way to test this theory is to increase the sensitivity of the current-sensing circuity. This is easily done by changing the reference voltage from its default (5V) to 1.1 volts using the Arduino's analogReference function. The version of the function depends on whether you are using an Uno or Mega. To try this out, add ONE of the following lines to the file DCCpp_Uno.ino directly after the Serial port is configured in the INITIAL SETUP:

    Code:
    void setup(){
    
      Serial.begin(115200);
      Serial.flush();
    
      analogReference(INTERNAL);     // <--- ADD THIS FOR UNO
      analogReference(INTERNAL1V1);  // <--- ADD THIS FOR MEGA
    
    ...
    

    After adding one of the above lines, but before trying out the CV reading, first verify that the loco still operates correctly on the Main track. It may be that the short-circuit protection triggers too fast with the above change. If you find this happens when you try to operate the loco, please raise the value of CURRENT_SAMPLE_MAX from 300 to something like 800 in the file CurrentMonitor.h. Once you've verified that the loco can be operated without tripping the short-circuit protection, move the loco to the Programming track and give the CV read a try.

    Please let us know how it goes.

    -Gregg

    P.S. If you use a 12V supply for the motor shield then it should be no problem to keep the Vin trace intact and use it to power the Arduino itself.
     
    Scott Eric Catalano and KC Smith like this.
  17. Gregg

    Gregg TrainBoard Member

    237
    311
    18
    All, I'm going to switch to creating new threads on the new sub-forum. Encourage everyone to do the same as well. It's also perfect for anyone just starting out with questions as it will allow us to focus on the specific issue in a specific thread.

    To help seed the sub-forum, I just started a thread for a DCC++ Server and posted my initial results for using I2C. You'll have to jump to the sub-forum to see the results :).
     
  18. Jean-Eric

    Jean-Eric TrainBoard Member

    25
    24
    8

    Dear

    Dear Mike
    Thank you for your answer
    - yes I can write CVs
    - yes the loco is pulsing
    - yes I can't read
    - yes I tested with Serial and JMRI (last version for Mac OS)

    Regards

    Dear Greg

    You are amazing!
    I will try your suggestion ASAP and bring a feed back.

    Many thanks

    P.S did you write any instruction for the Ethernet shield? (In order to interface with JMRI)
     
    Scott Eric Catalano likes this.
  19. Jean-Eric

    Jean-Eric TrainBoard Member

    25
    24
    8
    Perfect
     
    Scott Eric Catalano likes this.
  20. esfeld

    esfeld TrainBoard Member

    443
    382
    17
    Gregg/TwinDad
    Now that I have my setup using an Ethernet shield (tested as a Web Server with cable to router) .... Is there an example of code in our postings to use it wireless to connect Base station and Engine Driver?
    Steve
     
    Scott Eric Catalano likes this.

Share This Page