Rotary encoder
An endless dial that counts detents in either direction and doubles as a pushbutton.
Shaft-tip height: 24.5 mm above the component-side PCB surface, with the push switch released and no knob fitted. The Ø6 mm D-shaft has a 4.5 mm flat dimension. Allow 1.5 mm of axial push travel plus assembly tolerance. Alps Alpine dimensional drawing, No. 3
Usage
Choose Add device → Rotary encoder. Turn the shaft to change the relative count or push it to select. Power-up establishes zero. Allow axial travel behind a printed knob so the push switch can close.
Protocol
USB serial · 115200 baud · DTR on. Send one ASCII command per line, ending in LF (\n).
| Command | Purpose | Reply |
|---|---|---|
id | Identify the device and firmware. | DEVICE tscircuit encoder 1.0.0 |
help | List supported commands. | One line of command syntax. |
status | Request the current detent count and push state. | One JSON report, shown below. |
led on | Turn the indicator on. | OK led=on |
led off | Turn the indicator off. | OK led=off |
Streamed report
The board streams one JSON object per line and repeats an unchanged reading about every 250 ms.
{"module":"dial","count":3,"pressed":1,"invalid":0,"uptime_ms":1250,"led":0}
The wrapping 32-bit count gives detents since power-up. Read it as signed to get direction: 4294967295 represents −1. pressed is 1 while the shaft is held down. invalid counts rejected quadrature transitions. Changes are sent at most once per 20 ms. uptime_ms counts milliseconds since power-up, and led is 1 when the indicator is on.
Mounting
The PCB measures 24 × 30 mm, with 4 × Ø2.2 mm clearance holes for M2 screws. The centre-to-centre spacing is 19 × 25 mm. Orient the component side with the J1 USB-C port at the bottom. Measure right and up from the lower-left corner of the PCB in the component-side view. The hole centres are at X = 2.5, 21.5 mm and Y = 2.5, 27.5 mm.