Arduino Nano and DCC++

bfking Dec 18, 2017

  1. bfking

    bfking New Member

    1
    0
    1
    Hi Folks!
    Has anyone attempted to replace the Arduino Uno or Mega used with the DCC++ program with an Arduino Nano or other Arduino microprocessor? If so, what changes did you have to make to the hardware, software, or other things? Thanks.
    Brian
     
  2. crusader27529

    crusader27529 TrainBoard Member

    247
    167
    11
    Yes....I designed a setup for ONLY train control, no sensors and EEPROM and the like, to make room for controlling about 40 locos or consists.

    Nobody on this forum seemed to be interested, so I'm using it to control my club layout......it supports up to 8 total power districts, remote to a distance of 80' from the system.

    It IS public domain.
     
  3. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11
    Hi,

    Welcome to the forum!

    I have made a small n-gauge layout using a Arduino Nano running DCC++. As the nano is very similar architecture to the Uno, the software only needed minimal changes for it to compile and load onto the Nano.

    As I needed more input pins for sensors than the Nano (or Uno) has spare, I added a 4067 mux board, which meant a few further changes to the DCC++ code were needed.

    As to the motor driver board, I used a simple L298 driver board (not arduino specific) and added my own transistors to it (they were the parts I already had in my spares collection). There is no reason why you couldn't use a standard Arduino driver board and connect it to the Nano, though doing this isn't simply plug and play like using a Uno or Mega.

    You can see a few photos of my layout (still under development) in this thread:

    http://www.trainboard.com/highball/index.php?threads/dcc-wifi-controller-on-an-esp8266-07.111489/

    If you need more details on any of this let me know

    Jim
     
  4. chi.sp

    chi.sp New Member

    7
    12
    7
    Hi All,

    For those, like me, who wasn't aware of.
    Before I know the experiences with DCC++ of french guys posted in www.locoduino.org, I used to remove all the conditionals "UNO or
    MEGA" to compile DCC++ into Nano or Pro Mini.

    I learned then a simplest way to have a succesfull compilation by replacing the UNO code name by the code name of the board you want
    to use.
    For example, for using NANO board, just replace the code name ARDUINO_AVR_UNO by ARDUINO_AVR_NANO.

    This is done in three tabs of the sketch:

    on DCCpp_Uno.h at line 23
    (at line 25 replace "UNO" by the name of board to be used so it will be reflected on the initial output base station message to
    serial monitor).

    on DCCpp_Uno.ino at lines 299 and 448

    and on CurrentMonitor.h at line 18.

    Following is the table of boards code names:
    ====================================================================
    B O A R D S C O D E
    ====================================================================
    Arduino Yun ARDUINO_AVR_YUN
    Arduino/Genuino Uno ARDUINO_AVR_UNO
    Arduino Duemilanove or Diecimila ARDUINO_AVR_DUEMILANOVE
    Arduino Nano ARDUINO_AVR_NANO
    Arduino/Genuino Mega or Mega 2560 ARDUINO_AVR_MEGA2560
    Arduino Mega ADK ARDUINO_AVR_ADK
    Arduino Leonardo ARDUINO_AVR_LEONARDO
    Arduino/Genuino Micro ARDUINO_AVR_MICRO
    Arduino Esplora ARDUINO_AVR_ESPLORA
    Arduino Mini ARDUINO_AVR_MINI
    Arduino Ethernet ARDUINO_AVR_ETHERNET
    Arduino Fio ARDUINO_AVR_FIO
    Arduino BT ARDUINO_AVR_BT
    LilyPad Arduino USB ARDUINO_AVR_LILYPAD_USB
    LilyPad Arduino ARDUINO_AVR_LILYPAD
    Arduino Pro or Pro Mini ARDUINO_AVR_PRO
    Arduino NG or older ARDUINO_AVR_NG
    Arduino Robot Control ARDUINO_AVR_ROBOT_CONTROL
    Arduino Robot Motor ARDUINO_AVR_ROBOT_MOTOR
    Arduino Gemma ARDUINO_AVR_GEMMA


    The thread links, which were presented to us by Pieter (http://www.trainboard.com/highball/...lu-mc33926-motor-shield-and-dcc.100752/page-2) are:
    http://www.locoduino.org/spip.php?article182
    http://www.locoduino.org/spip.php?article185
    http://www.locoduino.org/spip.php?article187


    There we can see DCC++ being used in a different approach, with a 3A LDM18200 and a external current sensor MAX471 module.
    Very interesting for the new combinations made possible, including using only a single LDM18200 drive board and switch pin signals to
    use for main or programming operations (just an idea, i have not built it...yet).

    Chi
     
    Last edited: Dec 19, 2017
    Atani likes this.
  5. Trusty

    Trusty TrainBoard Member

    52
    33
    6
    You are right, Locoduino is a good place (with a small googleing to translate...) to learn about DCC++ in other situations than regular shields. I have myself posted a new library DCCpp giving a more simple alternative to original work of Gregg through a classic Arduino library. It is not anymore necessary to change the library code to be able to create a DCC control. The only exception (In France, we love exceptions...) is the choice of Ethernet shield... It works on Nano, Uno and Mega. Check the samples to see how it's easy to use !
     
  6. Jimbo20

    Jimbo20 TrainBoard Member

    274
    178
    11

    An alternative approach - I found that the standard bootloader code installed in the Nano is somewhat larger than that in the Uno (2k vs 0.5k). If you need as much memory as possible for your Nano, then it is worth installing the Uno bootloader into the Nano.

    For unrelated previous issues I had already done this on my DCC++ basestation and accessory decoder Nanos with no ill effects.

    An added advantage is that the DCC++ program code does not need to be altered because when installing it into the Nano, you select 'Uno' - because that is what the Nano reports in to the IDE as.

    EG See http://www.buildlog.net/blog/2017/09/getting-more-program-space-on-an-arduino-nano/

    Jim
     

Share This Page