Skip to main content

Limit switch

3D render of the assembled limit switch PCB

A roller-lever switch for detecting when a moving part reaches a stop.

Download datasheet (PDF)

Modeled roller-lever height: approximately 14.8 mm above the component-side PCB surface in the illustrated position. Allow space for the roller and lever through their full stroke.

Usage​

Choose Add device → Limit switch. Press the lever until it clicks, then release it. Place the stop so it trips the lever before the end of travel. The normally closed contact changes the sense of CTS compared with the pushbutton.

Protocol​

USB contact input. Read the clear-to-send signal (CTS) to get the switch state.

OperationRequest or signalResult
Open with Web Serialport.open({baudRate: 9600, flowControl: "none"})Opens the port for polling.
Set DTR lowport.setSignals({dataTerminalReady: false})Configures the serial control line.
Read with Web Serial(await port.getSignals()).clearToSendtrue = Released, false = Pressed.
Read with WebUSBVendor IN request to the device: 0x95, value 0x0706, index 0, length 2.Bit 0 of byte 0: 0 = Released, 1 = Pressed.

Use either the Web Serial or WebUSB path. The console polls every 10 ms and displays a change after 20 ms of stable readings.

Protocol implementation

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.

Component-side plan and isometric view showing 4 mounting holes and the J1 USB-C receptacle on the bottom edge.

Open full-size drawing · Drawing TSX · PCB source