JMRI® connects to...

Supported Hardware

Installation

Applications

Tools

JMRI provides powerful tools for working with your layout:

Layout Automation

JMRI can be used to automate parts of your layout, from simply controlling a crossing gate to running trains in the background.
Donate to JMRI

DCC++ Turnouts and Outputs

Types of DCC++ Turnout Control

There are 3 ways to control a turnout via DCC++:

For each control method, there are two things you must configure:

Direct DCC Accessory Control

With Direct control, you can directly control a DCC Stationary Decoder through DCC++. There will be no feedback on the turnout's actual position.

To control a Stationary Decoder or other DCC-controlled Accessory (using the Base Station's "a" command), follow these steps.

1: Choose a System Name and a User Name

The Hardware Address for a Direct DCC accessory must be the accessory's DCC address. For example, if your Stationary Decoder's switch address is set to 52, the Hardware Address for that turnout should be 52.

The User Name can be anything you like.

2: Add the Turnout to the JMRI Turnout Table

In the JMRI Turnout Table...

  1. Click the "Add" button
  2. Make sure "DCC++" is selected in the System Name chooser
  3. Enter the turnout's DCC address in the Hardware Address box
  4. Enter the turnout's User Name in the User Name box
  5. Click "OK"
  6. Click the "Edit" button on the new Turnout's row
  7. Click the "Feedback" tab in the Edit Turnout dialog
  8. Choose "DIRECT" in the Feedback Mode chooser
  9. Click "OK"
Entry Meaning makes System Name Mask Equivalent Minimum Maximum
12 ID in internal DCC++ table DT12 integer 0 32767

3: Configure the Base Station

For Direct mode control, there is no Base Station configuration needed.

Indexed DCC Accessory Control

Indexed control is the preferred method of controlling DCC Statonary Decoders with DCC++.

With Indexed control, you can control a DCC Stationary Decoder through DCC++, using the Base Station's internal turnout index table.

Each turnout has an entry in the Base Station's turnout table. The base station stores the actual DCC Stationary Decoder address internally, and you assign an ID value (anything from 0-32767) to the turnout. JMRI references the turnout using the ID value, not the decoder address.

Turnout ID values do not need to be sequential. Each turnout's ID can be any unused value within the allowed range (0-32767).

To control a Stationary Decoder or other DCC-controlled Accessory using Indexed control (using the Base Station's "T" command), follow these steps.

1: Choose a System Name and a User Name

The Hardware Address for an Indexed DCC accessory is the ID value assigned in the Base Station's internal Turnout table. For example, if your Stationary Decoder's switch address is set to 52, and that decoder is assigned ID value 13 in the Base Station, the Hardware Address for that turnout should be 13.

The User Name can be anything you like.

2: Add the Turnout to the JMRI Turnout Table

NOTE: Turnout configurations stored in the Base Station's EEPROM will be automatically added to the JMRI Sensor Table on startup.

In the JMRI Turnout Table...

  1. Click the "Add" button
  2. Make sure "DCC++" is selected in the System Name chooser
  3. Enter the turnout's ID value in the Hardware Address box
  4. Enter the turnout's User Name in the User Name box
  5. Click "OK"
  6. Click the "Edit" button on the new Turnout's row
  7. Click the "Feedback" tab in the Edit Turnout dialog
  8. Choose "BSTURNOUT" ("MONITOR" in JMRI 4.6.x or previous) in the Feedback Mode chooser
  9. Click "OK"

3: Configure the Base Station

Use the JMRI/DCC++ "Configure Base Station" (4.6.x: "Configure Sensors & Turnouts") tool to store the turnout ID and DCC Address in the Base Station.

Note: DCC++ requires the use of an Address/Subaddress pair. If your Stationary Decoder does not have subaddresses, take the address and divide by 4. The result is the address, the remainder is the subaddress. For example, Address 51 (no subaddress) is DCC++ Address 12, Subaddress 3.

  1. From the DCC++ Menu, choose "Configure Base Station" (or "Configure Sensors & Turnouts")
  2. Choose the "Turnouts" tab
  3. Click the "Add Turnout" button. This will add a new row to the table.
  4. In the new row, set the "Index" to the ID value of the new turnout
  5. In the new row, set the "Address" to the DCC address of the new turnout
  6. If the turnout has a sub-address, set the "Subaddress" to the correct value for the new turnout. Otherwise, make sure the subaddress value is zero (0)
  7. Click "Save Turnouts" or "Close" and answer the prompts

Note: On JMRI versions 4.6.x and earlier, if you choose "Save Turnouts" you will not be given the opportunity to write the changes to the Base Station's EEPROM. To write to EEPROM, you must choose "Close" instead of "Save Changes".

Indexed DCC++ Output Pin Control

Indexed Output Pin control is the only way to control a turnout directly connected to a DCC++ Arduino IO pin from JMRI.

With Indexed control, you can control a DCC++ Arduino IO pin, using the Base Station's internal output index table.

Each Output pin has an entry in the Base Station's Output table. The base station stores the actual Arduino IO Pin number internally, and you assign an ID value (anything from 0-32767) to the output. JMRI references the turnout using the ID value, not the Arduino pin number.

Output ID values do not need to be sequential. Each turnout's ID can be any unused value within the allowed range (0-32767).

When using analog Arduino pins as digital outputs, use the pin's digital pin number. For example, analog pin A0 is digital pin 14

To control an Arduino IO pin using Indexed control (using the Base Station's "Z" command), follow these steps.

1: Choose a System Name and a User Name

The Hardware Address for an Indexed Output is the ID value assigned in the Base Station's internal Output table. For example, if your turnout control is connected to Arduino pin 7, and that output is assigned ID value 13 in the Base Station, the Hardware Address for that turnout should be 13.

The User Name can be anything you like.

2: Add the Turnout to the JMRI Turnout Table

NOTE: Output configurations stored in the Base Station's EEPROM will be automatically added to the JMRI Sensor Table on startup.

In the JMRI Turnout Table...

  1. Click the "Add" button
  2. Make sure "DCC++" is selected in the System Name chooser
  3. Enter the turnout's ID value in the Hardware Address box
  4. Enter the turnout's User Name in the User Name box
  5. Click "OK"
  6. Click the "Edit" button on the new Turnout's row
  7. Click the "Feedback" tab in the Edit Turnout dialog
  8. Choose "BSOUTPUT" ("EXACT" in JMRI 4.6.x or previous) in the Feedback Mode chooser
  9. Click "OK"

3: Configure the Base Station

Use the JMRI/DCC++ "Configure Base Station" (4.6.x: "Configure Sensors & Turnouts") tool to store the turnout ID and Arduino pin number in the Base Station.

  1. From the DCC++ Menu, choose "Configure Base Station" (or "Configure Sensors & Turnouts")
  2. Choose the "Outputs" tab
  3. Click the "Add Output" button. This will add a new row to the table.
  4. In the new row, set the "Index" to the ID value of the new output
  5. In the new row, set the "Pin #" to the Arduino pin number of the new turnout
  6. If the pin output needs to be inverted, check the "Invert Output" box
  7. Click "Save Outputs" or "Close" and answer the prompts

Note: On JMRI versions 4.7.1 and earlier, if you choose "Save Outputs" you will not be given the opportunity to write the changes to the Base Station's EEPROM. To write to EEPROM, you must choose "Close" instead of "Save Changes".

General Notes

On Turnout and Output IDs

Turnout and Output IDs do not need to be sequential. You can use any unused value within the allowed range (0-32767). The DCC++ Base Station will also allow a Turnout and an Output to have the same ID and be treated as separate devices (they are stored in separate tables and accessed via different commands).

However, JMRI requires that all (JMRI) Turnout System Names be unique, and therefore the Hardware Addresses assigned to Turnouts and Outputs must be different. For example, while the Base Station will allow a Turnout ID 2 and an Output ID 2, JMRI will not be able to treat these as separate devices, so this is not allowed.

For the same reason, you must choose Turnout/Output ID values that are different from any Direct mode DCC Address Turnouts accessed through the DCC++ Base Station.

If you have multiple interfaces (e.g. a stand-alone LocoNet or a second DCC++ Base Station), each interface has its own "namespace", so you can have a Turnout ID2 on one DCC++ Base Station interface and a Direct Address 2 turnout on a different DCC++ Base Station, and a LocoNet address 2 turnout on a stand-alone LocoNet interface.

Having said that, such overlapping address spaces can be very confusing, so we recommend allocating certain address spaces for each interface so that there is only one "Turnout #42" on the whole system

On Inverting Outputs (BSOUTPUT mode Turnouts)

The DCC++ Base Station Output table allows the output signal to be inverted. JMRI also allows JMRI Turnouts to be inverted in the JMRI Turnout Table entries. This means that a BSOUTPUT mode Turnout can be inverted twice. Please be sure to check both the Base Station settings and the Turnout Table settings to be sure that you achieve the intended result.

On Using the JMRI "Configure Base Station" Tool

The "Configure Base Station" tool is a convenient way to program the Sensor, Turnout and Output tables in your Base Station. It is not, however, required to work with DCC++ within JMRI. You can, for example, set up your Base Station's tables using the DCC++ serial command interface, or the DCC++ Controller software. As long as the IDs assigned in the Base Station match the Hardware Address assigned in JMRI's Turnout Table, all will be well.