Build a distance and object-presence demo
Use a distance measurement and a calibrated threshold to prototype object presence. The HardwareBlocks Distance Kit uses a VL53L0X time-of-flight sensor and distance.sample events. Its API accepts 0–2,000 mm, but usable physical range depends on the target, light, mounting and sensor setup.
Build it step by step.
Try near and far samples
Create a Distance simulation. Send a distance.sample event and display distance_mm plus valid. An invalid reading must not mean empty space.
Measure your two states
At the actual installation position, measure the empty and occupied conditions. Choose a threshold between the measured ranges rather than assuming a universal value.
Add stability
Require several consistent readings and different enter/exit thresholds in your backend to reduce flicker. Show unknown when data is stale or invalid.
Test before using it
Check reflective and dark targets, ambient light and enclosure openings. Keep this a short-range prototype; it is not a certified vehicle safety or collision-avoidance device.
A garage experiment has constraints
A sensor can detect a target in a carefully chosen position. It cannot infer occupancy of an entire garage from any arbitrary mounting point. Confirm that both states are within the sensor’s verified operating range.
The event contract.
Example payload for simulation; it is not a physical measurement. Use the current sensor schema for validation.
{
"type": "distance.sample",
"data": {
"distance_mm": 450,
"valid": true
}
}Your starting prompt.
Copy into your coding assistant. Keep all private keys out of the prompt.