Skip to main content

Distance sensor

3D render of the assembled distance sensor PCB

An optical time-of-flight sensor that measures the distance to a target in millimeters.

Download datasheet (PDF)

Modeled component height: approximately 3.3 mm above the component-side PCB surface.

Usage​

Choose Add device → Distance sensor, grant USB access, and face the optical window toward the target. The card shows a live reading and 30 seconds of history. Design an opening around the sensor. The console flags readings outside 30–300 mm and leaves a gap for invalid returns.

Protocol​

WebUSB → I²C · 7-bit address 0x29. The driver initializes and calibrates the sensor at each connection.

OperationRequest or signalResult
IdentifyRead register 0xC0.Model ID 0xEE.
InitializeRun the driver’s initialize() sequence.Applies tuning and performs reference calibration.
Start a sampleRun the single-shot start sequence in sample().Starts one range measurement.
Wait for completionPoll register 0x13, mask 0x07, after the start bit clears.A nonzero masked value signals a result.
Read distanceRead 12 bytes starting at 0x14.Bytes 10–11 give millimeters, high byte first.
Clear interruptWrite 0x01 to 0x0B.Acknowledges the measurement.

The console accepts the distance when bits 6–3 of byte 0 equal 11. See the driver for the full initialization sequence and USB packet format.

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