> ## Documentation Index
> Fetch the complete documentation index at: https://dcc-5ccd5152.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding and Configuring DCC Command Stations in BigFred

> Connect BigFred to a Z21, LocoNet serial, or LocoNet TCP command station. Set the connection URI, speed steps, dead-man timing, and handset servers.

A **command station** in BigFred represents a physical DCC command station — the device that actually puts power and signals on the rails. BigFred connects to each command station using a typed connection URI and runs a dedicated background process for it. Before operators can drive locomotives, you need to add at least one command station and attach it to a layout.

Go to **Admin → Command Stations** to see all command stations in the catalogue. The table shows each station's name, type, connection URI, speed steps, timing settings, and whether the Z21 handset server is enabled.

## Adding a command station

Navigate to **Admin → Command Stations** and click **New Command Station**. Fill in the fields described below, then click **Create**.

After creating the command station, assign it to one or more layouts from **Admin → Layouts → edit** → **Command Stations**.

## Supported types and connection URIs

BigFred supports three kinds of command station. Choose the kind that matches your hardware, then enter the appropriate connection URI.

### Z21 (Roco / Fleischmann)

Select **Z21** for any Roco or Fleischmann Z21 command station connected over your local network.

**URI format:** `udp://<host>:<port>`

The port defaults to **21105** if your Z21 is using the factory default.

```text theme={null}
udp://192.168.0.111:21105
```

Find the host address on the Z21 sticker or in your router's DHCP table. Copy it into the URI field and save.

### LocoNet Serial

Select **LocoNet Serial** to connect via a USB or serial adapter (for example a Digitrax PR3 or MS100).

**URI format:** `serial://<device>:<baud>`

```text theme={null}
serial:///dev/ttyUSB0:57600
```

Use `autodetect` as the device name if you want BigFred to automatically pick the first available serial port:

```text theme={null}
serial://autodetect:57600
```

The baud rate is almost always `57600` for LocoNet adapters — check your adapter's documentation if you are unsure.

### LocoNet TCP

Select **LocoNet TCP** to connect to a LocoNet gateway over the network (for example JMRI or an lbserver).

Two wire formats are supported:

| URI scheme                 | Protocol                        |
| -------------------------- | ------------------------------- |
| `tcp://<host>:<port>`      | Raw binary LocoNet over TCP     |
| `lbserver://<host>:<port>` | ASCII LoconetOverTcp / LbServer |

```text theme={null}
tcp://192.168.0.50:1234
lbserver://192.168.0.50:1235
```

Use `tcp://` when connecting to a raw binary gateway, and `lbserver://` when connecting to a JMRI LocoNet-over-TCP server or a standalone lbserver instance.

## Configuration reference

### Core settings

| Field              | Default | Description                                                                    |
| ------------------ | ------- | ------------------------------------------------------------------------------ |
| **Name**           | —       | A human-readable label shown in the catalogue and in layouts. Required.        |
| **Kind**           | —       | The command station type: `Z21`, `LocoNet Serial`, or `LocoNet TCP`. Required. |
| **Connection URI** | —       | The type-specific URI described above.                                         |
| **Speed steps**    | 128     | The DCC speed step count sent to decoders: `14`, `28`, or `128`.               |

<Note>
  Use **128 speed steps** for all modern decoders. Only select 28 or 14 if you are running very old decoders that do not support 128-step mode.
</Note>

### Timing / dead-man settings

These settings control how BigFred monitors client connections and applies emergency stops. The defaults are appropriate for most installations — only change them if you have a specific reason.

| Field                      | Default            | Description                                                                                                                                                        |
| -------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Heartbeat interval (s)** | 2                  | How often BigFred sends a keep-alive ping to connected operator clients.                                                                                           |
| **Dead-man timeout (s)**   | 6                  | If a client's connection goes silent for this long, BigFred applies an emergency stop on that client's locomotives. Must be greater than the heartbeat interval.   |
| **Poll interval (ms)**     | 0 (daemon default) | How often BigFred polls the command station for state updates, for drivers that do not send push notifications. `0` uses the daemon's built-in default (\~750 ms). |

### Idle timeout

| Field                | Default | Description                                                                                                                                  |
| -------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **Idle timeout (s)** | 60      | How long a remote handset session may sit idle before BigFred releases its slot automatically. Set to `0` to disable automatic idle release. |

### Boot stop

| Field         | Default | Description                                                                                                                                                                |
| ------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Boot stop** | Off     | When enabled, BigFred sends speed 0 to every locomotive in the roster once after start-up. Useful for recovering from an unclean shutdown that may have left locos moving. |

### LocoNet slot budget (LocoNet stations only)

| Field                 | Default | Description                                                                                                                                                                                   |
| --------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Max LocoNet slots** | 80      | The maximum number of LocoNet hardware slots BigFred may lease on this station. The physical ceiling is 117 slots; tune this lower to leave headroom for non-BigFred devices sharing the bus. |

## Z21 handset server (optional)

Enable this if you want Z21-compatible physical handsets (such as the Roco multiMaus or Z21 app) to connect directly to BigFred and control locomotives from the layout's roster.

| Field                  | Default | Description                                                                                                                                                                                                                 |
| ---------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Z21 handset server** | Off     | Enables an inbound Z21 UDP server on this command station. Handsets connect to BigFred's IP on port **21105**.                                                                                                              |
| **IP stickiness**      | Off     | When enabled, handset sessions are keyed by client IP address only, so a UDP port change on reconnect does not drop the paired session. Enable this if your handsets frequently change UDP source port when they reconnect. |

<Note>
  The Z21 handset server listens on the default port 21105. Make sure no other service on the same machine is using that port before enabling it.
</Note>

## WiThrottle server (optional)

Enable this if you want WiThrottle-compatible apps (such as Engine Driver on Android or WiThrottle on iOS) to connect to BigFred over TCP.

| Field                 | Default | Description                                                                                                          |
| --------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
| **WiThrottle server** | Off     | Enables an inbound WiThrottle TCP server on this command station. Clients connect to BigFred's IP on port **12090**. |

<Note>
  When you disable a handset server (Z21 or WiThrottle) on a command station that had it previously enabled, any handsets currently connected will be disconnected. BigFred shows a warning in the edit dialog when this situation applies.
</Note>

## Assigning a command station to a layout

Creating a command station adds it to the global catalogue, but it does not automatically drive any layout. You must explicitly assign it:

1. Go to **Admin → Layouts**.
2. Click the edit icon on the target layout.
3. Add the command station from the **Command Stations** multi-select.
4. Click **Save**.

One command station can be assigned to multiple layouts, and one layout can use multiple command stations.

## Deleting a command station

Click the **red trash icon** on a command station's row and confirm. This removes the command station from the catalogue and stops its background process. Any operator sessions that were using that station will be disconnected. Remove the command station from all layouts before deleting it to avoid leaving layouts in an unconfigured state.
