# incremental

Use the `incremental` encoder model to configure [a quadrature encoder](https://en.wikipedia.org/wiki/Incremental_encoder).

Configuring an `incremental` encoder requires specifying the pin numbers of the two pins on the board to which the encoder is wired. These two pins provide the phase outputs used to measure the speed and direction of rotation in relation to a given reference point.

To be able to test the encoder as you configure it, connect the encoder to your machine’s computer and power both on.

- [JSON Template](https://docs.viam.com/reference/components/encoder/incremental/#configure-an-incremental-encoder-0)
- [JSON Example](https://docs.viam.com/reference/components/encoder/incremental/#configure-an-incremental-encoder-1)

The following attributes are available for `incremental` encoders:

| Name   | Type   | Required?    | Description |
|--------|--------|--------------|-------------|
| `board`| string | **Required** | The `name` of the [board](https://docs.viam.com/reference/components/board/) to which the encoder is wired. |
| `pins` | object | **Required** | A struct holding the names of the pins wired to the encoder:<br>- `a`: Pin number of one of the pins to which the encoder is wired.<br>- `b`: Required for two phase encoder. Pin number for the second board pin to which the encoder is wired.<br>If the encoded motor does not operate as expected, the encoder pins might be configured in reverse, switch the `a` and `b` pin definitions in your incremental encoder attributes to reconfigure your encoded motor. |

Viam also supports a model of encoder called [`"single"`](https://docs.viam.com/reference/components/encoder/single/) which requires only one pin (`i`).

## Test the encoder

Once your encoder is configured and connected, open the encoders’s **TEST** panel on the **CONFIGURE** or [**CONTROL**](https://docs.viam.com/monitor/default-interface/#web-ui) tabs. The ticks count is displayed. Try moving the encoder (for example, by turning a motor it is attached to) and check whether the count increases as expected.

If the encoder does not appear on the **TEST** panel, or if you notice unexpected behavior, check your machine’s [**LOGS** tab](https://docs.viam.com/monitor/troubleshoot/#check-logs) for errors, and review the configuration.
