> ## 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.

# Pairing a Roco Z21 Multi-Mouse or WLANmaus with BigFred

> Connect a Roco Z21 multi-mouse, WLANmaus, or compatible Z21 UDP handset to BigFred over UDP and pair it with a vehicle in your roster.

If you have a physical Roco or Fleischmann handset, you can point it at BigFred instead of a hardware Z21 base station. BigFred acts as a Z21 command station over UDP, and once paired your handset controls a locomotive in your BigFred roster — with full idle-brake protection.

## Compatible hardware

Any handset that speaks the Roco Z21 LAN protocol over UDP will work, including:

* Roco Z21 multi-mouse
* Roco WLANmaus
* Roco Z21 start handset
* Third-party apps and software that implement the Z21 UDP protocol

## Before you start

* Your handset and the BigFred server must be on the **same WiFi network**.
* Your admin must have enabled the **Z21 server** on the command station you want to use. If the command station does not appear in the Remotes dropdown, ask them to turn it on under **Admin → Command Stations**.

## Pairing your handset

<Steps>
  <Step title="Open the Remotes page and start pairing">
    In BigFred, navigate to **Remotes** in the top menu. Select the command station you want to use from the dropdown. If the command station has both Z21 and WiThrottle enabled, click the **Z21** tab.

    Optionally choose which vehicles the handset is allowed to control:

    * Toggle **Allow all vehicles** to give the handset access to your whole roster, or
    * Type vehicle names in the **Vehicles** field to restrict access to a specific set.

    Set the **Handset brake seconds** value if you want a longer or shorter idle timeout (6–60 seconds).

    Click **Generate Pairing**.
  </Step>

  <Step title="Note the pairing code">
    BigFred enters pairing mode and displays a pairing code in the format:

    ```
    CV3=122 + CV4=145
    or  F1 F2 F2 F1 F4 F5
    ```

    The code is shown as both a CV3/CV4 pair and the equivalent function-key sequence. You have **five minutes** before the pairing window expires.

    <Note>
      If your admin has enabled **IP stickiness** on this command station, any connection from your IP address is automatically paired without requiring you to enter a code. In that case BigFred confirms the pairing as soon as your handset connects.
    </Note>
  </Step>

  <Step title="Configure the handset network settings">
    On your Z21 handset, go to its network or command station settings and enter:

    * **IP address** — the IP address of the BigFred server on your local network
    * **Port** — `21105` (or the custom port your admin configured)

    Save the settings. The exact menu path varies by handset model — consult your handset's manual if you are unsure where to find it.
  </Step>

  <Step title="Enter the pairing code on the handset">
    After the handset connects to BigFred, it will prompt you for a pairing code. Enter the **CV3** and **CV4** values shown in BigFred, or use the equivalent function-key sequence displayed on screen.

    BigFred recognises the code and links the handset session to your account. The status chip on the Remotes page changes to **Paired**.
  </Step>

  <Step title="Select a locomotive and drive">
    Your handset is now paired. Select any locomotive from the handset's address list — BigFred will route it to the corresponding vehicle in your roster. Speed, direction, and function commands flow through BigFred to the DCC bus.
  </Step>
</Steps>

## Session expiry and idle brake

Your handset session is valid as long as the handset keeps sending UDP traffic. If the handset goes idle for longer than the configured **handset brake seconds**, BigFred brakes the locomotive and marks the session as idle-braked. To resume, reconnect your handset and repeat the pairing process.

<Warning>
  Moving out of WiFi range or switching to a different network will trigger the idle brake. BigFred brings the locomotive to a controlled stop.
</Warning>

If IP stickiness is enabled, BigFred shows an approximate session expiry time in the Connected Clients table. When this time passes, the session is cleared and you will need to re-pair.

## Unpairing

To end a handset session manually:

* On the **Remotes** page, click **Unpair** while the session is active, **or**
* Find your entry in the **Connected Clients** table and click **Unpair** next to it.

BigFred immediately releases the handset's throttle slot and the locomotive stops receiving commands from that handset.
