Distance sensor
An optical time-of-flight sensor that measures the distance to a target in millimeters.
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.
| Operation | Request or signal | Result |
|---|---|---|
| Identify | Read register 0xC0. | Model ID 0xEE. |
| Initialize | Run the driver’s initialize() sequence. | Applies tuning and performs reference calibration. |
| Start a sample | Run the single-shot start sequence in sample(). | Starts one range measurement. |
| Wait for completion | Poll register 0x13, mask 0x07, after the start bit clears. | A nonzero masked value signals a result. |
| Read distance | Read 12 bytes starting at 0x14. | Bytes 10–11 give millimeters, high byte first. |
| Clear interrupt | Write 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.
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.