1. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    I’m in the process of acquiring the necessary components for a DCC++ build. First to arrive is the arduino mega 2650.
    My question is:
    Can I install the software on it without yet having the motor shield? I’m anxious to get learning.
    Thanks
     
  2. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Uncle peanut butter likes this.
  3. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
  4. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    Motor shield arrived today. I now have the necessary arduino components.
    Question:
    With the motor shield mounted onto the mega 2650 my input voltage 12vdc goes to the motor shield and that in turn powers the mega 2650?
    Taking it slow here as this is new to me.
    Thanks again
     
  5. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    @Jimbo20
    Can you point me to the correct pin to connect with pin 13? I think it's pin 2 but not sure. I have the mega 2650 connected via usb without 12vdc.

    pinMode(SIGNAL_ENABLE_PIN_MAIN,OUTPUT); // master enable for motor channel A
    mainRegs.loadPacket(1,RegisterList::idlePacket,2,0); // load idle packet into register 1

    bitSet(TIMSK1,OCIE1B); // enable interrupt vector for Timer 1 Output Compare B Match (OCR1B)
    // CONFIGURE EITHER TIMER_0 (UNO) OR TIMER_3 (MEGA) TO OUTPUT 50% DUTY CYCLE DCC SIGNALS ON OC0B (UNO) OR OC3B (MEGA) INTERRUPT PINS
    Thanks
     
  6. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Hi UPB,

    I have only ever used a Uno and a Nano for DCC++, but this document on the original DCC++ github confirms pin 13 and 2 are linked on the Mega:

    https://github.com/DccPlusPlus/Documentation/blob/master/Motor Shield Pin Mappings.pdf

    (scroll down to the second image)

    Also note that if you are using a supply of more than 12V to the shield (for the track) you must cut the link on the shield - as also shown on that document.
     
    Uncle peanut butter likes this.
  7. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    @Uncle peanut butter, if you haven't found it already, the development for DCC++ is being continued here: https://github.com/DCC-EX. We have made updates to the original version you have to make it more NMRA compatible (BaseSTation-Classic) and continue development on the new DCC++ EX. We have a long way to go on the documentation since there are just so many versions of it all out there. We are coordinating all this in the following threads:

    DCC++ Update Project 2020
    DCC++ 2020 Update Project Documentation

    You can always help with the project if you like!

    There is a good help page here, until we can organize the images into the new docs: http://1fatgmc.com/RailRoad/DCC/page-3.html
     
  8. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    Having a bit of trouble getting off the ground. Have followed the instructions and gave the diagnostic program a try.
    Jumper is on 2 and 13. led by 13 remains on regardless of <1> or <0> command. The TX and RX led flash quickly as if to acknowledge an input has been made.
    Power led is on. Windows 10 laptop running Arduino 1.8.12 (Windows Store 1.8.33.0)
    What I see in serial monitor:
    EE91D64E-D483-4254-86C4-96F006CC3B98.jpeg 9D40F434-DD90-4F59-917B-E401E0A70BB7.jpeg
    Thanks in advance for any suggestions
     
  9. rray

    rray Staff Member

    8,314
    9,479
    133
    I think there are not enough pixels in those photos to be readable.
     
  10. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    @rray
    I’ll see if scaling them up helps.
     
  11. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
  12. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Can you show the full line along the bottom of the screen that starts "Invalid library found in C:\users\keith\Documents ......."

    Also can you close the serial monitor and show the top of the Arduino IDE window that the serial monitor is hiding?
     
  13. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    @Uncle peanut butter . First, I still smile or laugh every time read your name! I LOVE it!! Ok, you are using the wrong pins. I know it can be confusing.

    THESE PINS ARE FOR THE MEGA ONLY!

    What you are doing with the diagnostic <D> mode is using the LED that is connected (unless you cut it) to pin 13 on an Arduino as a voltage sensor. If you connect anything to pin 13 that has a voltage greater than enough to bias the LED, it will light. You just had the steps backwards. This information is in the DCCpp_Uno.h file (In DCC++ EX, it is DCCppEX.h). This is the actual code:

    #define DCC_SIGNAL_PIN_MAIN 12
    #define DCC_SIGNAL_PIN_PROG 2

    So you can see that this sets the SIGNAL pin for the main track as coming out of pin 12 and from the service track out of pin 2. So by connecting these to the led on pin 13, you basically put a 10kHz signal onto the LED. ;) It will always flash way to fast to be meaningful, and it will do that no matter what you type in the serial monitor until you type a <D> ;) When you send the D command, you reset some settings that slow the clock down so that you can actually see the flashes and can even count the 1's and 0's. If you send a command, like a throttle command, you will see 22 1s, then a 0, then some 1's and 0's, and a 0, then some more 1's and zeros, then another zero, some more ones and zeros, then a 1, then it will go into a loop just sending idle packets.

    The DCC signal is always on. The difference is that it doesn't go out the motorboard to the track until you ENABLE the power to those channels. So you did the second part of Gregg's test first and success! If you already have those jumpered, hit <D>, then see if he flashes slow down. If you enter a command like <t 1 03 20 1>, that will send a command to an imaginary engine decoder at address three and tell it to go forward at speed 20. You should be able to see the pulses.

    To test that the signal to enable power to the motor board is working, test these pins:

    #define SIGNAL_ENABLE_PIN_MAIN 3
    #define SIGNAL_ENABLE_PIN_PROG 11

    Now when you connect pin 3 to pin 13 with the motor board off of the Arduino, the LED on the Arduino will go on with <1> and off with <0> . Same with pin 11 for the program track connecting it to pin 13.

    If all this works, the Arduino and code is fine and we can check your motor board

    Fred
     
    Last edited: May 1, 2020
  14. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    I will give this a shot tonight. Thanks for the input.
    My username is a shout to my uncle Gary. He was my train mentor and a real decent man. As he was getting older he once gave me a call and left me a message. “Hello Keith this is uncle .......... peanut butter “ He must have lost his train of thought and said the first thing he saw in the kitchen. He and I had a lot of fun going to train shows.
     
    FlightRisk likes this.
  15. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
  16. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    Great, I hope it is a simple fix. Check no pins are bent, and the other obvious stuff. Look forward to hearing your progress.
     
  17. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    Followed the above instructions for testing the motor shield and it worked as it should.
    I have to install a decoder in my Atlas C-424 (non DCC ready) and then I can try to run a train on a test track. This will be the first trains run in my house in 20 years!
     
    FlightRisk likes this.
  18. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    Question:
    The mega 2650/motor shield will always need 12vdc and a serial connection to a computer correct? I have an older MacBook that I run MXlinux on and was going to make this my DCC++ only computer. Will this be a good way to go?
     
  19. FlightRisk

    FlightRisk TrainBoard Member

    548
    237
    14
    No, not necessarily. In order to create a turnkey system, we created a system for people that could get them started without making their head (or wallet) explode. It is a Raspberry Pi, A Mega, and An Arduino Motor Shield Rev 3. You can use clones for the Arduino and Shield and we now support other motor boards if people need more current for all their accessories and/or locos. You can't run 20 locos on 3 Amps ;)

    You will always need usually at least 12V going to the Motor Shield depending on your scale, but you don't have to power the Arduino with that. I cut my Vin trace. I still only use 12V, but I power my Arduino through the Raspberry Pi's USB port with 5V. If you don't go over 12V and keep things cool, you can power both a Mega and the Motor Shield with 12V. I worry about the regulator being on the edge there on the Arduino boards, but it works.

    But you don't need a computer interface. DCC++ EX supports the Arduino Ethernet Shield and also code that Atani created that uses an esp8266 as a WiFi device. So if you want to play around, you can use a network interface to control the base station. There is no need for a computer at all if you had a Trottle of that was WiFi and can send DCC++ commands. The original DCC++ has throttle software, but not many people use it. One of these days I'll play with it. Maybe a stripped down version of that would be more popular. But it is written in a language called "Processing", so it is yet another thing like Python or Java that has to be installed for it to run.

    Connecting to a computer is just the simplest solution. You can still use a computer with JMRI or some other front end, and just cut the cord. You use WiFi instead of the USB cable. Personally, I use the Pi hard wired and run JMRI. I use the Pi's networking ability to connect to it's desktop or to the Wi Throttle server running on the Pi. So I can use my phone as a throttle. The Pi can be hidden under the layout, though I also have an 8" display attached to it and a little keyboard and mouse that I can pull out if I want. I am going to build a handheld device though. I like to turn knobs ;)
     
    Uncle peanut butter likes this.
  20. Uncle peanut butter

    Uncle peanut butter TrainBoard Member

    179
    238
    9
    @FlightRisk
    Your last statement is me also. An habitual tinkerer.
    Before I move further with this project should I stay with DCC++ or start my learning with DCC++EX. My planned layout won’t be one that runs many trains, 2 or 3 at most. The end goal is to run trains via an android tablet with the layout running DCC++ and JMRI. I have an interest in computers , trains and woodworking. Would like to balance these as much as possible. I will stay with genuine arduino products where possible. Is the language C++? Maybe a primer course would be helpful if so.
    Thanks, Keith
     

Share This Page