Inside AI
← Build & Hack
Proposed build / Edge AI

Build a tiny tray-state sensor

Proposed build · Distinguish empty, part present and obstructed without continuously streaming the camera.

Device profile · Seeed Studio XIAO ESP32S3 Sense ↗
Start with the documented setup

This is a proposed workflow. Follow the linked official setup, then use the checks below to decide whether it works on your hardware.

Seeed Studio XIAO ESP32S3 Sense development board with its camera expansion.
Manufacturer product image. Camera modules have changed across batches; identify the sensor on your own unit before selecting firmware. Hardware reference for this proposed build; not a result from our test. Seeed Studio ↗

Parts and scope

Use a Sense board, USB-C data cable, computer and rigid mount over one small tray. Start with USB power and serial output. Optional microSD helps collect images. This is an intermediate firmware/ML project; it is not an inventory counter or a safety interlock.

1. Freeze the capture setup

Identify the sensor and record its PID, board-package version and camera settings. Enable PSRAM. Start with Seeed’s camera example and verify orientation, focus and exposure on the mounted scene before training. If reproducing the older classifier sketch, follow its explicitly documented 2.x compatibility constraint; do not combine unrelated example versions and assume they work. Camera setup Classifier reference

2. Build a dataset that can fail honestly

Collect empty, part-present and obstructed views in several separate sessions. Include hands, shadows, rotated parts, clutter outside the tray and partially visible parts. Split whole sessions into train/validation/test groups before making near-duplicate frames. Keep another day untouched until the firmware and thresholds are frozen. This split is our proposed method.

3. Export a small classifier

Use the documented image-training workflow as a starting route and export the Arduino inference library. Choose a small input image and confirm memory estimates. Preserve the exact preprocessing and labels from the export. The first acceptance gate is a successful compile and repeated captures on this unit, not an accuracy number from the training page. Training-to-firmware route

4. Add state logic before radio

Proposed rule: emit a new state only after three successive valid predictions agree above a validation-chosen threshold. Any capture error emits an error record; repeated ambiguity emits unknown. Log frame sequence, class scores and total capture-to-event duration. Three predictions is a starting design choice, not a proven setting.

5. Run, then extend

Run the held-out-day test before enabling radio. Only after it passes should you send state events to a local dashboard. Repeat the test with networking enabled and with the receiver disconnected. A GPIO LED can be another output, using the board’s documented electrical limits. Keep raw image retention opt-in.

Status and deliverable

Unrun proposal. No board was flashed and no classifier was trained by this lab. The intended deliverable is firmware plus its exported model, a labeled session manifest and a results CSV. Run the acceptance plan

Primary sources

Seeed · camera acquisition guide Seeed · image classification tutorial Espressif · ESP32 camera driver