User Tools

Site Tools


DCC++ (EX)


DCC++ is a Command Station based on the Arduino UNO/MEGA and a L298 Motor Shield.

  • The DCC refresh stack size is 12, on a MEGA up to 50, with 127 speed steps and 28 functions.
  • PT, Programming track
  • POM, Programming On the Main. (Write only)
  • 32 GCA Interfaces compatible I/O.
  • DCC stationary decoder support.
  • 2A Booster power.


Extra features provided by the Rocrail implementation:

  • Slot management with passive slot purge after 30 seconds idle and speed zero. (Can be changed in the setup.)
  • Start of Day directly after establishing a serial connection.

**Support announcement**

Please consider that this is a real DIY project.
It is not supported by Rocrail nor GCA.
Just start with this modules if you are able to do some Arduino
programming yourself.

General Setup

The DCC++ library in Rocrail is dccpp.



The baud rate is set default to 115200.
:!: Some serial device drivers do not support CTS, hardware handshake, in that case CTS should be set unchecked.


A TCP/IP connection can be used if the Arduino features an Ethernet Shield.
The TCP/IP Port is fixed at 2560.



Serial read timeout in ms.


The number of slots is default 12. If using the MEGA it can be increased in the DCC++ sources.
The number of slots must be less or equal to the number of registers set in the DCC++ sources.

Slot Purge Time

The minimal idle time in seconds before a slot ist purged.
Purging is disabled if set to zero.

Sensor off delay

For pin 22..53 on the MEGA only.
Number of ms to wait before reporting an input as off. (The value should be a multiple of 10.)
The delay timer will be reset if an input gets high within this time.

System Info

Poll the main operations track current. (To show in Rocview's status bar.)

Echo commands

Echo switch commands for Arduino I/O only.

Swap gates

Swap the turnout and straight commands.


Use the JOIN command instead of MAIN in case of power ON.
See the DCC++ documentation for more details.

4 byte accessory commands

Uses 4 bytes in case of the <a address port gate on/off> command.
Without this option: <a address port gate>
See the DCC++ documentation for more details.


Determine the serial DTR level on startup. None is default.
Only used for incompatible DCC++ boards.


Determine the serial RTS level on startup. None is default.
Only used for incompatible DCC++ boards.

I/O Setup


Add a new I/O as defined with Type/Pin/Options.
It will be temporary created in the DCC++ CS.


Modify the selected I/O with the Type/Pin/Options settings.
It will be temporary modified in the DCC++ CS.


Delete the selected I/O.
It will be temporary deleted in the DCC++ CS.


Query all defined I/O's in the DCC++ CS.


Save all defined I/O in EEPROM.


Erase all defined I/O from EEPROM.
A new query is automatically issued.



Option Bit Value
Invert 0 0 = forward operation (ACTIVE=HIGH / INACTIVE=LOW)
1 = inverted operation (ACTIVE=LOW / INACTIVE=HIGH)
Restore 1 0 = state of pin restored on power-up to either ACTIVE or INACTIVE depending on state before power-down; state of pin set to INACTIVE when first created
1 = state of pin set on power-up, or when first created, to either ACTIVE of INACTIVE depending on bit 2
Initial 2 0 = state of pin set to INACTIVE upon power-up or when first created
1 = state of pin set to ACTIVE upon power-up or when first created

Input (Sensor)

Option Bit Value
Pull-up 0 1 = use internal pull-up resistor for the pin
0 = don't use internal pull-up resistor for the pin

Usually no manual settings are required here. Rocrail automatically defines Arduino pins as input or output pins as soon as the pins of such a DCC++ CS are used for triggering sensors, turnouts or signals. For input pins, the option "Invert / Pull-up" is activated by default, i.e. the internal pull-up resistor is used.

Manual intervention is required, only in the case that other options than the default ones are to be used at startup. It is generally recommended that you first create all objects in the plan with the desired pins. Then Rocrail should be restarted and all commands of objects that use output pins should be executed once; because at startup all used input pins and, when executing a command, all output pins are created from Rocrail in the DCC++ CS temporarily. After that, all used pins are listed at "Query" and the options can be changed directly. At the end don't forget to save!

When changing the option "Invert / Pull-up", the following must also be observed: For outputs, the "Invert" setting here is only valid when starting Rocrail. To ensure that the outputs for turnouts or signals are always used inverted, the value in the field "Parameter" on the "Interface" tab of these objects must be set to "1".


Sensors and Outputs are sharing the same address space; Avoid overlapping to prevent unexpected behaviour.



DCC Accessory.
Switches are addressed by the MADA scheme with decoder address and port. (DCC)

None Accessory

Arduino I/O.

Command Output
straight address + 0
turnout address + 1

None Accessory Single gate

Arduino I/O.

Command Output Pin status
straight address OFF
turnout address ON


Free Arduino pins can be used as sensor ports.



Outputs are addressed by the NMRA scheme with decoder address and port.

None Accessory

Free Arduino pins can be used as output ports.
To map the output for DCC the option "As switch" must be activated.


The accessory flag is used for Output commands.

Aspect numbers

Aspect number and Aspect Value can be used.
The aspect value represents a bit masks used for the four signal addresses.


I/O interface for the Arduino MEGA.


Type code Function
N No operation
O Output
I Input


I/O n

The GCA I/O connector selection.
The button layout resembles the PCB layout.

PIN mapping

MEGA PINs GCA connector GCA I/O
22..36 (even) I/O 1 1..8
23..37 (odd ) I/O 2 9..16
38..52 (even) I/O 3 17..24
39..53 (odd ) I/O 4 25..32

The I/O connectors will match all GCA boards like GCA76, GCA77, GCA93, GC94, GCA173 etc

Jumper Function Remark
JP1 Use 5V from Arduino board if placed. Place only if the Arduino is powerless, otherwise it will reset itself.


Programming Track

The rail power must be set to off before using the Programming Track.

Trouble Shooting

Loco stops at max.speed

Set the number of Decoder steps to 126 instead of 128 on the Interface tab of the loco properties.

dccpp/dccpp-en.txt · Last modified: 2023/09/05 18:13 by rjversluis